linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* MPC5200b jffs2 memcpy alignment problem
@ 2012-06-30 19:16 Stephan Gatzka
  2012-06-30 20:09 ` Albrecht Dreß
  0 siblings, 1 reply; 6+ messages in thread
From: Stephan Gatzka @ 2012-06-30 19:16 UTC (permalink / raw)
  To: linux-mtd, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]

Hello!

First of all, please apologize my cross posting.

I have a problem running jffs2 on an MPC5200b board. I run kernel 3.4, 
but older kernels like 3.1.5 are also affected. Every time I mount 
jffs2, previously written content gets garbled.

The problem was nailed down to memcpy(&fd->name, rd->name, checkedlen); 
in jffs2_scan_dirent_node in fs/jffs2/scan.c.

This is a copy directly from the mapped flash.

memcpy from copy_32.S only ensures that the 32 bit stores to the 
destination ptr are aligned. And that's the problem with the MPC5200b 
because the user manual (Chapter 9.2, LocalPlus bus features) clearly 
states that unaligned access is not supported. But the code above 
results in unaligned loads from the LocalPlus bus.

I think there are two possible solutions:

1. Rewrite memcpy this way: Only if both src and dst are 32 bit aligned, 
use 32 bit load/store to copy, otherwise use byte load/store 
instructions. (btw. is there a reason for not to use the load multiple 
and store multiple instructions in memcpy?) This might be the best way 
to do because in my opinion the semantics of memcpy put no restrictions 
on the alignment of src and dst.

2. use memcpy_fromio in the jffs2 code. memcpy_fromio behaves exactly in 
the way I described above. This could be also a good solution because 
flash access via LocalPlus bus is clearly IO.

What is your opinion where to fix this problem?

Regards,

Stephan


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4931 bytes --]

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

end of thread, other threads:[~2012-07-02 16:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-30 19:16 MPC5200b jffs2 memcpy alignment problem Stephan Gatzka
2012-06-30 20:09 ` Albrecht Dreß
2012-07-01  6:47   ` Stephan Gatzka
2012-07-01 13:50     ` William F.
2012-07-02 10:21     ` Anatolij Gustschin
2012-07-02 16:41       ` Stephan Gatzka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).