fs: ext4: Fix alignment of cache buffers
PATCH 1/1 fs: ext4: Fix alignment of cache buffers
From: Jan Kiszka <[email protected]>
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.
--- fs/ext4/ext4fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ext4fs.c +1 -1
@@ -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)) {
Signature · 6 lines
2.16.4 -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
PATCH 1/1 fs: ext4: Fix alignment of cache buffers
Quoted 20 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
We need to align the cache buffer to
ARCH_DMA_MINALIGNin order to avoid access errors likeCACHE: Misaligned operation at range [
be0231e0,be0235e0]seen on the MCIMX7SABRE.
Fixes d5aee659f217 ("fs: ext4: cache extent data")Signed-off-by Jan Kiszka <[email protected]>--- fs/ext4/ext4fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ext4/ext4fs.c +0
-0
fs/ext4/ext4fs.c int ext_cache_read(struct ext_block_cache *cache, lbaint_t block, int size) · line 294
Quoted 8 lines
fs/ext4/ext4fs.c +1
-1@@ -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.
Signature · 8 lines
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>
PATCH 1/1 fs: ext4: Fix alignment of cache buffers
In reply to Jan KiszkaQuoted 11 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
We need to align the cache buffer to
ARCH_DMA_MINALIGNin order to avoid access errors likeCACHE: Misaligned operation at range [
be0231e0,be0235e0]seen on the MCIMX7SABRE.
Fixes d5aee659f217 ("fs: ext4: cache extent data")Signed-off-by Jan Kiszka <[email protected]>
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?
PATCH 1/1 fs: ext4: Fix alignment of cache buffers
In reply to Jan KiszkaQuoted 9 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
We need to align the cache buffer to
ARCH_DMA_MINALIGNin order to avoid access errors likeCACHE: 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.
Quoted 26 lines
Fixes d5aee659f217 ("fs: ext4: cache extent data")Signed-off-by Jan Kiszka <[email protected]>--- fs/ext4/ext4fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ext4/ext4fs.c +1
-2@@ -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
PATCH 1/1 fs: ext4: Fix alignment of cache buffers
In reply to Jan KiszkaQuoted 7 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
We need to align the cache buffer to
ARCH_DMA_MINALIGNin order to avoid access errors likeCACHE: Misaligned operation at range [
be0231e0,be0235e0]
Quoted 7 lines
seen on the MCIMX7SABRE.
Fixes d5aee659f217 ("fs: ext4: cache extent data")Signed-off-by Jan Kiszka <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Stephen Warren <[email protected]>Tested-by Peter Robinson <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>