Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275185 > unrolled thread

[PATCH 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy.

Started byEnric Balletbo i Serra <eballetbo@gmail.com>
First post2015-11-23 11:00 +0100
Last post2015-11-23 11:00 +0100
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy. Enric Balletbo i Serra <eballetbo@gmail.com> - 2015-11-23 11:00 +0100
    [PATCH 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer Enric Balletbo i Serra <eballetbo@gmail.com> - 2015-11-23 11:00 +0100
    [PATCH 1/2] fs/pstore: Use memcpy_toio instead of memcpy Enric Balletbo i Serra <eballetbo@gmail.com> - 2015-11-23 11:00 +0100

#1275185 — [PATCH 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy.

FromEnric Balletbo i Serra <eballetbo@gmail.com>
Date2015-11-23 11:00 +0100
Subject[PATCH 0/2] fs/pstore: Use memcpy_from/toio() instead of memcpy.
Message-ID<qxW4G-8tT-1@gated-at.bofh.it>
Dear all,

These patches were needed in order to make ramoops work in my armv8 board. They
originally come from chrome os kernel, so I kept the original authors. I found
that weren't in mainline so I thought that will be really interesting send them.

Best regards,
Enric

Andrew Bresticker (1):
  fs/pstore: Use memcpy_fromio() to save old ramoops buffer

Furquan Shaikh (1):
  fs/pstore: Use memcpy_toio instead of memcpy

 fs/pstore/ram_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1275195 — [PATCH 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer

FromEnric Balletbo i Serra <eballetbo@gmail.com>
Date2015-11-23 11:00 +0100
Subject[PATCH 2/2] fs/pstore: Use memcpy_fromio() to save old ramoops buffer
Message-ID<qxW4H-8tT-25@gated-at.bofh.it>
In reply to#1275185
From: Andrew Bresticker <abrestic@chromium.org>

The ramoops buffer may be mapped as either I/O memory or uncached
memory.  On ARM64, this results in a device-type (strongly-ordered)
mapping.  Since unnaligned accesses to device-type memory will
generate an alignment fault (regardless of whether or not strict
alignment checking is enabled), it is not safe to use memcpy().
memcpy_fromio() is guaranteed to only use aligned accesses, so use
that instead.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-by: Puneet Kumar <puneetster@chromium.org>
Signed-off-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
---
 fs/pstore/ram_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 351164d..5308277 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -322,8 +322,8 @@ void persistent_ram_save_old(struct persistent_ram_zone *prz)
 	}
 
 	prz->old_log_size = size;
-	memcpy(prz->old_log, &buffer->data[start], size - start);
-	memcpy(prz->old_log + size - start, &buffer->data[0], start);
+	memcpy_fromio(prz->old_log, &buffer->data[start], size - start);
+	memcpy_fromio(prz->old_log + size - start, &buffer->data[0], start);
 }
 
 int notrace persistent_ram_write(struct persistent_ram_zone *prz,
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1275198 — [PATCH 1/2] fs/pstore: Use memcpy_toio instead of memcpy

FromEnric Balletbo i Serra <eballetbo@gmail.com>
Date2015-11-23 11:00 +0100
Subject[PATCH 1/2] fs/pstore: Use memcpy_toio instead of memcpy
Message-ID<qxW4I-8tT-31@gated-at.bofh.it>
In reply to#1275185
From: Furquan Shaikh <furquan@google.com>

persistent_ram_update uses vmap / iomap based on whether the buffer is in
memory region or reserved region. However, both map it as non-cacheable
memory. For armv8 specifically, non-cacheable mapping requests use a
memory type that has to be accessed aligned to the request size. memcpy()
doesn't guarantee that.

Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Signed-off-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
---
 fs/pstore/ram_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 76c3f80..351164d 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -299,7 +299,7 @@ static void notrace persistent_ram_update(struct persistent_ram_zone *prz,
 	const void *s, unsigned int start, unsigned int count)
 {
 	struct persistent_ram_buffer *buffer = prz->buffer;
-	memcpy(buffer->data + start, s, count);
+	memcpy_toio(buffer->data + start, s, count);
 	persistent_ram_update_ecc(prz, start, count);
 }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web