mips requires alignment for ext2_*_bit functions
We see immediate alignment failures using reiserfs on mips systems.
The problems go away with the following patch.
-Dale Farnsworth
Index: linux/include/linux/reiserfs_fs.h
===================================================================
RCS file: /cvsdev/hhl-2.4.17/linux/include/linux/reiserfs_fs.h,v retrieving revision 1.3
include/linux/reiserfs_fs.h +1 -1
@@ -847,7 +847,7 @@#define DEH_Visible 2/* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ -#if BITS_PER_LONG ==64 || defined(__s390__) || defined(__hppa__) +#if BITS_PER_LONG ==64 || defined(__s390__) || defined(__hppa__) || defined(__mips__)# define ADDR_UNALIGNED_BITS (3)#endif
Hello!
Quoted 2 lines · Dale Farnsworth
We see immediate alignment failures using reiserfs on mips systems. The problems go away with the following patch.
Thank you for the report.
The question is should all MIPS processors be threated this way or is there are smaller subset that suffers from this problems
(and I believe kernel should allow unaligned accesses from inside of the kernel itself (by emulating perhaps). That's what I learned from lkml recently)
include/linux/reiserfs_fs.h line 850
Quoted 2 lines
include/linux/reiserfs_fs.h +1
-1-#if BITS_PER_LONG ==64 || defined(__s390__) || defined(__hppa__) +#if BITS_PER_LONG ==64 || defined(__s390__) || defined(__hppa__) || defined(__mips__)
Bye,
Oleg
Quoted 14 lines · Oleg Drokin
Hello!
Quoted 2 lines · Dale Farnsworth
We see immediate alignment failures using reiserfs on mips systems. The problems go away with the following patch.
Thank you for the report.
The question is should all MIPS processors be threated this way or is there are smaller subset that suffers from this problems
(and I believe kernel should allow unaligned accesses from inside of the kernel itself (by emulating perhaps). That's what I learned from lkml recently)
Quoted 5 lines
include/linux/reiserfs_fs.h line 850
Quoted 2 lines
include/linux/reiserfs_fs.h +1
-1-#if BITS_PER_LONG ==64 || defined(__s390__) || defined(__hppa__) +#if BITS_PER_LONG ==64 || defined(__s390__) || defined(__hppa__) || defined(__mips__)Bye,
Oleg
Hi Oleg,
Indeed, if unaligned accesses were supported for all accesses across all archectures, we wouldn't need this #if at all.
Reiserfs uses ext2_set_bit()*. There is no requirement for this operation to be atomic. However, some architectures, including s390 and little-endian mips, implement it by calling test_and_set_bit(), which is atomic. On little-endian mips, test_and_set_bit() uses the ll and sc instructions which have alignment requirements and there is no way to efficiently emulate unaligned versions.
* Similarly for ext2_clear_bit(), and ext2_test_bit().
While it may be better in the long run to modify the ext2_*_bit() functions, adding __mips__ to the current list is expedient and consistent with the BITS_PER_LONG==64, __s390__, and __hppa__ cases.
-Dale