All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: ext4: Fix alignment of cache buffers
@ 2020-03-25 20:27 Jan Kiszka
  2020-03-25 20:31 ` Tom Rini
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jan Kiszka @ 2020-03-25 20:27 UTC (permalink / raw)
  To: u-boot

From: Jan Kiszka <jan.kiszka@siemens.com>

We need to align the cache buffer to ARCH_DMA_MINALIGN in order to avoid
access errors like

CACHE: Misaligned operation at range [be0231e0, be0235e0]

seen on the MCIMX7SABRE.

Fixes: d5aee659f217 ("fs: ext4: cache extent data")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 fs/ext4/ext4fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 1c616a26a2..966b427a97 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -288,7 +288,7 @@ int ext_cache_read(struct ext_block_cache *cache, lbaint_t block, int size)
 	if (cache->buf && cache->block == block && cache->size == size)
 		return 1;
 	ext_cache_fini(cache);
-	cache->buf = malloc(size);
+	cache->buf = memalign(ARCH_DMA_MINALIGN, size);
 	if (!cache->buf)
 		return 0;
 	if (!ext4fs_devread(block, 0, size, cache->buf)) {
-- 
2.16.4


-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] fs: ext4: Fix alignment of cache buffers
  2020-03-25 20:27 [PATCH] fs: ext4: Fix alignment of cache buffers Jan Kiszka
@ 2020-03-25 20:31 ` Tom Rini
  2020-03-25 20:35 ` Stephen Warren
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2020-03-25 20:31 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 25, 2020 at 09:27:51PM +0100, Jan Kiszka wrote:

> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> We need to align the cache buffer to ARCH_DMA_MINALIGN in order to avoid
> access errors like
> 
> CACHE: Misaligned operation at range [be0231e0, be0235e0]
> 
> seen on the MCIMX7SABRE.
> 
> Fixes: d5aee659f217 ("fs: ext4: cache extent data")
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  fs/ext4/ext4fs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
> index 1c616a26a2..966b427a97 100644
> --- a/fs/ext4/ext4fs.c
> +++ b/fs/ext4/ext4fs.c
> @@ -288,7 +288,7 @@ int ext_cache_read(struct ext_block_cache *cache, lbaint_t block, int size)
>  	if (cache->buf && cache->block == block && cache->size == size)
>  		return 1;
>  	ext_cache_fini(cache);
> -	cache->buf = malloc(size);
> +	cache->buf = memalign(ARCH_DMA_MINALIGN, size);
>  	if (!cache->buf)
>  		return 0;
>  	if (!ext4fs_devread(block, 0, size, cache->buf)) {

Thanks for digging in to this.

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200325/6892aa10/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fs: ext4: Fix alignment of cache buffers
  2020-03-25 20:27 [PATCH] fs: ext4: Fix alignment of cache buffers Jan Kiszka
  2020-03-25 20:31 ` Tom Rini
@ 2020-03-25 20:35 ` Stephen Warren
  2020-03-26 11:38 ` Peter Robinson
  2020-03-27 21:55 ` Tom Rini
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Warren @ 2020-03-25 20:35 UTC (permalink / raw)
  To: u-boot

On 3/25/20 2:27 PM, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> We need to align the cache buffer to ARCH_DMA_MINALIGN in order to avoid
> access errors like
> 
> CACHE: Misaligned operation at range [be0231e0, be0235e0]
> 
> seen on the MCIMX7SABRE.
> 
> Fixes: d5aee659f217 ("fs: ext4: cache extent data")
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

Reviewed-by: Stephen Warren <swarren@nvidia.com>

It's probably just a fluke that this happens to show up on some
SoCs/boards/configurations but not others. Or perhaps the MINALIGN value
differs?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fs: ext4: Fix alignment of cache buffers
  2020-03-25 20:27 [PATCH] fs: ext4: Fix alignment of cache buffers Jan Kiszka
  2020-03-25 20:31 ` Tom Rini
  2020-03-25 20:35 ` Stephen Warren
@ 2020-03-26 11:38 ` Peter Robinson
  2020-03-27 21:55 ` Tom Rini
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Robinson @ 2020-03-26 11:38 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 25, 2020 at 8:28 PM Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> We need to align the cache buffer to ARCH_DMA_MINALIGN in order to avoid
> access errors like
>
> CACHE: Misaligned operation at range [be0231e0, be0235e0]
>
> seen on the MCIMX7SABRE.

I've also seen this on some i.MX6 devices such as Wandboard,
Hummingboard Edge and the UDOO Neo. Tested on the later two, thanks
for this fix.

Tested-by: Peter Robinson <pbrobinson@gmail.com>

> Fixes: d5aee659f217 ("fs: ext4: cache extent data")
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  fs/ext4/ext4fs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
> index 1c616a26a2..966b427a97 100644
> --- a/fs/ext4/ext4fs.c
> +++ b/fs/ext4/ext4fs.c
> @@ -288,7 +288,7 @@ int ext_cache_read(struct ext_block_cache *cache, lbaint_t block, int size)
>         if (cache->buf && cache->block == block && cache->size == size)
>                 return 1;
>         ext_cache_fini(cache);
> -       cache->buf = malloc(size);
> +       cache->buf = memalign(ARCH_DMA_MINALIGN, size);
>         if (!cache->buf)
>                 return 0;
>         if (!ext4fs_devread(block, 0, size, cache->buf)) {
> --
> 2.16.4
>
>
> --
> Siemens AG, Corporate Technology, CT RDA IOT SES-DE
> Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fs: ext4: Fix alignment of cache buffers
  2020-03-25 20:27 [PATCH] fs: ext4: Fix alignment of cache buffers Jan Kiszka
                   ` (2 preceding siblings ...)
  2020-03-26 11:38 ` Peter Robinson
@ 2020-03-27 21:55 ` Tom Rini
  3 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2020-03-27 21:55 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 25, 2020 at 09:27:51PM +0100, Jan Kiszka wrote:

> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> We need to align the cache buffer to ARCH_DMA_MINALIGN in order to avoid
> access errors like
> 
> CACHE: Misaligned operation at range [be0231e0, be0235e0]
> 
> seen on the MCIMX7SABRE.
> 
> Fixes: d5aee659f217 ("fs: ext4: cache extent data")
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Reviewed-by: Stephen Warren <swarren@nvidia.com>
> Tested-by: Peter Robinson <pbrobinson@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200327/211d77b4/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-27 21:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 20:27 [PATCH] fs: ext4: Fix alignment of cache buffers Jan Kiszka
2020-03-25 20:31 ` Tom Rini
2020-03-25 20:35 ` Stephen Warren
2020-03-26 11:38 ` Peter Robinson
2020-03-27 21:55 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.