Fix issues with ARMv6+v6k+v7 kernels
Subsystems (7)
cover Fix issues with ARMv6+v6k+v7 kernels
This patch series reworks the ARMv6/ARMv6K support options, code selection, and bit operations such that it's possible to safely build a kernel which supports ARMv6, ARMv6K, ARMv7 and ARMv7 SMP in one image.
Currently, we use CPU_V6 for both ARMv6 and ARMv6K, setting CPU_32v6K if we have the K extensions. CPU_32v6K directly controlled whether we should include the ARMv6K instructions (clrex, load/store exclusive byte, half-word, double). As the bitops code uses the load/store exclusive byte operations, unsetting CPU_32v6K results in these falling back to their non-SMP local-irq-disabling variants. These are only safe in uniprocessor environments.
So, the first two patches convert the bitops to use the ARMv6 load/store exclusive word operations - and ensuring correctness by ensuring that the pointer passed in is word-aligned.
We then introduce a new CPU_V6K which indicates that we're including an ARMv6K CPU in the build, which frees up CPU_V6 to mean that we're including an ARMv6 non-K CPU.
We can then use CPU_V6 to ensure that the non-v6K code paths which are still SMP safe are selected.
Without this patch set, such a kernel will be unsafe when run on SMP platforms as it omits necessary SMP code to ensure that bit operations are safe.
PATCH 1/14 ARM: bitops: ensure set/clear/change bitops take a word-aligned pointer
Add additional instructions to our assembly bitops functions to ensure that they only operate on word-aligned pointers. This will be necessary when we switch these operations to use the word-based exclusive operations.
--- arch/arm/lib/bitops.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/lib/bitops.h +8 -0
@@ -1,6 +1,8 @@#if __LINUX_ARM_ARCH__ >=6 && defined(CONFIG_CPU_32v6K) .macro bitop, instr + tst r1, #3 + strne r1, [r1, -r1] @ assert word-aligned mov r2, #1 and r3, r0, #7 @ Get bit offset add r1, r1, r0, lsr #3 @ Get byte offset
@@ -14,6 +16,8 @@ .endm .macro testop, instr, store + tst r1, #3 + strne r1, [r1, -r1] @ assert word-aligned and r3, r0, #7 @ Get bit offset mov r2, #1 add r1, r1, r0, lsr #3 @ Get byte offset
@@ -32,6 +36,8 @@ .endm #else .macro bitop, instr + tst r1, #3 + strne r1, [r1, -r1] @ assert word-aligned and r2, r0, #7 mov r3, #1 mov r3, r3, lsl r2
@@ -52,6 +58,8 @@* to avoid dirtying the data cache. */ .macro testop, instr, store + tst r1, #3 + strne r1, [r1, -r1] @ assert word-aligned add r1, r1, r0, lsr #3 and r3, r0, #7 mov r0, #1
Signature · 1 line
1.6.2.5
PATCH 1/14 ARM: bitops: ensure set/clear/change bitops take a word-aligned pointer
Quoted 6 lines · Russell King - ARM Linux
Add additional instructions to our assembly bitops functions to ensure that they only operate on word-aligned pointers. This will be necessary when we switch these operations to use the word-based exclusive operations.
Signed-off-by Russell King <[email protected]>
This breaks the Thumb2 kernel build:
AS arch/arm/lib/changebit.oarch/arm/lib/changebit.S: Assembler messages:arch/arm/lib/changebit.S:16: Error: Thumb does not support negative register indexing -- `strne r1,[r1,-r1]'
I also wonder what happens with a misaligned ldrex/strex... Does the alignment trap get invoked? If so, the assertion could be put there instead if that's not done already, removing this overhead from bitops calls. In the pre-ARMv6 case the alignment trap fixup would be applied as usual since the ldr/str are not special, but the previous code allowed for misaligned pointer so result would be no worse than before in that case. Testing appears to indicate those misaligned bitops are rather nonexistent so far.
Quoted 53 lines
--- arch/arm/lib/bitops.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)arch/arm/lib/bitops.h +8
-0@@ -1,6 +1,8 @@#if __LINUX_ARM_ARCH__ >=6 && defined(CONFIG_CPU_32v6K) .macro bitop, instr + tst r1, #3 + strne r1, [r1, -r1] @ assert word-aligned mov r2, #1 and r3, r0, #7 @ Get bit offset add r1, r1, r0, lsr #3 @ Get byte offset@@ -14,6 +16,8 @@ .endm .macro testop, instr, store + tst r1, #3 + strne r1, [r1, -r1] @ assert word-aligned and r3, r0, #7 @ Get bit offset mov r2, #1 add r1, r1, r0, lsr #3 @ Get byte offset@@ -32,6 +36,8 @@ .endm #else .macro bitop, instr + tst r1, #3 + strne r1, [r1, -r1] @ assert word-aligned and r2, r0, #7 mov r3, #1 mov r3, r3, lsl r2@@ -52,6 +58,8 @@* to avoid dirtying the data cache. */ .macro testop, instr, store + tst r1, #3 + strne r1, [r1, -r1] @ assert word-aligned add r1, r1, r0, lsr #3 and r3, r0, #7 mov r0, #1Signature · 7 lines
1.6.2.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/14 ARM: bitops: ensure set/clear/change bitops take a word-aligned pointer
Quoted 8 lines · Nicolas Pitre
I also wonder what happens with a misaligned ldrex/strex... Does the alignment trap get invoked? If so, the assertion could be put there instead if that's not done already, removing this overhead from bitops calls. In the pre-ARMv6 case the alignment trap fixup would be applied as usual since the ldr/str are not special, but the previous code allowed for misaligned pointer so result would be no worse than before in that case. Testing appears to indicate those misaligned bitops are rather nonexistent so far.
Well, whether LDREX/STREX always fault for misalignment is well open to debate. The ARM ARM for ARMv7 seems to imply they will always fault for misaligned accesses. For ARMv6, the situation is less clear - the way the manual is arranged, it suggests that they will if SCTLR.U is set. When it's clear, the ARM ARM doesn't specify what the outcome is.
I also don't know how our unaligned fixup will behave with an unaligned LDREX/STREX without checking the bit patterns.
So... I think that's too many unknowns to rely on it, especially when filesystem data is at stake.
Maybe changing it to:
ands ip, r1, #3 strneb r1, [ip]
instead?
PATCH 1/14 ARM: bitops: ensure set/clear/change bitops take a word-aligned pointer
Quoted 10 lines · Russell King - ARM Linux
Quoted 8 lines · Nicolas Pitre
I also wonder what happens with a misaligned ldrex/strex... Does the alignment trap get invoked? If so, the assertion could be put there instead if that's not done already, removing this overhead from bitops calls. In the pre-ARMv6 case the alignment trap fixup would be applied as usual since the ldr/str are not special, but the previous code allowed for misaligned pointer so result would be no worse than before in that case. Testing appears to indicate those misaligned bitops are rather nonexistent so far.
Quoted 5 lines
Well, whether LDREX/STREX always fault for misalignment is well open to debate. The ARM ARM for ARMv7 seems to imply they will always fault for misaligned accesses. For ARMv6, the situation is less clear - the way the manual is arranged, it suggests that they will if SCTLR.U is set. When it's clear, the ARM ARM doesn't specify what the outcome is.
Probably we should make sure they always fault on both ARMv6 and ARMv7 regardless of this particular issue.
Quoted 2 lines
I also don't know how our unaligned fixup will behave with an unaligned LDREX/STREX without checking the bit patterns.
Making ldrex/strex always fault means that we also need to make the alignment fixup code produce a SIGBUS, or panic the kernel if in atomic context.
Quoted 9 lines
So... I think that's too many unknowns to rely on it, especially when filesystem data is at stake.
Maybe changing it to:
ands ip, r1, #3 strneb r1, [ip]instead?
Sure. That would solve the T2 issue. Eventually we could revisit the need for this assertion here once the above is done.
Nicolas
PATCH 1/14 ARM: bitops: ensure set/clear/change bitops take a word-aligned pointer
In reply to Nicolas PitreQuoted 9 lines · Nicolas Pitre
Quoted 6 lines · Russell King - ARM Linux
Add additional instructions to our assembly bitops functions to ensure that they only operate on word-aligned pointers. ?This will be necessary when we switch these operations to use the word-based exclusive operations.
Signed-off-by Russell King <[email protected]>
Quoted 8 lines
This breaks the Thumb2 kernel build:
?AS ? ? ?arch/arm/lib/changebit.o
arch/arm/lib/changebit.S: Assembler messages:arch/arm/lib/changebit.S:16: Error: Thumb does not support negative register indexing -- `strne r1,[r1,-r1]'I also wonder what happens with a misaligned ldrex/strex... Does the alignment trap get invoked?
According to the ARM ARM, unaligned ldrex/strex should generate an alignment fault on ARMv6 (with SCTLR.U bit set) and ARMv7.
Signature · 1 line
Catalin
PATCH 1/14 ARM: bitops: ensure set/clear/change bitops take a word-aligned pointer
In reply to Russell King - ARM LinuxQuoted 4 lines · Russell King - ARM Linux
Add additional instructions to our assembly bitops functions to ensure that they only operate on word-aligned pointers. This will be necessary when we switch these operations to use the word-based exclusive operations.
If it's still not too late, we've had this in the testing branch in the linux-omap tree for about a week now. So far no problems, for me file systems tested have been ext3 and nfs.
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
In reply to Russell King - ARM LinuxSwitch the set/clear/change bitops to use the word-based exclusive operations, which are only present in a wider range of ARM architectures than the byte-based exclusive operations.
--- arch/arm/include/asm/bitops.h | 60 +++++++++++++++-------------------------- arch/arm/kernel/armksyms.c | 18 ++++-------- arch/arm/lib/bitops.h | 38 +++++++++++++------------ arch/arm/lib/changebit.S | 10 +----- arch/arm/lib/clearbit.S | 11 +------ arch/arm/lib/setbit.S | 11 +------ arch/arm/lib/testchangebit.S | 9 ++---- arch/arm/lib/testclearbit.S | 9 ++---- arch/arm/lib/testsetbit.S | 9 ++---- 9 files changed, 63 insertions(+), 112 deletions(-)
arch/arm/include/asm/bitops.h +22 -38
@@ -149,14 +149,18 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)*/ /* +* Native endian assembly bitops. nr = 0 -> word 0 bit 0. +*/ +extern void _set_bit (int nr,volatile unsigned long * p); +extern void _clear_bit (int nr,volatile unsigned long * p); +extern void _change_bit (int nr,volatile unsigned long * p); +extern int _test_and_set_bit (int nr,volatile unsigned long * p); +extern int _test_and_clear_bit (int nr,volatile unsigned long * p); +extern int _test_and_change_bit (int nr,volatile unsigned long * p); + +/* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern void _set_bit_le (int nr,volatile unsigned long * p); -extern void _clear_bit_le (int nr,volatile unsigned long * p); -extern void _change_bit_le (int nr,volatile unsigned long * p); -extern int _test_and_set_bit_le (int nr,volatile unsigned long * p); -extern int _test_and_clear_bit_le (int nr,volatile unsigned long * p); -extern int _test_and_change_bit_le (int nr,volatile unsigned long * p);extern int _find_first_zero_bit_le (const void * p,unsigned size);extern int _find_next_zero_bit_le (const void * p,int size,int offset);extern int _find_first_bit_le (const unsigned long *p,unsigned size);
@@ -165,12 +169,6 @@ extern int _find_next_bit_le(const unsigned long *p, int size, int offset);/* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern void _set_bit_be (int nr,volatile unsigned long * p); -extern void _clear_bit_be (int nr,volatile unsigned long * p); -extern void _change_bit_be (int nr,volatile unsigned long * p); -extern int _test_and_set_bit_be (int nr,volatile unsigned long * p); -extern int _test_and_clear_bit_be (int nr,volatile unsigned long * p); -extern int _test_and_change_bit_be (int nr,volatile unsigned long * p);extern int _find_first_zero_bit_be (const void * p,unsigned size);extern int _find_next_zero_bit_be (const void * p,int size,int offset);extern int _find_first_bit_be (const unsigned long *p,unsigned size);
@@ -180,33 +178,26 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);/* * The __* form of bitops are non-atomic and may be reordered. */ -#define ATOMIC_BITOP_LE (name,nr,p) \ - (__builtin_constant_p(nr) ? \ - ____atomic_##name(nr, p) : \ - _##name##_le(nr,p)) - -#define ATOMIC_BITOP_BE (name,nr,p) \ - (__builtin_constant_p(nr) ? \ - ____atomic_##name(nr, p) : \ - _##name##_be(nr,p)) +#define ATOMIC_BITOP (name,nr,p) \ + (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))#else -#define ATOMIC_BITOP_LE (name,nr,p) _##name##_le(nr,p) -#define ATOMIC_BITOP_BE (name,nr,p) _##name##_be(nr,p) +#define ATOMIC_BITOP (name,nr,p) _##name(nr,p)#endif -#define NONATOMIC_BITOP (name,nr,p) \ - (____nonatomic_##name(nr, p)) +/* +* Native endian atomic definitions. +*/ +#define set_bit (nr,p) ATOMIC_BITOP(set_bit,nr,p) +#define clear_bit (nr,p) ATOMIC_BITOP(clear_bit,nr,p) +#define change_bit (nr,p) ATOMIC_BITOP(change_bit,nr,p) +#define test_and_set_bit (nr,p) ATOMIC_BITOP(test_and_set_bit,nr,p) +#define test_and_clear_bit (nr,p) ATOMIC_BITOP(test_and_clear_bit,nr,p) +#define test_and_change_bit (nr,p) ATOMIC_BITOP(test_and_change_bit,nr,p)#ifndef __ARMEB__/* * These are the little endian, atomic definitions. */ -#define set_bit (nr,p) ATOMIC_BITOP_LE(set_bit,nr,p) -#define clear_bit (nr,p) ATOMIC_BITOP_LE(clear_bit,nr,p) -#define change_bit (nr,p) ATOMIC_BITOP_LE(change_bit,nr,p) -#define test_and_set_bit (nr,p) ATOMIC_BITOP_LE(test_and_set_bit,nr,p) -#define test_and_clear_bit (nr,p) ATOMIC_BITOP_LE(test_and_clear_bit,nr,p) -#define test_and_change_bit (nr,p) ATOMIC_BITOP_LE(test_and_change_bit,nr,p)#define find_first_zero_bit (p,sz) _find_first_zero_bit_le(p,sz)#define find_next_zero_bit (p,sz,off) _find_next_zero_bit_le(p,sz,off)#define find_first_bit (p,sz) _find_first_bit_le(p,sz)
@@ -215,16 +206,9 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);#define WORD_BITOFF_TO_LE (x) ((x))#else -/* * These are the big endian, atomic definitions. */ -#define set_bit (nr,p) ATOMIC_BITOP_BE(set_bit,nr,p) -#define clear_bit (nr,p) ATOMIC_BITOP_BE(clear_bit,nr,p) -#define change_bit (nr,p) ATOMIC_BITOP_BE(change_bit,nr,p) -#define test_and_set_bit (nr,p) ATOMIC_BITOP_BE(test_and_set_bit,nr,p) -#define test_and_clear_bit (nr,p) ATOMIC_BITOP_BE(test_and_clear_bit,nr,p) -#define test_and_change_bit (nr,p) ATOMIC_BITOP_BE(test_and_change_bit,nr,p)#define find_first_zero_bit (p,sz) _find_first_zero_bit_be(p,sz)#define find_next_zero_bit (p,sz,off) _find_next_zero_bit_be(p,sz,off)#define find_first_bit (p,sz) _find_first_bit_be(p,sz)
arch/arm/kernel/armksyms.c +6 -12
@@ -140,24 +140,18 @@ EXPORT_SYMBOL(__aeabi_ulcmp);#endif /* bitops */ -EXPORT_SYMBOL (_set_bit_le); -EXPORT_SYMBOL (_test_and_set_bit_le); -EXPORT_SYMBOL (_clear_bit_le); -EXPORT_SYMBOL (_test_and_clear_bit_le); -EXPORT_SYMBOL (_change_bit_le); -EXPORT_SYMBOL (_test_and_change_bit_le); +EXPORT_SYMBOL (_set_bit); +EXPORT_SYMBOL (_test_and_set_bit); +EXPORT_SYMBOL (_clear_bit); +EXPORT_SYMBOL (_test_and_clear_bit); +EXPORT_SYMBOL (_change_bit); +EXPORT_SYMBOL (_test_and_change_bit);EXPORT_SYMBOL (_find_first_zero_bit_le);EXPORT_SYMBOL (_find_next_zero_bit_le);EXPORT_SYMBOL (_find_first_bit_le);EXPORT_SYMBOL (_find_next_bit_le);#ifdef __ARMEB__ -EXPORT_SYMBOL (_set_bit_be); -EXPORT_SYMBOL (_test_and_set_bit_be); -EXPORT_SYMBOL (_clear_bit_be); -EXPORT_SYMBOL (_test_and_clear_bit_be); -EXPORT_SYMBOL (_change_bit_be); -EXPORT_SYMBOL (_test_and_change_bit_be);EXPORT_SYMBOL (_find_first_zero_bit_be);EXPORT_SYMBOL (_find_next_zero_bit_be);EXPORT_SYMBOL (_find_first_bit_be);
arch/arm/lib/bitops.h +20 -18
@@ -1,15 +1,15 @@ - -#if __LINUX_ARM_ARCH__ >=6 && defined(CONFIG_CPU_32v6K) +#if __LINUX_ARM_ARCH__ >=6 .macro bitop, instr tst r1, #3 strne r1, [r1, -r1] @ assert word-aligned mov r2, #1 - and r3, r0, #7 @ Get bit offset - add r1, r1, r0, lsr #3 @ Get byte offset + and r3, r0, #31 @ Get bit offset + mov r0, r0, lsr #5 + add r1, r1, r0, lsl #2 @ Get word offset mov r3, r2, lsl r3 -1: ldrexb r2, [r1] +1: ldrex r2, [r1] \instr r2, r2, r3 - strexb r0, r2, [r1] + strex r0, r2, [r1] cmp r0, #0 bne 1b mov pc, lr
@@ -18,15 +18,16 @@ .macro testop, instr, store tst r1, #3 strne r1, [r1, -r1] @ assert word-aligned - and r3, r0, #7 @ Get bit offset mov r2, #1 - add r1, r1, r0, lsr #3 @ Get byte offset + and r3, r0, #31 @ Get bit offset + mov r0, r0, lsr #5 + add r1, r1, r0, lsl #2 @ Get word offset mov r3, r2, lsl r3 @ create mask smp_dmb -1: ldrexb r2, [r1] +1: ldrex r2, [r1] ands r0, r2, r3 @ save old value of bit - \instr r2, r2, r3 @ toggle bit - strexb ip, r2, [r1] + \instr r2, r2, r3 @ toggle bit + strex ip, r2, [r1] cmp ip, #0 bne 1b smp_dmb
@@ -38,13 +39,14 @@ .macro bitop, instr tst r1, #3 strne r1, [r1, -r1] @ assert word-aligned - and r2, r0, #7 + and r2, r0, #31 + mov r0, r0, lsr #5 mov r3, #1 mov r3, r3, lsl r2 save_and_disable_irqs ip - ldrb r2, [r1, r0, lsr #3] + ldr r2, [r1, r0, lsl #2] \instr r2, r2, r3 - strb r2, [r1, r0, lsr #3] + str r2, [r1, r0, lsl #2] restore_irqs ip mov pc, lr .endm
@@ -60,11 +62,11 @@ .macro testop, instr, store tst r1, #3 strne r1, [r1, -r1] @ assert word-aligned - add r1, r1, r0, lsr #3 - and r3, r0, #7 - mov r0, #1 + and r3, r0, #31 + mov r0, r0, lsr #5 save_and_disable_irqs ip - ldrb r2, [r1] + ldr r2, [r1, r0, lsl #2]! + mov r0, #1 tst r2, r0, lsl r3 \instr r2, r2, r0, lsl r3 \store r2, [r1]
arch/arm/lib/changebit.S +2 -8
@@ -12,12 +12,6 @@ #include "bitops.h" .text -/* Purpose : Function to change a bit - * Prototype: int change_bit(int bit, void *addr) - */ -ENTRY(_change_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_change_bit_le) +ENTRY(_change_bit) bitop eor -ENDPROC(_change_bit_be) -ENDPROC(_change_bit_le) +ENDPROC(_change_bit)
arch/arm/lib/clearbit.S +2 -9
@@ -12,13 +12,6 @@ #include "bitops.h" .text -/* - * Purpose : Function to clear a bit - * Prototype: int clear_bit(int bit, void *addr) - */ -ENTRY(_clear_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_clear_bit_le) +ENTRY(_clear_bit) bitop bic -ENDPROC(_clear_bit_be) -ENDPROC(_clear_bit_le) +ENDPROC(_clear_bit)
arch/arm/lib/setbit.S +2 -9
@@ -12,13 +12,6 @@ #include "bitops.h" .text -/* - * Purpose : Function to set a bit - * Prototype: int set_bit(int bit, void *addr) - */ -ENTRY(_set_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_set_bit_le) +ENTRY(_set_bit) bitop orr -ENDPROC(_set_bit_be) -ENDPROC(_set_bit_le) +ENDPROC(_set_bit)
arch/arm/lib/testchangebit.S +3 -6
@@ -12,9 +12,6 @@ #include "bitops.h" .text -ENTRY(_test_and_change_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_test_and_change_bit_le) - testop eor, strb -ENDPROC(_test_and_change_bit_be) -ENDPROC(_test_and_change_bit_le) +ENTRY(_test_and_change_bit) + testop eor, str +ENDPROC(_test_and_change_bit)
arch/arm/lib/testclearbit.S +3 -6
@@ -12,9 +12,6 @@ #include "bitops.h" .text -ENTRY(_test_and_clear_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_test_and_clear_bit_le) - testop bicne, strneb -ENDPROC(_test_and_clear_bit_be) -ENDPROC(_test_and_clear_bit_le) +ENTRY(_test_and_clear_bit) + testop bicne, strne +ENDPROC(_test_and_clear_bit)
arch/arm/lib/testsetbit.S +3 -6
@@ -12,9 +12,6 @@ #include "bitops.h" .text -ENTRY(_test_and_set_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_test_and_set_bit_le) - testop orreq, streqb -ENDPROC(_test_and_set_bit_be) -ENDPROC(_test_and_set_bit_le) +ENTRY(_test_and_set_bit) + testop orreq, streq +ENDPROC(_test_and_set_bit)
Signature · 1 line
1.6.2.5
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 5 lines · Russell King - ARM Linux
Switch the set/clear/change bitops to use the word-based exclusive operations, which are only present in a wider range of ARM architectures than the byte-based exclusive operations.
Signed-off-by Russell King <[email protected]>
Also heavily tested on an ext3 fs read-write, using a LE host.
Quoted 353 lines
--- arch/arm/include/asm/bitops.h | 60 +++++++++++++++-------------------------- arch/arm/kernel/armksyms.c | 18 ++++-------- arch/arm/lib/bitops.h | 38 +++++++++++++------------ arch/arm/lib/changebit.S | 10 +----- arch/arm/lib/clearbit.S | 11 +------ arch/arm/lib/setbit.S | 11 +------ arch/arm/lib/testchangebit.S | 9 ++---- arch/arm/lib/testclearbit.S | 9 ++---- arch/arm/lib/testsetbit.S | 9 ++---- 9 files changed, 63 insertions(+), 112 deletions(-)arch/arm/include/asm/bitops.h +22
-38@@ -149,14 +149,18 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)*/ /* +* Native endian assembly bitops. nr = 0 -> word 0 bit 0. +*/ +extern void _set_bit (int nr,volatile unsigned long * p); +extern void _clear_bit (int nr,volatile unsigned long * p); +extern void _change_bit (int nr,volatile unsigned long * p); +extern int _test_and_set_bit (int nr,volatile unsigned long * p); +extern int _test_and_clear_bit (int nr,volatile unsigned long * p); +extern int _test_and_change_bit (int nr,volatile unsigned long * p); + +/* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern void _set_bit_le (int nr,volatile unsigned long * p); -extern void _clear_bit_le (int nr,volatile unsigned long * p); -extern void _change_bit_le (int nr,volatile unsigned long * p); -extern int _test_and_set_bit_le (int nr,volatile unsigned long * p); -extern int _test_and_clear_bit_le (int nr,volatile unsigned long * p); -extern int _test_and_change_bit_le (int nr,volatile unsigned long * p);extern int _find_first_zero_bit_le (const void * p,unsigned size);extern int _find_next_zero_bit_le (const void * p,int size,int offset);extern int _find_first_bit_le (const unsigned long *p,unsigned size);@@ -165,12 +169,6 @@ extern int _find_next_bit_le(const unsigned long *p, int size, int offset);/* * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. */ -extern void _set_bit_be (int nr,volatile unsigned long * p); -extern void _clear_bit_be (int nr,volatile unsigned long * p); -extern void _change_bit_be (int nr,volatile unsigned long * p); -extern int _test_and_set_bit_be (int nr,volatile unsigned long * p); -extern int _test_and_clear_bit_be (int nr,volatile unsigned long * p); -extern int _test_and_change_bit_be (int nr,volatile unsigned long * p);extern int _find_first_zero_bit_be (const void * p,unsigned size);extern int _find_next_zero_bit_be (const void * p,int size,int offset);extern int _find_first_bit_be (const unsigned long *p,unsigned size);@@ -180,33 +178,26 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);/* * The __* form of bitops are non-atomic and may be reordered. */ -#define ATOMIC_BITOP_LE (name,nr,p) \ - (__builtin_constant_p(nr) ? \ - ____atomic_##name(nr, p) : \ - _##name##_le(nr,p)) - -#define ATOMIC_BITOP_BE (name,nr,p) \ - (__builtin_constant_p(nr) ? \ - ____atomic_##name(nr, p) : \ - _##name##_be(nr,p)) +#define ATOMIC_BITOP (name,nr,p) \ + (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))#else -#define ATOMIC_BITOP_LE (name,nr,p) _##name##_le(nr,p) -#define ATOMIC_BITOP_BE (name,nr,p) _##name##_be(nr,p) +#define ATOMIC_BITOP (name,nr,p) _##name(nr,p)#endif -#define NONATOMIC_BITOP (name,nr,p) \ - (____nonatomic_##name(nr, p)) +/* +* Native endian atomic definitions. +*/ +#define set_bit (nr,p) ATOMIC_BITOP(set_bit,nr,p) +#define clear_bit (nr,p) ATOMIC_BITOP(clear_bit,nr,p) +#define change_bit (nr,p) ATOMIC_BITOP(change_bit,nr,p) +#define test_and_set_bit (nr,p) ATOMIC_BITOP(test_and_set_bit,nr,p) +#define test_and_clear_bit (nr,p) ATOMIC_BITOP(test_and_clear_bit,nr,p) +#define test_and_change_bit (nr,p) ATOMIC_BITOP(test_and_change_bit,nr,p)#ifndef __ARMEB__/* * These are the little endian, atomic definitions. */ -#define set_bit (nr,p) ATOMIC_BITOP_LE(set_bit,nr,p) -#define clear_bit (nr,p) ATOMIC_BITOP_LE(clear_bit,nr,p) -#define change_bit (nr,p) ATOMIC_BITOP_LE(change_bit,nr,p) -#define test_and_set_bit (nr,p) ATOMIC_BITOP_LE(test_and_set_bit,nr,p) -#define test_and_clear_bit (nr,p) ATOMIC_BITOP_LE(test_and_clear_bit,nr,p) -#define test_and_change_bit (nr,p) ATOMIC_BITOP_LE(test_and_change_bit,nr,p)#define find_first_zero_bit (p,sz) _find_first_zero_bit_le(p,sz)#define find_next_zero_bit (p,sz,off) _find_next_zero_bit_le(p,sz,off)#define find_first_bit (p,sz) _find_first_bit_le(p,sz)@@ -215,16 +206,9 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);#define WORD_BITOFF_TO_LE (x) ((x))#else -/* * These are the big endian, atomic definitions. */ -#define set_bit (nr,p) ATOMIC_BITOP_BE(set_bit,nr,p) -#define clear_bit (nr,p) ATOMIC_BITOP_BE(clear_bit,nr,p) -#define change_bit (nr,p) ATOMIC_BITOP_BE(change_bit,nr,p) -#define test_and_set_bit (nr,p) ATOMIC_BITOP_BE(test_and_set_bit,nr,p) -#define test_and_clear_bit (nr,p) ATOMIC_BITOP_BE(test_and_clear_bit,nr,p) -#define test_and_change_bit (nr,p) ATOMIC_BITOP_BE(test_and_change_bit,nr,p)#define find_first_zero_bit (p,sz) _find_first_zero_bit_be(p,sz)#define find_next_zero_bit (p,sz,off) _find_next_zero_bit_be(p,sz,off)#define find_first_bit (p,sz) _find_first_bit_be(p,sz)arch/arm/kernel/armksyms.c +6
-12@@ -140,24 +140,18 @@ EXPORT_SYMBOL(__aeabi_ulcmp);#endif /* bitops */ -EXPORT_SYMBOL (_set_bit_le); -EXPORT_SYMBOL (_test_and_set_bit_le); -EXPORT_SYMBOL (_clear_bit_le); -EXPORT_SYMBOL (_test_and_clear_bit_le); -EXPORT_SYMBOL (_change_bit_le); -EXPORT_SYMBOL (_test_and_change_bit_le); +EXPORT_SYMBOL (_set_bit); +EXPORT_SYMBOL (_test_and_set_bit); +EXPORT_SYMBOL (_clear_bit); +EXPORT_SYMBOL (_test_and_clear_bit); +EXPORT_SYMBOL (_change_bit); +EXPORT_SYMBOL (_test_and_change_bit);EXPORT_SYMBOL (_find_first_zero_bit_le);EXPORT_SYMBOL (_find_next_zero_bit_le);EXPORT_SYMBOL (_find_first_bit_le);EXPORT_SYMBOL (_find_next_bit_le);#ifdef __ARMEB__ -EXPORT_SYMBOL (_set_bit_be); -EXPORT_SYMBOL (_test_and_set_bit_be); -EXPORT_SYMBOL (_clear_bit_be); -EXPORT_SYMBOL (_test_and_clear_bit_be); -EXPORT_SYMBOL (_change_bit_be); -EXPORT_SYMBOL (_test_and_change_bit_be);EXPORT_SYMBOL (_find_first_zero_bit_be);EXPORT_SYMBOL (_find_next_zero_bit_be);EXPORT_SYMBOL (_find_first_bit_be);arch/arm/lib/bitops.h +20
-18@@ -1,15 +1,15 @@ - -#if __LINUX_ARM_ARCH__ >=6 && defined(CONFIG_CPU_32v6K) +#if __LINUX_ARM_ARCH__ >=6 .macro bitop, instr tst r1, #3 strne r1, [r1, -r1] @ assert word-aligned mov r2, #1 - and r3, r0, #7 @ Get bit offset - add r1, r1, r0, lsr #3 @ Get byte offset + and r3, r0, #31 @ Get bit offset + mov r0, r0, lsr #5 + add r1, r1, r0, lsl #2 @ Get word offset mov r3, r2, lsl r3 -1: ldrexb r2, [r1] +1: ldrex r2, [r1] \instr r2, r2, r3 - strexb r0, r2, [r1] + strex r0, r2, [r1] cmp r0, #0 bne 1b mov pc, lr@@ -18,15 +18,16 @@ .macro testop, instr, store tst r1, #3 strne r1, [r1, -r1] @ assert word-aligned - and r3, r0, #7 @ Get bit offset mov r2, #1 - add r1, r1, r0, lsr #3 @ Get byte offset + and r3, r0, #31 @ Get bit offset + mov r0, r0, lsr #5 + add r1, r1, r0, lsl #2 @ Get word offset mov r3, r2, lsl r3 @ create mask smp_dmb -1: ldrexb r2, [r1] +1: ldrex r2, [r1] ands r0, r2, r3 @ save old value of bit - \instr r2, r2, r3 @ toggle bit - strexb ip, r2, [r1] + \instr r2, r2, r3 @ toggle bit + strex ip, r2, [r1] cmp ip, #0 bne 1b smp_dmb@@ -38,13 +39,14 @@ .macro bitop, instr tst r1, #3 strne r1, [r1, -r1] @ assert word-aligned - and r2, r0, #7 + and r2, r0, #31 + mov r0, r0, lsr #5 mov r3, #1 mov r3, r3, lsl r2 save_and_disable_irqs ip - ldrb r2, [r1, r0, lsr #3] + ldr r2, [r1, r0, lsl #2] \instr r2, r2, r3 - strb r2, [r1, r0, lsr #3] + str r2, [r1, r0, lsl #2] restore_irqs ip mov pc, lr .endm@@ -60,11 +62,11 @@ .macro testop, instr, store tst r1, #3 strne r1, [r1, -r1] @ assert word-aligned - add r1, r1, r0, lsr #3 - and r3, r0, #7 - mov r0, #1 + and r3, r0, #31 + mov r0, r0, lsr #5 save_and_disable_irqs ip - ldrb r2, [r1] + ldr r2, [r1, r0, lsl #2]! + mov r0, #1 tst r2, r0, lsl r3 \instr r2, r2, r0, lsl r3 \store r2, [r1]arch/arm/lib/changebit.S +2
-8@@ -12,12 +12,6 @@ #include "bitops.h" .text -/* Purpose : Function to change a bit - * Prototype: int change_bit(int bit, void *addr) - */ -ENTRY(_change_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_change_bit_le) +ENTRY(_change_bit) bitop eor -ENDPROC(_change_bit_be) -ENDPROC(_change_bit_le) +ENDPROC(_change_bit)arch/arm/lib/clearbit.S +2
-9@@ -12,13 +12,6 @@ #include "bitops.h" .text -/* - * Purpose : Function to clear a bit - * Prototype: int clear_bit(int bit, void *addr) - */ -ENTRY(_clear_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_clear_bit_le) +ENTRY(_clear_bit) bitop bic -ENDPROC(_clear_bit_be) -ENDPROC(_clear_bit_le) +ENDPROC(_clear_bit)arch/arm/lib/setbit.S +2
-9@@ -12,13 +12,6 @@ #include "bitops.h" .text -/* - * Purpose : Function to set a bit - * Prototype: int set_bit(int bit, void *addr) - */ -ENTRY(_set_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_set_bit_le) +ENTRY(_set_bit) bitop orr -ENDPROC(_set_bit_be) -ENDPROC(_set_bit_le) +ENDPROC(_set_bit)arch/arm/lib/testchangebit.S +3
-6@@ -12,9 +12,6 @@ #include "bitops.h" .text -ENTRY(_test_and_change_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_test_and_change_bit_le) - testop eor, strb -ENDPROC(_test_and_change_bit_be) -ENDPROC(_test_and_change_bit_le) +ENTRY(_test_and_change_bit) + testop eor, str +ENDPROC(_test_and_change_bit)arch/arm/lib/testclearbit.S +3
-6@@ -12,9 +12,6 @@ #include "bitops.h" .text -ENTRY(_test_and_clear_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_test_and_clear_bit_le) - testop bicne, strneb -ENDPROC(_test_and_clear_bit_be) -ENDPROC(_test_and_clear_bit_le) +ENTRY(_test_and_clear_bit) + testop bicne, strne +ENDPROC(_test_and_clear_bit)arch/arm/lib/testsetbit.S +3
-6@@ -12,9 +12,6 @@ #include "bitops.h" .text -ENTRY(_test_and_set_bit_be) - eor r0, r0, #0x18 @ big endian byte ordering -ENTRY(_test_and_set_bit_le) - testop orreq, streqb -ENDPROC(_test_and_set_bit_be) -ENDPROC(_test_and_set_bit_le) +ENTRY(_test_and_set_bit) + testop orreq, streq +ENDPROC(_test_and_set_bit)Signature · 7 lines
1.6.2.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
In reply to Russell King - ARM LinuxQuoted 5 lines · Russell King - ARM Linux
Switch the set/clear/change bitops to use the word-based exclusive operations, which are only present in a wider range of ARM architectures than the byte-based exclusive operations.
Signed-off-by Russell King <[email protected]>
As only one person replied to this patch with test information, I'm not happy to push this into -rc, and hence that prevents it going into -stable too. That means omap2plus_defconfig .38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.
Therefore, I see no alternative at the moment but to purposely cause builds which cover ARMv6, and ARMv6K or ARMv7 CPUs to save people from data corruption.
Please get your tested-by's to me for at least the first three patches of this series ASAP.
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 10 lines · Russell King - ARM Linux
Quoted 5 lines · Russell King - ARM Linux
Switch the set/clear/change bitops to use the word-based exclusive operations, which are only present in a wider range of ARM architectures than the byte-based exclusive operations.
Signed-off-by Russell King <[email protected]>As only one person replied to this patch with test information, I'm not happy to push this into -rc, and hence that prevents it going into -stable too.
At least another person did post results:
http://mid.gmane.org/20110117094602.GA2622 at pulham.picochip.com
http://mid.gmane.org/20110117110308.GC2622 at pulham.picochip.com
Quoted 3 lines
That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.
I must admit that this series looks a bit large for stable IMHO. I think that the fix for stable should limit itself only to prevent SMP from being selected if anything else than CPU_32v6K is selected.
This looks perfectly reasonable for 2.6.38-rc to me though.
Nicolas
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 4 lines · Nicolas Pitre
At least another person did post results:
http://mid.gmane.org/20110117094602.GA2622 at pulham.picochip.com
http://mid.gmane.org/20110117110308.GC2622 at pulham.picochip.com
Slightly different patch - there were three revisions. I can't attach a tested-by given to a different patch to this one.
Quoted 7 lines
Quoted 3 lines
That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.I must admit that this series looks a bit large for stable IMHO. I think that the fix for stable should limit itself only to prevent SMP from being selected if anything else than
CPU_32v6Kis selected.
The first three are the bare minimum required for -stable.
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 13 lines · Russell King - ARM Linux
Quoted 4 lines · Nicolas Pitre
At least another person did post results:
http://mid.gmane.org/20110117094602.GA2622 at pulham.picochip.com
http://mid.gmane.org/20110117110308.GC2622 at pulham.picochip.comSlightly different patch - there were three revisions. ?I can't attach a tested-by given to a different patch to this one.
Quoted 4 lines
Quoted 3 lines
That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.
Quoted 6 lines
Quoted 3 lines
I must admit that this series looks a bit large for stable IMHO. ?I think that the fix for stable should limit itself only to prevent SMP from being selected if anything else than
CPU_32v6Kis selected.The first three are the bare minimum required for -stable.
Boot tested the 14 patch series with CONFIG_SWP_EMULATE enabled, on the following boards :
1. Omap2420 SDP
2. Omap2430 SDP
3. Omap3430 SDP
4. Omap4 Blaze
Tested by : Sourav Poddar <[email protected]>
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 15 lines · Sourav
Quoted 13 lines · Russell King - ARM Linux
Quoted 4 lines · Nicolas Pitre
At least another person did post results:
http://mid.gmane.org/20110117094602.GA2622 at pulham.picochip.com
http://mid.gmane.org/20110117110308.GC2622 at pulham.picochip.comSlightly different patch - there were three revisions. ?I can't attach a tested-by given to a different patch to this one.
Quoted 4 lines
Quoted 3 lines
That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
I must admit that this series looks a bit large for stable IMHO. ?I think that the fix for stable should limit itself only to prevent SMP from being selected if anything else than
CPU_32v6Kis selected.The first three are the bare minimum required for -stable.
Boot tested the 14 patch series ?with CONFIG_SWP_EMULATE enabled, on the following boards :
1. Omap2420 SDP
2. Omap2430 SDP
3. Omap3430 SDP
4. Omap4 Blaze
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 30 lines · Sourav
Quoted 15 lines · Sourav
Quoted 13 lines · Russell King - ARM Linux
Quoted 4 lines · Nicolas Pitre
At least another person did post results:
http://mid.gmane.org/20110117094602.GA2622 at pulham.picochip.com
http://mid.gmane.org/20110117110308.GC2622 at pulham.picochip.comSlightly different patch - there were three revisions. ?I can't attach a tested-by given to a different patch to this one.
Quoted 4 lines
Quoted 3 lines
That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
I must admit that this series looks a bit large for stable IMHO. ?I think that the fix for stable should limit itself only to prevent SMP from being selected if anything else than
CPU_32v6Kis selected.The first three are the bare minimum required for -stable.
Boot tested the 14 patch series ?with
CONFIG_SWP_EMULATEenabled, on the following boards :1. Omap2420 SDP
Quoted 7 lines
2. Omap2430 SDP
3. Omap3430 SDP
4. Omap4 Blaze
Tested-by Sourav Poddar <[email protected]>
Thanks. It's also important to ascertain which filesystems were tested - could you let me know please?
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 33 lines · Russell King - ARM Linux
Quoted 32 lines · Sourav
Quoted 15 lines · Sourav
Quoted 13 lines · Russell King - ARM Linux
Quoted 4 lines · Nicolas Pitre
At least another person did post results:
http://mid.gmane.org/20110117094602.GA2622 at pulham.picochip.com
http://mid.gmane.org/20110117110308.GC2622 at pulham.picochip.comSlightly different patch - there were three revisions. ?I can't attach a tested-by given to a different patch to this one.
Quoted 4 lines
Quoted 3 lines
That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
I must admit that this series looks a bit large for stable IMHO. ?I think that the fix for stable should limit itself only to prevent SMP from being selected if anything else than
CPU_32v6Kis selected.The first three are the bare minimum required for -stable.
?Boot tested the 14 patch series ?with
CONFIG_SWP_EMULATEenabled, on ?the following boards :? 1. Omap2420 SDP
? 2. Omap2430 SDP
Quoted 9 lines
Quoted 5 lines
? 3. Omap3430 SDP
? 4. Omap4 Blaze
? Tested-by: Sourav Poddar <[email protected]>
Thanks. ?It's also important to ascertain which filesystems were tested - could you let me know please?
It is a custom filesystem on BusyBox v1.17.2.
Please let me know if you need some other
information.
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 39 lines · Sourav
Quoted 37 lines · Russell King - ARM Linux
Quoted 36 lines · Sourav
Quoted 15 lines · Sourav
Quoted 13 lines · Russell King - ARM Linux
Quoted 4 lines · Nicolas Pitre
At least another person did post results:
http://mid.gmane.org/20110117094602.GA2622 at pulham.picochip.com
http://mid.gmane.org/20110117110308.GC2622 at pulham.picochip.comSlightly different patch - there were three revisions. ?I can't attach a tested-by given to a different patch to this one.
Quoted 4 lines
Quoted 3 lines
That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
I must admit that this series looks a bit large for stable IMHO. ?I think that the fix for stable should limit itself only to prevent SMP from being selected if anything else than
CPU_32v6Kis selected.The first three are the bare minimum required for -stable.
?Boot tested the 14 patch series ?with
CONFIG_SWP_EMULATEenabled, on ?the following boards :? 1. Omap2420 SDP
? 2. Omap2430 SDP
? 3. Omap3430 SDP
? 4. Omap4 Blaze
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
? Tested-by: Sourav Poddar <[email protected]>
Thanks. ?It's also important to ascertain which filesystems were tested - could you let me know please?
It is a custom filesystem on BusyBox v1.17.2.
So you wrote code under fs/ for this filesystem?
Quoted 2 lines
Please let me know if you need some other
information.
I'm trying to find out what _type_ of filesystem. ext2, ext3, nfs, cramfs, etc.
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 42 lines · Russell King - ARM Linux
Quoted 41 lines · Sourav
Quoted 39 lines · Russell King - ARM Linux
Quoted 37 lines · Sourav
Quoted 15 lines · Sourav
Quoted 13 lines · Russell King - ARM Linux
Quoted 4 lines · Nicolas Pitre
At least another person did post results:
http://mid.gmane.org/20110117094602.GA2622 at pulham.picochip.com
http://mid.gmane.org/20110117110308.GC2622 at pulham.picochip.comSlightly different patch - there were three revisions. ?I can't attach a tested-by given to a different patch to this one.
Quoted 4 lines
Quoted 3 lines
That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
I must admit that this series looks a bit large for stable IMHO. ?I think that the fix for stable should limit itself only to prevent SMP from being selected if anything else than
CPU_32v6Kis selected.The first three are the bare minimum required for -stable.
?Boot tested the 14 patch series ?with
CONFIG_SWP_EMULATEenabled, on ?the following boards :? 1. Omap2420 SDP
? 2. Omap2430 SDP
? 3. Omap3430 SDP
? 4. Omap4 Blaze
? Tested-by: Sourav Poddar <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Thanks. ?It's also important to ascertain which filesystems were tested - could you let me know please?
It is a custom filesystem on BusyBox v1.17.2.
So you wrote code under
fs/for this filesystem?
No.
Quoted 6 lines
Quoted 2 lines
Please let me know if you need some other
information.I'm trying to find out what _type_ of filesystem. ?ext2, ext3, nfs, cramfs, etc.
nfs filesystem.
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 1 line · Sourav
nfs filesystem.
Thanks.
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
In reply to Russell King - ARM LinuxHi Russell,
Hopefully this isn't too late to be useful.
Quoted 13 lines · Russell King - ARM Linux
Quoted 5 lines
Switch the set/clear/change bitops to use the word-based exclusive operations, which are only present in a wider range of ARM architectures than the byte-based exclusive operations.
Signed-off-by Russell King <[email protected]>As only one person replied to this patch with test information, I'm not happy to push this into -rc, and hence that prevents it going into -stable too. That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.
Quoted 6 lines
Therefore, I see no alternative at the moment but to purposely cause builds which cover ARMv6, and ARMv6K or ARMv7 CPUs to save people from data corruption.
Please get your tested-by's to me for at least the first three patches of this series ASAP.
I've tested this on the Versatile Express (ca9x4, little endian) with a USB hard drive and ext3 (rw) filesystem. I did a bunch of parallel dds of a 2GB file containing random data whilst the system was fairly loaded. File checksums all passed and the kernel didn't do anything untowards.
I appreciate this is the same test configuration as the one Nicolas did, but it at least replicates his findings.
Will
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 29 lines · Will Deacon
Hi Russell,
Hopefully this isn't too late to be useful.
Quoted 13 lines · Russell King - ARM Linux
Quoted 5 lines
Switch the set/clear/change bitops to use the word-based exclusive operations, which are only present in a wider range of ARM architectures than the byte-based exclusive operations.
Signed-off-by Russell King <[email protected]>As only one person replied to this patch with test information, I'm not happy to push this into -rc, and hence that prevents it going into -stable too. That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.Quoted 6 lines
Therefore, I see no alternative at the moment but to purposely cause builds which cover ARMv6, and ARMv6K or ARMv7 CPUs to save people from data corruption.
Please get your tested-by's to me for at least the first three patches of this series ASAP.
I've tested this on the Versatile Express (ca9x4, little endian) with a USB hard drive and ext3 (rw) filesystem. I did a bunch of parallel dds of a 2GB file containing random data whilst the system was fairly loaded. File checksums all passed and the kernel didn't do anything untowards.
Quoted 4 lines
Tested-by Will Deacon <[email protected]>I appreciate this is the same test configuration as the one Nicolas did, but it at least replicates his findings.
Was this for just the first three or the complete set?
Thanks.
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 11 lines
Quoted 9 lines
I've tested this on the Versatile Express (ca9x4, little endian) with a USB hard drive and ext3 (rw) filesystem. I did a bunch of parallel dds of a 2GB file containing random data whilst the system was fairly loaded. File checksums all passed and the kernel didn't do anything untowards.
Tested-by Will Deacon <[email protected]>I appreciate this is the same test configuration as the one Nicolas did, but it at least replicates his findings.
Was this for just the first three or the complete set?
This was for your -devel branch as of last night (head 75c4aa97). If I try to extract patches from the mailing list, Exchange destroys them :(
Will
RE: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex
In reply to Russell King - ARM LinuxQuoted 11 lines
Quoted 9 lines
I've tested this on the Versatile Express (ca9x4, little endian) with a USB hard drive and ext3 (rw) filesystem. I did a bunch of parallel dds of a 2GB file containing random data whilst the system was fairly loaded. File checksums all passed and the kernel didn't do anything untowards.
Tested-by Will Deacon <[email protected]>I appreciate this is the same test configuration as the one Nicolas did, but it at least replicates his findings.
Was this for just the first three or the complete set?
This was for your -devel branch as of last night (head 75c4aa97). If I try to extract patches from the mailing list, Exchange destroys them :(
Will
RE: [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex
In reply to Russell King - ARM LinuxHi Russell,
Hopefully this isn't too late to be useful.
Quoted 13 lines · Russell King - ARM Linux
Quoted 5 lines
Switch the set/clear/change bitops to use the word-based exclusive operations, which are only present in a wider range of ARM architectures than the byte-based exclusive operations.
Signed-off-by Russell King <[email protected]>As only one person replied to this patch with test information, I'm not happy to push this into -rc, and hence that prevents it going into -stable too. That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.
Quoted 6 lines
Therefore, I see no alternative at the moment but to purposely cause builds which cover ARMv6, and ARMv6K or ARMv7 CPUs to save people from data corruption.
Please get your tested-by's to me for at least the first three patches of this series ASAP.
I've tested this on the Versatile Express (ca9x4, little endian) with a USB hard drive and ext3 (rw) filesystem. I did a bunch of parallel dds of a 2GB file containing random data whilst the system was fairly loaded. File checksums all passed and the kernel didn't do anything untowards.
I appreciate this is the same test configuration as the one Nicolas did, but it at least replicates his findings.
Will
A message that is not in the archive (sent off-list or not yet received): 000601cbbc97$cc6955d0$653c0170$%[email protected]
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
Quoted 29 lines · Will Deacon
Hi Russell,
Hopefully this isn't too late to be useful.
Quoted 13 lines · Russell King - ARM Linux
Quoted 5 lines
Switch the set/clear/change bitops to use the word-based exclusive operations, which are only present in a wider range of ARM architectures than the byte-based exclusive operations.
Signed-off-by Russell King <[email protected]>As only one person replied to this patch with test information, I'm not happy to push this into -rc, and hence that prevents it going into -stable too. That means
omap2plus_defconfig.38 mainline kernels (including -stable) will remain potentially dangerous when run on SMP capable hardware.Quoted 6 lines
Therefore, I see no alternative at the moment but to purposely cause builds which cover ARMv6, and ARMv6K or ARMv7 CPUs to save people from data corruption.
Please get your tested-by's to me for at least the first three patches of this series ASAP.
I've tested this on the Versatile Express (ca9x4, little endian) with a USB hard drive and ext3 (rw) filesystem. I did a bunch of parallel dds of a 2GB file containing random data whilst the system was fairly loaded. File checksums all passed and the kernel didn't do anything untowards.
Quoted 4 lines
Tested-by Will Deacon <[email protected]>I appreciate this is the same test configuration as the one Nicolas did, but it at least replicates his findings.
Well, I did run parallel instances of the git test suite on a Dove board using the sata_mv driver. Therefore this is still a significant difference in configuration which is good.
Nicolas
PATCH 2/14 ARM: bitops: switch set/clear/change bitops to use ldrex/strex
In reply to Russell King - ARM LinuxQuoted 3 lines · Russell King - ARM Linux
Switch the set/clear/change bitops to use the word-based exclusive operations, which are only present in a wider range of ARM architectures than the byte-based exclusive operations.
This too been in use for about a week now with ext3 and nfs:
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
In reply to Russell King - ARM LinuxSMP requires at least the ARMv6K extensions to be present, so if we're running on SMP, the WFE and SEV instructions must be available.
However, when we run on UP, the v6K extensions may not be available, and so we don't want WFE/SEV to be in the instruction stream. Use the SMP alternatives infrastructure to replace these instructions with NOPs if we build for SMP but run on UP.
--- arch/arm/include/asm/spinlock.h | 37 +++++++++++++++++++++++++------------ 1 files changed, 25 insertions(+), 12 deletions(-)
arch/arm/include/asm/spinlock.h +25 -12
@@ -5,17 +5,36 @@#error SMP not supported on pre-ARMv6 CPUs#endif +/* +* sev and wfe are ARMv6K extensions. Uniprocessor ARMv6 may not have the K +* extensions, so when running on UP, we have to patch these instructions away. +*/ +#define ALT_SMP (smp, up) \ + "9998: " smp "\n" \ + " .pushsection \".alt.smp.init\", \"a\"\n" \ + " .long 9998b\n" \ + " " up "\n" \ + " .popsection\n" + +#ifdef CONFIG_THUMB2_KERNEL +#define SEV ALT_SMP("sev.w", "nop.w") +#define WFE (cond) ALT_SMP("wfe" cond ".w", "nop.w") +#else +#define SEV ALT_SMP("sev", "nop") +#define WFE (cond) ALT_SMP("wfe" cond, "nop") +#endif +static inline void dsb_sev (void ) {#if __LINUX_ARM_ARCH__ >=7 __asm__ __volatile__ ("dsb\n" -"sev" +SEV ); -#elif defined(CONFIG_CPU_32v6K) +#else __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4\n" -"sev" +SEV : :"r" (0 ) );#endif
@@ -46,9 +65,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) __asm__ __volatile__("1: ldrex %0, [%1]\n" " teq %0, #0\n" -#ifdef CONFIG_CPU_32v6K -" wfene\n" -#endif + WFE("ne")" strexeq %0, %2, [%1]\n" " teqeq %0, #0\n" " bne 1b"
@@ -107,9 +124,7 @@ static inline void arch_write_lock(arch_rwlock_t *rw) __asm__ __volatile__("1: ldrex %0, [%1]\n" " teq %0, #0\n" -#ifdef CONFIG_CPU_32v6K -" wfene\n" -#endif + WFE("ne")" strexeq %0, %2, [%1]\n" " teq %0, #0\n" " bne 1b"
@@ -176,9 +191,7 @@ static inline void arch_read_lock(arch_rwlock_t *rw)"1: ldrex %0, [%2]\n" " adds %0, %0, #1\n" " strexpl %1, %0, [%2]\n" -#ifdef CONFIG_CPU_32v6K -" wfemi\n" -#endif + WFE("mi") " rsbpls %0, %1, #0\n" " bmi 1b" : "=&r" (tmp), "=&r" (tmp2)
Signature · 1 line
1.6.2.5
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 9 lines · Russell King - ARM Linux
SMP requires at least the ARMv6K extensions to be present, so if we're running on SMP, the WFE and SEV instructions must be available.
However, when we run on UP, the v6K extensions may not be available, and so we don't want WFE/SEV to be in the instruction stream. Use the SMP alternatives infrastructure to replace these instructions with NOPs if we build for SMP but run on UP.
Signed-off-by Russell King <[email protected]>
Boots on omap242x (ARMv6 without K) and omap3/4:
Quoted 88 lines
--- arch/arm/include/asm/spinlock.h | 37 +++++++++++++++++++++++++------------ 1 files changed, 25 insertions(+), 12 deletions(-)arch/arm/include/asm/spinlock.h +25
-12@@ -5,17 +5,36 @@#error SMP not supported on pre-ARMv6 CPUs#endif +/* +* sev and wfe are ARMv6K extensions. Uniprocessor ARMv6 may not have the K +* extensions, so when running on UP, we have to patch these instructions away. +*/ +#define ALT_SMP (smp, up) \ + "9998: " smp "\n" \ + " .pushsection \".alt.smp.init\", \"a\"\n" \ + " .long 9998b\n" \ + " " up "\n" \ + " .popsection\n" + +#ifdef CONFIG_THUMB2_KERNEL +#define SEV ALT_SMP("sev.w", "nop.w") +#define WFE (cond) ALT_SMP("wfe" cond ".w", "nop.w") +#else +#define SEV ALT_SMP("sev", "nop") +#define WFE (cond) ALT_SMP("wfe" cond, "nop") +#endif +static inline void dsb_sev (void ) {#if __LINUX_ARM_ARCH__ >=7 __asm__ __volatile__ ("dsb\n" -"sev" +SEV ); -#elif defined(CONFIG_CPU_32v6K) +#else __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4\n" -"sev" +SEV : :"r" (0 ) );#endif @@ -46,9 +65,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) __asm__ __volatile__("1: ldrex %0, [%1]\n" " teq %0, #0\n" -#ifdef CONFIG_CPU_32v6K -" wfene\n" -#endif + WFE("ne")" strexeq %0, %2, [%1]\n" " teqeq %0, #0\n" " bne 1b" @@ -107,9 +124,7 @@ static inline void arch_write_lock(arch_rwlock_t *rw) __asm__ __volatile__("1: ldrex %0, [%1]\n" " teq %0, #0\n" -#ifdef CONFIG_CPU_32v6K -" wfene\n" -#endif + WFE("ne")" strexeq %0, %2, [%1]\n" " teq %0, #0\n" " bne 1b" @@ -176,9 +191,7 @@ static inline void arch_read_lock(arch_rwlock_t *rw)"1: ldrex %0, [%2]\n" " adds %0, %0, #1\n" " strexpl %1, %0, [%2]\n" -#ifdef CONFIG_CPU_32v6K -" wfemi\n" -#endif + WFE("mi") " rsbpls %0, %1, #0\n" " bmi 1b" : "=&r" (tmp), "=&r" (tmp2)Signature · 6 lines
1.6.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
In reply to Russell King - ARM LinuxHi there,
Quoted 87 lines · Russell King - ARM Linux
SMP requires at least the ARMv6K extensions to be present, so if we're running on SMP, the WFE and SEV instructions must be available.
However, when we run on UP, the v6K extensions may not be available, and so we don't want WFE/SEV to be in the instruction stream. ?Use the SMP alternatives infrastructure to replace these instructions with NOPs if we build for SMP but run on UP.
Signed-off-by Russell King <[email protected]>---
?arch/arm/include/asm/spinlock.h | ? 37 +++++++++++++++++++++++++------------ ?1 files changed, 25 insertions(+), 12 deletions(-)arch/arm/include/asm/spinlock.h +0
-0@@ -5,17 +5,36 @@?#error SMP not supported on pre-ARMv6 CPUs
?#endifarch/arm/include/asm/spinlock.h +19
-0+/* +* sev and wfe are ARMv6K extensions. ?Uniprocessor ARMv6 may not have the K +* extensions, so when running on UP, we have to patch these instructions away. +*/ +#define ALT_SMP (smp, up) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \ + ? ? ? "9998: ?" smp "\n" ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\ + ? ? ? " ? ? ? .pushsection \".alt.smp.init\", \"a\"\n" ? ? ? ?\ + ? ? ? " ? ? ? .long ? 9998b\n" ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\ + ? ? ? " ? ? ? " up "\n" ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \ + ? ? ? " ? ? ? .popsection\n" + +#ifdef CONFIG_THUMB2_KERNEL +#define SEV ? ? ? ? ? ?ALT_SMP("sev.w", "nop.w") +#define WFE (cond) ? ? ?ALT_SMP("wfe" cond ".w", "nop.w") +#else +#define SEV ? ? ? ? ? ?ALT_SMP("sev", "nop") +#define WFE (cond) ? ? ?ALT_SMP("wfe" cond, "nop") +#endif +?static inline void
dsb_sev(void)
?{
?#if__LINUX_ARM_ARCH__>= 7
? ? ? ?__asm____volatile__(
? ? ? ? ? ? ? ?"dsb\n"
- ? ? ? ? ? ? ? "sev"
+ ? ? ? ? ? ? ? SEV
? ? ? ?);arch/arm/include/asm/spinlock.h +1
-1-#elif defined(CONFIG_CPU_32v6K) +#else ? ? ? ?__asm__
__volatile__(
? ? ? ? ? ? ? ?"mcr p15, 0, %0, c7, c10, 4\n"
- ? ? ? ? ? ? ? "sev"
+ ? ? ? ? ? ? ? SEV
? ? ? ? ? ? ? ?: : "r" (0)
? ? ? ?);
?#endifarch/arm/include/asm/spinlock.h +0
-0@@ -46,9 +65,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)? ? ? ?__asm__ __volatile__(
?"1: ? ?ldrex ? %0, [%1]\n"
?" ? ? ?teq ? ? %0, #0\n"arch/arm/include/asm/spinlock.h +1
-3-#ifdef CONFIG_CPU_32v6K -" ? ? ?wfene\n" -#endif + ? ? ? WFE("ne")?" ? ? ?strexeq %0, %2, [%1]\n"
?" ? ? ?teqeq ? %0, #0\n"
?" ? ? ?bne ? ? 1b"arch/arm/include/asm/spinlock.h +0
-0@@ -107,9 +124,7 @@ static inline void arch_write_lock(arch_rwlock_t *rw)? ? ? ?__asm__ __volatile__(
?"1: ? ?ldrex ? %0, [%1]\n"
?" ? ? ?teq ? ? %0, #0\n"arch/arm/include/asm/spinlock.h +1
-3-#ifdef CONFIG_CPU_32v6K -" ? ? ?wfene\n" -#endif + ? ? ? WFE("ne")?" ? ? ?strexeq %0, %2, [%1]\n"
?" ? ? ?teq ? ? %0, #0\n"
?" ? ? ?bne ? ? 1b"arch/arm/include/asm/spinlock.h +0
-0@@ -176,9 +191,7 @@ static inline void arch_read_lock(arch_rwlock_t *rw)?"1: ? ?ldrex ? %0, [%2]\n"
?" ? ? ?adds ? ?%0, %0, #1\n"
?" ? ? ?strexpl %1, %0, [%2]\n"arch/arm/include/asm/spinlock.h +1
-3-#ifdef CONFIG_CPU_32v6K -" ? ? ?wfemi\n" -#endif + ? ? ? WFE("mi")
Quoted 5 lines
?" ? ? ?rsbpls ?%0, %1, #0\n"
?" ? ? ?bmi ? ? 1b"
? ? ? ?: "=&r" (tmp), "=&r" (tmp2)
--
1.6.2.5
A couple of questions on this:
1) I notice these spinlock functions are generally marked inline.
Is that likely to happen in modules? If so, there would be a need to do SMP_ON_UP fixups at module load time -- I don't think that's currently implemented.
2) When building with this patch and CONFIG_SMP_ON_UP=y, I've seen vmlinux link errors like this:
LD .tmp_vmlinux1.exit.text' referenced in section .alt.smp.init' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
make: *** [.tmp_vmlinux1] Error 1
I don't know whether this is caused by the patch directly or as a side-effect -- I've only noticed it in the linaro-2.6.37 tree so far. git bisect indentified this above patch as the first one with the error in that case.
I don't understand the section discarding logic too well, so I'm not sure how to fix it for now...
Cheers
---Dave
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 7 lines · Dave Martin
A couple of questions on this:
1) I notice these spinlock functions are generally marked inline.
Is that likely to happen in modules? If so, there would be a need to do
SMP_ON_UPfixups at module load time -- I don't think that's currently implemented.
No one should be using the arch_* spinlocks directly. The spinlocks are implemented in out of line code in kernel/spinlock.c
Quoted 9 lines
2) When building with this patch and
CONFIG_SMP_ON_UP=y, I've seen vmlinux link errors like this:LD .tmp_vmlinux1
.exit.text' referenced in section.alt.smp.init' ofdrivers/built-in.o: defined in discarded section `.exit.text' ofdrivers/built-in.o
make: *** [.tmp_vmlinux1] Error 1
Quoted 7 lines
I don't know whether this is caused by the patch directly or as a side-effect -- I've only noticed it in the linaro-2.6.37 tree so far. git bisect indentified this above patch as the first one with the error in that case.
I don't understand the section discarding logic too well, so I'm not sure how to fix it for now...
Hmm. I don't see how that could happen, unless some driver is going behind the spinlock APIs, or using our dsb_sev() directly.
I think you need to first track down what's responsible for inserting architecture spinlock code into drivers.
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 11 lines · Russell King - ARM Linux
Quoted 7 lines · Dave Martin
A couple of questions on this:
1) I notice these spinlock functions are generally marked inline.
Is that likely to happen in modules? ?If so, there would be a need to do
SMP_ON_UPfixups at module load time -- I don't think that's currently implemented.No one should be using the arch_* spinlocks directly. ?The spinlocks are implemented in out of line code in
kernel/spinlock.c
OK--- do think this is something we need a sanity-check for, or does this fall into to a category of bad driver implementation which will get thrown out during peer review?
Quoted 15 lines
Quoted 15 lines
2) When building with this patch and
CONFIG_SMP_ON_UP=y, I've seen vmlinux link errors like this:? LD ? ? ?.tmp_vmlinux1
.exit.text' referenced in section.alt.smp.init' ofdrivers/built-in.o: defined in discarded section `.exit.text' ofdrivers/built-in.o
make: *** [.tmp_vmlinux1] Error 1I don't know whether this is caused by the patch directly or as a side-effect -- I've only noticed it in the linaro-2.6.37 tree so far. git bisect indentified this above patch as the first one with the error in that case.
Quoted 9 lines
Quoted 2 lines
I don't understand the section discarding logic too well, so I'm not sure how to fix it for now...
Hmm. ?I don't see how that could happen, unless some driver is going behind the spinlock APIs, or using our
dsb_sev()directly.I think you need to first track down what's responsible for inserting architecture spinlock code into drivers.
OK, I'll try and do a bit more digging. I think I have a better idea of what to look for now, anyhow.
Cheers
---Dave
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 11 lines · Dave Martin
Quoted 9 lines · Russell King - ARM Linux
Quoted 7 lines · Dave Martin
A couple of questions on this:
1) I notice these spinlock functions are generally marked inline.
Is that likely to happen in modules? ?If so, there would be a need to do
SMP_ON_UPfixups at module load time -- I don't think that's currently implemented.
Quoted 6 lines
Quoted 2 lines
No one should be using the arch_* spinlocks directly. ?The spinlocks are implemented in out of line code in
kernel/spinlock.cOK--- do think this is something we need a sanity-check for, or does this fall into to a category of bad driver implementation which will get thrown out during peer review?
Hmm, actually it looks like you can end up with configurations where the spinlocks are inlined.
That means we'll have to get rid of the link-time discarding of the .exit sections, and discard them along with the .init sections.
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 19 lines · Russell King - ARM Linux
Quoted 11 lines · Dave Martin
Quoted 9 lines · Russell King - ARM Linux
Quoted 7 lines · Dave Martin
A couple of questions on this:
1) I notice these spinlock functions are generally marked inline.
Is that likely to happen in modules? ?If so, there would be a need to do
SMP_ON_UPfixups at module load time -- I don't think that's currently implemented.Quoted 6 lines
Quoted 2 lines
No one should be using the arch_* spinlocks directly. ?The spinlocks are implemented in out of line code in
kernel/spinlock.cOK--- do think this is something we need a sanity-check for, or does this fall into to a category of bad driver implementation which will get thrown out during peer review?
Quoted 5 lines
Hmm, actually it looks like you can end up with configurations where the spinlocks are inlined.
That means we'll have to get rid of the link-time discarding of the .exit sections, and discard them along with the .init sections.
... but only when CONFIG_SMP_ON_UP=y.
Nicolas
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 24 lines · Nicolas Pitre
Quoted 22 lines · Russell King - ARM Linux
Quoted 11 lines · Dave Martin
Quoted 9 lines · Russell King - ARM Linux
Quoted 7 lines · Dave Martin
A couple of questions on this:
1) I notice these spinlock functions are generally marked inline.
Is that likely to happen in modules? ?If so, there would be a need to do
SMP_ON_UPfixups at module load time -- I don't think that's currently implemented.Quoted 6 lines
Quoted 2 lines
No one should be using the arch_* spinlocks directly. ?The spinlocks are implemented in out of line code in
kernel/spinlock.cOK--- do think this is something we need a sanity-check for, or does this fall into to a category of bad driver implementation which will get thrown out during peer review?
Hmm, actually it looks like you can end up with configurations where the spinlocks are inlined.
Quoted 7 lines
Quoted 2 lines
That means we'll have to get rid of the link-time discarding of the .exit sections, and discard them along with the .init sections.
... but only when
CONFIG_SMP_ON_UP=y.Nicolas
Do we need to consider any other discarded sections? In vmlinux.lds, I have:
/* Default discards */
/DISCARD/ : { *(.exit.text) *(.cpuexit.text) *(.memexit.text)
*(.exit.data) *(.cpuexit.data) *(.cpuexit.rodata) *(.memexit.data) *(.memexit.rodata) *(.exitcall.exit) *(.discard) *(.discard.*) }
Alternatively, I wonder .alt.smp.init could make weak references instead of normal references: then if the referenced section is discarded, the reference will revert to 0 and the fixup code can ignore it (at the expense of wasting a bit of space in the fixup table ... but it's no worse than the current situation). From experimentation, it seems this doesn't work if the referenced symbol is defined in the same file, since the linker resolves the reference before discarding sections, but maybe there's a way around it...
This does rely on generating a globally unique symbol name for every fixup ... we can come close using KBUILD_MODNAME, __LINE__ and/or the assembler macro widget \@. But I think that KBUILD_MODNAME doesn't take the file path into account so may not really be globally unique.
If we put every fixup in its own _section_ we might be able to collapse those out of the list at link time too. However, that seems hard to achieve, since in order to do the correct link-time filtering we would need the fixup's section name to be based on the referenced section's name ... due to preprocessor limitations I don't think we can do that automatically (and manual maintenance would be a bad plan).
Cheers
---Dave
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 6 lines · Dave Martin
Do we need to consider any other discarded sections? In
vmlinux.lds, I have:/* Default discards */
/DISCARD/ : { *(.exit.text) *(.cpuexit.text) *(.memexit.text)
*(.exit.data) *(.cpuexit.data) *(.cpuexit.rodata) *(.memexit.data) *(.memexit.rodata) *(.exitcall.exit) *(.discard) *(.discard.*) }
We need to keep all the text exit stuff, and that could well want data exit stuff, so I think we need ot keep most of that. Maybe not the .discard* stuff though.
Quoted 7 lines
If we put every fixup in its own _section_ we might be able to collapse those out of the list at link time too. However, that seems hard to achieve, since in order to do the correct link-time filtering we would need the fixup's section name to be based on the referenced section's name ... due to preprocessor limitations I don't think we can do that automatically (and manual maintenance would be a bad plan).
I suspect if it was sanely possible to do, then x86 would already be doing it as they've had this problem for a lot longer than we have. It might be worth talking to toolchain people to see if it can be made to work somehow - but we really don't want to get rid of all discarded section warnings.
IOW, if we have a text segment which is included in the image and it references discarded .exit text, we really do want it to fail at link time.
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
SMP_ON_UP fixups lead to vmlinux link errors if those sections are discarded at link-time. In particular this may happen for built-in __exit stuff.
This patch modifies the vmlinux linker script to reduce the amount of discarded sections, and tries to make sure that __exit sections are kept in.
This is a hack and probably wrong! Further discussion is needed.
---
Quoted 26 lines · Russell King - ARM Linux
Quoted 6 lines · Dave Martin
Do we need to consider any other discarded sections? In
vmlinux.lds, I have:/* Default discards */
/DISCARD/ : { *(.exit.text) *(.cpuexit.text) *(.memexit.text)
*(.exit.data) *(.cpuexit.data) *(.cpuexit.rodata) *(.memexit.data) *(.memexit.rodata) *(.exitcall.exit) *(.discard) *(.discard.*) }We need to keep all the text exit stuff, and that could well want data exit stuff, so I think we need ot keep most of that. Maybe not the .discard* stuff though.
Quoted 7 lines
If we put every fixup in its own _section_ we might be able to collapse those out of the list at link time too. However, that seems hard to achieve, since in order to do the correct link-time filtering we would need the fixup's section name to be based on the referenced section's name ... due to preprocessor limitations I don't think we can do that automatically (and manual maintenance would be a bad plan).
I suspect if it was sanely possible to do, then x86 would already be doing it as they've had this problem for a lot longer than we have. It might be worth talking to toolchain people to see if it can be made to work somehow - but we really don't want to get rid of all discarded section warnings.
Quoted 3 lines
IOW, if we have a text segment which is included in the image and it references discarded .exit text, we really do want it to fail at link time.
arch/arm/kernel/vmlinux.lds.S +18 -0
@@ -85,6 +85,7 @@ SECTIONS * unwind exit sections must be discarded before the rest of the * unwind sections get included. */ +#ifndef CONFIG_SMP_ON_UP /DISCARD/ : { *(.ARM.exidx.exit.text) *(.ARM.extab.exit.text)
@@ -99,6 +100,7 @@ SECTIONS *(__ex_table) #endif } +#endif .text : { /* Real text segment */ _text = .; /* Text and read-only data */
@@ -107,6 +109,12 @@ SECTIONS __exception_text_end = .; IRQENTRY_TEXT TEXT_TEXT +#ifdef CONFIG_SMP_ON_UP + *(.exit.text) + CPU_KEEP(exit.text) + DEV_KEEP(exit.text) + MEM_KEEP(exit.text) +#endif SCHED_TEXT LOCK_TEXT KPROBES_TEXT
@@ -116,6 +124,11 @@ SECTIONS *(.gnu.warning) *(.rodata) *(.rodata.*) +#ifdef CONFIG_SMP_ON_UP + CPU_KEEP(exit.rodata) + DEV_KEEP(exit.rodata) + MEM_KEEP(exit.rodata) +#endif *(.glue_7) *(.glue_7t) . = ALIGN(4);
@@ -188,6 +201,11 @@ SECTIONS * and the usual data section */ DATA_DATA +#ifdef CONFIG_SMP_ON_UP + DEV_KEEP(exit.data) + CPU_KEEP(exit.data) + MEM_KEEP(exit.data) +#endif CONSTRUCTORS _edata = .;
Signature · 1 line
1.7.1
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 11 lines · Dave P. Martin
SMP_ON_UPfixups lead to vmlinux link errors if those sections are discarded at link-time. In particular this may happen for built-in__exitstuff.This patch modifies the vmlinux linker script to reduce the amount of discarded sections, and tries to make sure that
__exitsections are kept in.This is a hack and probably wrong! Further discussion is needed.
Signed-off-by Dave Martin <[email protected]>
Since discarded sections are by definition not used, we should at least put them into the .init section so to discard them at run time. And only the EXIT_TEXT and EXIT_DATA would need to be kept (see x86 for example).
Nicolas
PATCH v2 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups SMP_ON_UP fixups
Quoted 7 lines · Nicolas Pitre
Since discarded sections are by definition not used, we should at least put them into the .init section so to discard them at run time. And only the
EXIT_TEXTandEXIT_DATAwould need to be kept (see x86 for example).Nicolas
I'll check up on whether we need to care about writable data. For now I've just attempted to move stuff to .init.
Cheers
---Dave
v2: Also move the .exit stuff to the .init area where it can be discarded on boot. The result builds, but I haven't tested it yet.
v1:
SMP_ON_UP fixups lead to vmlinux link errors if those sections are discarded at link-time. In particular this may happen for built-in __exit stuff.
This patch modifies the vmlinux linker script to reduce the amount of discarded sections, and tries to make sure that __exit sections are kept in.
This is a hack and probably wrong!
--- arch/arm/kernel/vmlinux.lds.S | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/kernel/vmlinux.lds.S +18 -0
@@ -43,6 +43,17 @@ SECTIONS _sinittext = .; HEAD_TEXT INIT_TEXT +#ifdef CONFIG_SMP_ON_UP + *(.exit.text) + CPU_KEEP(exit.text) + DEV_KEEP(exit.text) + MEM_KEEP(exit.text) +#endif +#ifdef CONFIG_SMP_ON_UP + CPU_KEEP(exit.rodata) + DEV_KEEP(exit.rodata) + MEM_KEEP(exit.rodata) +#endif _einittext = .; ARM_CPU_DISCARD(PROC_INFO) __arch_info_begin = .;
@@ -72,6 +83,11 @@ SECTIONS __init_begin = _stext; INIT_DATA #endif +#ifdef CONFIG_SMP_ON_UP + DEV_KEEP(exit.data) + CPU_KEEP(exit.data) + MEM_KEEP(exit.data) +#endif } PERCPU(PAGE_SIZE)
@@ -85,6 +101,7 @@ SECTIONS * unwind exit sections must be discarded before the rest of the * unwind sections get included. */ +#ifndef CONFIG_SMP_ON_UP /DISCARD/ : { *(.ARM.exidx.exit.text) *(.ARM.extab.exit.text)
@@ -99,6 +116,7 @@ SECTIONS *(__ex_table) #endif } +#endif .text : { /* Real text segment */ _text = .; /* Text and read-only data */
Signature · 1 line
1.7.1
PATCH v2 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups SMP_ON_UP fixups
Quoted 11 lines · Dave Martin
Quoted 7 lines · Nicolas Pitre
Since discarded sections are by definition not used, we should at least put them into the .init section so to discard them at run time. And only the
EXIT_TEXTandEXIT_DATAwould need to be kept (see x86 for example).Nicolas
I'll check up on whether we need to care about writable data. For now I've just attempted to move stuff to .init.
You can keep the discarding of the unwind data for exit sections as the exit sections don't depend on the unwind data.
It's all to do with sections being referenced from other sections. If a section being kept references a section being discarded, then the linker will error out. You need to keep any section that is being referenced - but you don't need to keep sections which only reference those being kept.
I'd also prefer to see a 'KEEP_EXIT' macro as I think we can discard these sections in more cases than just SMP_ON_UP. I think it's:
SMP_ON_UP && !DEBUG_SPINLOCK
which requires it. So if you have spinlock debugging enabled you can discard the exit sections. See include/linux/spinlock.h.
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
In reply to Dave P. MartinQuoted 9 lines · Dave P. Martin
SMP_ON_UPfixups lead to vmlinux link errors if those sections are discarded at link-time. In particular this may happen for built-in__exitstuff.This patch modifies the vmlinux linker script to reduce the amount of discarded sections, and tries to make sure that
__exitsections are kept in.This is a hack and probably wrong! Further discussion is needed.
Can you send the configuration which you see this problem with? I've tried to build a kernel which inlines the spinlocks, but I find that's not possible, so I'm doubting whether any fix is required for mainline.
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 9 lines · Russell King - ARM Linux
Quoted 8 lines · Dave P. Martin
SMP_ON_UPfixups lead to vmlinux link errors if those sections are discarded at link-time. In particular this may happen for built-in__exitstuff.This patch modifies the vmlinux linker script to reduce the amount of discarded sections, and tries to make sure that
__exitsections are kept in.
Quoted 6 lines
Quoted 1 line
This is a hack and probably wrong! Further discussion is needed.
Can you send the configuration which you see this problem with? I've tried to build a kernel which inlines the spinlocks, but I find that's not possible, so I'm doubting whether any fix is required for mainline.
Any news on this, or can it not be reproduced?
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Russell King - ARM Linux
Quoted 8 lines · Dave P. Martin
SMP_ON_UPfixups lead to vmlinux link errors if those sections are discarded at link-time. ?In particular this may happen for built-in__exitstuff.This patch modifies the vmlinux linker script to reduce the amount of discarded sections, and tries to make sure that
__exitsections are kept in.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
This is a hack and probably wrong! ?Further discussion is needed.
Can you send the configuration which you see this problem with? I've tried to build a kernel which inlines the spinlocks, but I find that's not possible, so I'm doubting whether any fix is required for mainline.
Any news on this, or can it not be reproduced?
Hi, apologies-- didn't see my mail for a bit.
I get the problem with this tree and config (which builds with SMP_ON_UP and THUMB2_KERNEL for omap3/4):
Tree: git://git.linaro.org/people/dmart/linux-2.6-arm.git
dirty/arm/omap-thumb2+merged
Config: http://people.linaro.org/~dmart/arm_omap-thumb2+v2_config
I haven't identified the precise combination of options which causes the problem, and I don't really understand what the clean solution would be -- it's on my list of stuff to look at, but not at the top.
Other people not enabling THUMB2_KERNEL have also had the problem (though I guess that shouldn't make a difference anyway).
I suggested a patch on the binutils mailing list to add a way for putting fixups in separate, sensibly-named sections which would allow for a proper fix to this class of problem, but I haven't had any significant feedback on that ... anyway, that would not be available on most people's toolchains for a while even if it got accepted -- see:
http://cygwin.com/ml/binutils/2011-02/msg00004.html
Cheers
---Dave
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 22 lines · Dave Martin
Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Russell King - ARM Linux
Quoted 8 lines · Dave P. Martin
SMP_ON_UPfixups lead to vmlinux link errors if those sections are discarded at link-time. ?In particular this may happen for built-in__exitstuff.This patch modifies the vmlinux linker script to reduce the amount of discarded sections, and tries to make sure that
__exitsections are kept in.Quoted 9 lines
Quoted 6 lines
Quoted 1 line
This is a hack and probably wrong! ?Further discussion is needed.
Can you send the configuration which you see this problem with? I've tried to build a kernel which inlines the spinlocks, but I find that's not possible, so I'm doubting whether any fix is required for mainline.
Any news on this, or can it not be reproduced?
Quoted 8 lines
Hi, apologies-- didn't see my mail for a bit.
I get the problem with this tree and config (which builds with
SMP_ON_UPandTHUMB2_KERNELfor omap3/4):Tree:
git://git.linaro.org/people/dmart/linux-2.6-arm.git
dirty/arm/omap-thumb2+merged
Config: http://people.linaro.org/~dmart/arm_omap-thumb2+v2_config
Note that this tree contains some extra patches (though I believe nothing is there which should cause the problem), and does not contain everything from rmk/devel -- so it's possible this has been fixed in the meantime or no longer occurs for some other reason...
Cheers
---Dave
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 9 lines · Dave Martin
Quoted 8 lines · Dave Martin
Hi, apologies-- didn't see my mail for a bit.
I get the problem with this tree and config (which builds with
SMP_ON_UPandTHUMB2_KERNELfor omap3/4):Tree:
git://git.linaro.org/people/dmart/linux-2.6-arm.git
dirty/arm/omap-thumb2+merged
Config: http://people.linaro.org/~dmart/arm_omap-thumb2+v2_config
Thanks for the config.
Quoted 4 lines
Note that this tree contains some extra patches (though I believe nothing is there which should cause the problem), and does not contain everything from rmk/devel -- so it's possible this has been fixed in the meantime or no longer occurs for some other reason...
No need - I now have some modules which contain SMP alternatives, so we do need to fix the module loader for this, and keep the SMP alternatives replacement code around. It's not worth eliminating the code as if we include an informative printk() to say why we're refusing to load the module, the string would be larger than the code it eliminates. So, I think we need to merge the patch below to avoid run-time problems.
Of course, this conflicts rather badly with the p2v stuff...
arch/arm/kernel/head.S | 38 ++++++++++++++++++++++++++------------ arch/arm/kernel/module.c | 22 +++++++++++++++++++++- 2 files changed, 47 insertions(+), 13 deletions(-)
arch/arm/kernel/head.S +26 -12
@@ -391,6 +391,7 @@ ENDPROC(__turn_mmu_on) #ifdef CONFIG_SMP_ON_UP + __INIT __fixup_smp: and r3, r9, #0x000f0000 @ architecture version teq r3, #0x000f0000 @ CPU ID supported?
@@ -415,18 +416,7 @@ __fixup_smp_on_up: sub r3, r0, r3 add r4, r4, r3 add r5, r5, r3 -2: cmp r4, r5 - movhs pc, lr - ldmia r4!, {r0, r6} - ARM( str r6, [r0, r3] ) - THUMB( add r0, r0, r3 ) -#ifdef __ARMEB__ - THUMB( mov r6, r6, ror #16 ) @ Convert word order for big-endian. -#endif - THUMB( strh r6, [r0], #2 ) @ For Thumb-2, store as two halfwords - THUMB( mov r6, r6, lsr #16 ) @ to be robust against misaligned r3. - THUMB( strh r6, [r0] ) - b 2b + b __do_fixup_smp_on_up ENDPROC(__fixup_smp) .align
@@ -440,7 +430,31 @@ smp_on_up: ALT_SMP(.long 1) ALT_UP(.long 0) .popsection +#endif + .text +__do_fixup_smp_on_up: + cmp r4, r5 + movhs pc, lr + ldmia r4!, {r0, r6} + ARM( str r6, [r0, r3] ) + THUMB( add r0, r0, r3 ) +#ifdef __ARMEB__ + THUMB( mov r6, r6, ror #16 ) @ Convert word order for big-endian. #endif + THUMB( strh r6, [r0], #2 ) @ For Thumb-2, store as two halfwords + THUMB( mov r6, r6, lsr #16 ) @ to be robust against misaligned r3. + THUMB( strh r6, [r0] ) + b __do_fixup_smp_on_up +ENDPROC(__do_fixup_smp_on_up) + +ENTRY(fixup_smp) + stmfd sp!, {r4 - r6, lr} + mov r4, r0 + add r5, r0, r1 + mov r3, #0 + bl __do_fixup_smp_on_up + ldmfd sp!, {r4 - r6, pc} +ENDPROC(fixup_smp) #include "head-common.S"
arch/arm/kernel/module.c +21 -1
@@ -22,6 +22,7 @@#include <asm/pgtable.h> #include <asm/sections.h> +#include <asm/smp_plat.h> #include <asm/unwind.h> #ifdef CONFIG_XIP_KERNEL
@@ -268,12 +269,28 @@ struct mod_unwind_map {const Elf_Shdr *txt_sec; }; +static const Elf_Shdr *find_mod_section (const Elf32_Ehdr *hdr, +const Elf_Shdr *sechdrs,const char *name) +{ +const Elf_Shdr *s, *se; +const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; + +for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) +if (strcmp (name, secstrs + s->sh_name) ==0 ) +return s; + +return NULL ; +} + +extern void fixup_smp (const void *,unsigned long ); +int module_finalize (const Elf32_Ehdr *hdr,const Elf_Shdr *sechdrs,struct module *mod) { +const Elf_Shdr *__maybe_unused s =NULL ;#ifdef CONFIG_ARM_UNWIND const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; -const Elf_Shdr *s, *sechdrs_end = sechdrs + hdr->e_shnum; +const Elf_Shdr *sechdrs_end = sechdrs + hdr->e_shnum;struct mod_unwind_map maps[ARM_SEC_MAX ];int i;
@@ -315,6 +332,9 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, maps[i].txt_sec->sh_addr, maps[i].txt_sec->sh_size);#endif + s =find_mod_section (hdr, sechdrs,".alt.smp.init" ); +if (s && !is_smp ()) +fixup_smp ((void *)s->sh_addr, s->sh_size);return 0 ; }
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 18 lines · Russell King - ARM Linux
Quoted 9 lines · Dave Martin
Quoted 8 lines · Dave Martin
Hi, apologies-- didn't see my mail for a bit.
I get the problem with this tree and config (which builds with
SMP_ON_UPandTHUMB2_KERNELfor omap3/4):Tree:
git://git.linaro.org/people/dmart/linux-2.6-arm.git
dirty/arm/omap-thumb2+merged
Config: http://people.linaro.org/~dmart/arm_omap-thumb2+v2_configThanks for the config.
Quoted 4 lines
Note that this tree contains some extra patches (though I believe nothing is there which should cause the problem), and does not contain everything from rmk/devel -- so it's possible this has been fixed in the meantime or no longer occurs for some other reason...
Quoted 6 lines
No need - I now have some modules which contain SMP alternatives, so we do need to fix the module loader for this, and keep the SMP alternatives replacement code around. ?It's not worth eliminating the code as if we include an informative
printk()to say why we're refusing to load the module, the string would be larger than the code it eliminates. ?So, I think we need to merge the patch below to avoid run-time problems.
I thought the problem was not caused by removal of the fixup code, but rather by the removal of code referenced by fixups?
Cheers
---Dave
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 15 lines · Dave Martin
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines · Dave Martin
Note that this tree contains some extra patches (though I believe nothing is there which should cause the problem), and does not contain everything from rmk/devel -- so it's possible this has been fixed in the meantime or no longer occurs for some other reason...
Quoted 6 lines
No need - I now have some modules which contain SMP alternatives, so we do need to fix the module loader for this, and keep the SMP alternatives replacement code around. ?It's not worth eliminating the code as if we include an informative
printk()to say why we're refusing to load the module, the string would be larger than the code it eliminates. ?So, I think we need to merge the patch below to avoid run-time problems.
Quoted 2 lines
I thought the problem was not caused by removal of the fixup code, but rather by the removal of code referenced by fixups?
It is. But:
arm-linux-objdump -h sound/core/snd-timer.ko
sound/core/snd-timer.ko: file format elf32-littlearm
Sections:
Idx Name Size VMA LMA File off Algn 0 .text 00002f34 00000000 00000000 00000034 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
1 .exit.text 00000070 00000000 00000000 00002f68 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
2 .init.text 000001b4 00000000 00000000 00002fd8 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
3 .rodata 000000bc 00000000 00000000 0000318c 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
4 .rodata.str1.1 00000156 00000000 00000000 00003248 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .alt.smp.init 00000088 00000000 00000000 0000339e 2**0
CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
...
Here we have a module which contains the spin_unlock assembly, which contains the SMP alternatives. If we insert that into a kernel also built with SMP alternatives support, but which is running on a UP system, we need to run these fixups as well when the module is loaded.
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 41 lines · Russell King - ARM Linux
Quoted 15 lines · Dave Martin
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines · Dave Martin
Note that this tree contains some extra patches (though I believe nothing is there which should cause the problem), and does not contain everything from rmk/devel -- so it's possible this has been fixed in the meantime or no longer occurs for some other reason...
Quoted 6 lines
No need - I now have some modules which contain SMP alternatives, so we do need to fix the module loader for this, and keep the SMP alternatives replacement code around. ?It's not worth eliminating the code as if we include an informative
printk()to say why we're refusing to load the module, the string would be larger than the code it eliminates. ?So, I think we need to merge the patch below to avoid run-time problems.Quoted 2 lines
I thought the problem was not caused by removal of the fixup code, but rather by the removal of code referenced by fixups?
It is. ?But:
arm-linux-objdump -h
sound/core/snd-timer.ko
sound/core/snd-timer.ko: ? ? file format elf32-littlearmSections:
Idx Name ? ? ? ? ?Size ? ? ?VMA ? ? ? LMA ? ? ? File off ?Algn ?0 .text ? ? ? ?00002f34?00000000 ?00000000 ?00000034 ?2**2 ? ? ? ? ? ? ? ? ?CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE ?1 .exit.text ? ?00000070 ?00000000 ?00000000 ?00002f68 ?2**2 ? ? ? ? ? ? ? ? ?CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE ?2 .init.text ? ?000001b4 ?00000000 ?00000000 ?00002fd8 ?2**2 ? ? ? ? ? ? ? ? ?CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE ?3 .rodata ? ? ?000000bc?00000000 ?00000000 ?0000318c ?2**2 ? ? ? ? ? ? ? ? ?CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA ?4 .rodata.str1.1 00000156 ?00000000 ?00000000 ?00003248 ?2**0 ? ? ? ? ? ? ? ? ?CONTENTS, ALLOC, LOAD, READONLY, DATA ?5 .alt.smp.init 00000088 ?00000000 ?00000000 ?0000339e ?2**0 ? ? ? ? ? ? ? ? ?CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
...
Quoted 5 lines
Here we have a module which contains the
spin_unlockassembly, which contains the SMP alternatives. ?If we insert that into a kernel also built with SMP alternatives support, but which is running on a UP system, we need to run these fixups as well when the module is loaded.
Agreed -- actually, I suspected we might need to support this. But I don't think solving this problem (= keeping the fixup implementation in memory and enhancing the module loader) solved the fixups-referencing-sections-discarded-from-vmlinux problem. These seem to be two separate issues. I am filing to understand something?
Cheers
---Dave
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 5 lines · Dave Martin
Agreed -- actually, I suspected we might need to support this. But I don't think solving this problem (= keeping the fixup implementation in memory and enhancing the module loader) solved the fixups-referencing-sections-discarded-from-vmlinux problem. These seem to be two separate issues. I am filing to understand something?
They are separate, but related issues. They both ultimately have the same cause - the placement of the spinlock code inline rather than out of line, resulting in fixups appearing all over the place rather than just in kernel/spinlock.o.
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 11 lines · Russell King - ARM Linux
Quoted 5 lines · Dave Martin
Agreed -- actually, I suspected we might need to support this. ?But I don't think solving this problem (= keeping the fixup implementation in memory and enhancing the module loader) solved the fixups-referencing-sections-discarded-from-vmlinux problem. ?These seem to be two separate issues. ?I am filing to understand something?
They are separate, but related issues. ?They both ultimately have the same cause - the placement of the spinlock code inline rather than out of line, resulting in fixups appearing all over the place rather than just in
kernel/spinlock.o.
I guess what I want to understand is whether I (or someone) still need(s) to sort out the vmlinux.lds issue.
If we're keeping inline spinlocks (I currently assume "yes"), then the vmlinux.lds issue still needs fixing. Is that correct? However, if we get rid of inline spinlocks we won't have the problem, though there may be some performance impact -- hard to judge how significant.
Apologies if I'm being dense here...
Cheers
---Dave
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 9 lines · Dave Martin
Quoted 7 lines · Russell King - ARM Linux
Quoted 5 lines · Dave Martin
Agreed -- actually, I suspected we might need to support this. ?But I don't think solving this problem (= keeping the fixup implementation in memory and enhancing the module loader) solved the fixups-referencing-sections-discarded-from-vmlinux problem. ?These seem to be two separate issues. ?I am filing to understand something?
Quoted 7 lines
Quoted 4 lines
They are separate, but related issues. ?They both ultimately have the same cause - the placement of the spinlock code inline rather than out of line, resulting in fixups appearing all over the place rather than just in
kernel/spinlock.o.I guess what I want to understand is whether I (or someone) still need(s) to sort out the
vmlinux.ldsissue.
Yes we do - if you build your kernel you should find that your link fails because of discarded sections being referenced.
Quoted 4 lines
If we're keeping inline spinlocks (I currently assume "yes"), then the
vmlinux.ldsissue still needs fixing. Is that correct? However, if we get rid of inline spinlocks we won't have the problem, though there may be some performance impact -- hard to judge how significant.
I don't see that we can get rid of inline spinlocks - it's controlled by stuff external to the arch.
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 15 lines · Russell King - ARM Linux
Quoted 14 lines · Dave Martin
Quoted 11 lines · Russell King - ARM Linux
Quoted 5 lines · Dave Martin
Agreed -- actually, I suspected we might need to support this. ?But I don't think solving this problem (= keeping the fixup implementation in memory and enhancing the module loader) solved the fixups-referencing-sections-discarded-from-vmlinux problem. ?These seem to be two separate issues. ?I am filing to understand something?
They are separate, but related issues. ?They both ultimately have the same cause - the placement of the spinlock code inline rather than out of line, resulting in fixups appearing all over the place rather than just in
kernel/spinlock.o.
Quoted 5 lines
Quoted 2 lines
I guess what I want to understand is whether I (or someone) still need(s) to sort out the
vmlinux.ldsissue.Yes we do - if you build your kernel you should find that your link fails because of discarded sections being referenced.
Yep -- I'm still applying my original patch to work around that, but it sounds like I need to tidy that up. Can you elaborate on what you meant by defining a "KEEP_EXIT" macro to handle this?
Quoted 8 lines
Quoted 5 lines
If we're keeping inline spinlocks (I currently assume "yes"), then the
vmlinux.ldsissue still needs fixing. ?Is that correct? ?However, if we get rid of inline spinlocks we won't have the problem, though there may be some performance impact -- hard to judge how significant.I don't see that we can get rid of inline spinlocks - it's controlled by stuff external to the arch.
That's fine -- just wanted to make sure I had the right understanding.
Cheers
---Dave
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Quoted 3 lines · Dave Martin
Yep -- I'm still applying my original patch to work around that, but it sounds like I need to tidy that up. Can you elaborate on what you meant by defining a "
KEEP_EXIT" macro to handle this?
arch/arm/kernel/vmlinux.lds.S +9 -0
@@ -21,6 +21,12 @@ #define ARM_CPU_KEEP(x) #endif +#if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK) +#define ARM_EXIT_KEEP(x) x +#else +#define ARM_EXIT_KEEP(x) +#endif + OUTPUT_ARCH(arm) ENTRY(stext)
@@ -43,6 +49,7 @@ SECTIONS _sinittext = .; HEAD_TEXT INIT_TEXT + ARM_EXIT_KEEP(EXIT_TEXT) _einittext = .; ARM_CPU_DISCARD(PROC_INFO) __arch_info_begin = .;
@@ -71,6 +78,7 @@ SECTIONS #ifndef CONFIG_XIP_KERNEL __init_begin = _stext; INIT_DATA + ARM_EXIT_KEEP(EXIT_DATA) #endif }
@@ -166,6 +174,7 @@ SECTIONS . = ALIGN(PAGE_SIZE); __init_begin = .; INIT_DATA + ARM_EXIT_KEEP(EXIT_DATA) . = ALIGN(PAGE_SIZE); __init_end = .; #endif
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Hi,
On Fri, Feb 11, 2011 at 04:32:47PM +0000, Russell King - ARM Linux wrote:
[...]
Quoted 42 lines
arch/arm/kernel/vmlinux.lds.S +9
-0@@ -21,6 +21,12 @@ #define ARM_CPU_KEEP(x) #endif +#if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK) +#define ARM_EXIT_KEEP(x) x +#else +#define ARM_EXIT_KEEP(x) +#endif + OUTPUT_ARCH(arm) ENTRY(stext)@@ -43,6 +49,7 @@ SECTIONS _sinittext = .; HEAD_TEXT INIT_TEXT + ARM_EXIT_KEEP(EXIT_TEXT) _einittext = .; ARM_CPU_DISCARD(PROC_INFO) __arch_info_begin = .;@@ -71,6 +78,7 @@ SECTIONS #ifndef CONFIG_XIP_KERNEL __init_begin = _stext; INIT_DATA + ARM_EXIT_KEEP(EXIT_DATA) #endif }@@ -166,6 +174,7 @@ SECTIONS . = ALIGN(PAGE_SIZE); __init_begin = .; INIT_DATA + ARM_EXIT_KEEP(EXIT_DATA) . = ALIGN(PAGE_SIZE); __init_end = .; #endif
Quoted 4 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
This works for me in a case known to fail without the patch.
I still don't quite understand the intricacies of how vmlinux is laid out, but the patch looks sensible.
Do you need anything more from me on this? If not, I will throw away my patch and replace it with yours.
Cheers
---Dave
PATCH 1/1 ARM: Avoid discarding sections that might have SMP_ON_UP fixups
Hi Russell,
Quoted 55 lines · Dave Martin
Hi,
On Fri, Feb 11, 2011 at 04:32:47PM +0000, Russell King - ARM Linux wrote:
[...]
Quoted 42 lines
arch/arm/kernel/vmlinux.lds.S +0
-0@@ -21,6 +21,12 @@ ?#define ARM_CPU_KEEP(x)?#endif
arch/arm/kernel/vmlinux.lds.S +6
-0+#if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK) +#define ARM_EXIT_KEEP(x) ? ? x +#else +#define ARM_EXIT_KEEP(x) +#endif +?OUTPUT_ARCH(arm)
?ENTRY(stext)arch/arm/kernel/vmlinux.lds.S +0
-0@@ -43,6 +49,7 @@ SECTIONS ? ? ? ? ? ? ? _sinittext = .;? ? ? ? ? ? ? ? ? ? ?
HEAD_TEXT
? ? ? ? ? ? ? ? ? ? ?INIT_TEXT
+ ? ? ? ? ? ? ? ? ? ?ARM_EXIT_KEEP(EXIT_TEXT)
? ? ? ? ? ? ?_einittext= .;
? ? ? ? ? ? ?ARM_CPU_DISCARD(PROC_INFO)
? ? ? ? ? ? ?__arch_info_begin= .;arch/arm/kernel/vmlinux.lds.S +0
-0@@ -71,6 +78,7 @@ SECTIONS?#ifndef
CONFIG_XIP_KERNEL
? ? ? ? ? ? ?__init_begin=_stext;
? ? ? ? ? ? ?INIT_DATA
+ ? ? ? ? ? ?ARM_EXIT_KEEP(EXIT_DATA)
?#endif
? ? ? }arch/arm/kernel/vmlinux.lds.S +0
-0@@ -166,6 +174,7 @@ SECTIONS ? ? ? ? ? ? ? . = ALIGN(PAGE_SIZE); ? ? ? ? ? ? ? __init_begin = .;? ? ? ? ? ? ?
INIT_DATA
+ ? ? ? ? ? ?ARM_EXIT_KEEP(EXIT_DATA)
? ? ? ? ? ? ? . =ALIGN(PAGE_SIZE);
? ? ? ? ? ? ?__init_end= .;
?#endifQuoted 4 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernelThis works for me in a case known to fail without the patch.
Quoted 7 lines
Tested-by Dave Martin <[email protected]>I still don't quite understand the intricacies of how vmlinux is laid out, but the patch looks sensible.
Do you need anything more from me on this? ?If not, I will throw away my patch and replace it with yours.
Are you still intending to merge your patch here? I don't see it anywhere yet, but I would like to get rid of my hack (which is rather messy).
Cheers
---Dave
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
In reply to Dave MartinQuoted 19 lines · Dave Martin
Quoted 9 lines · Nicolas Pitre
Quoted 5 lines · Russell King - ARM Linux
Hmm, actually it looks like you can end up with configurations where the spinlocks are inlined.
That means we'll have to get rid of the link-time discarding of the .exit sections, and discard them along with the .init sections.
... but only when
CONFIG_SMP_ON_UP=y.Do we need to consider any other discarded sections? In
vmlinux.lds, I have:/* Default discards */
/DISCARD/ : { *(.exit.text) *(.cpuexit.text) *(.memexit.text)
*(.exit.data) *(.cpuexit.data) *(.cpuexit.rodata) *(.memexit.data) *(.memexit.rodata) *(.exitcall.exit) *(.discard) *(.discard.*) }
Quoted 8 lines
Alternatively, I wonder .alt.smp.init could make weak references instead of normal references: then if the referenced section is discarded, the reference will revert to 0 and the fixup code can ignore it (at the expense of wasting a bit of space in the fixup table ... but it's no worse than the current situation). From experimentation, it seems this doesn't work if the referenced symbol is defined in the same file, since the linker resolves the reference before discarding sections, but maybe there's a way around it...
That's strange. How can the linker resolve the reference if the referenced symbol is not in the same section as the reference source? What happens when the final link completes?
Nicolas
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 10 lines · Nicolas Pitre
Quoted 8 lines · Dave Martin
Alternatively, I wonder .alt.smp.init could make weak references instead of normal references: then if the referenced section is discarded, the reference will revert to 0 and the fixup code can ignore it (at the expense of wasting a bit of space in the fixup table ... but it's no worse than the current situation). From experimentation, it seems this doesn't work if the referenced symbol is defined in the same file, since the linker resolves the reference before discarding sections, but maybe there's a way around it...
Quoted 3 lines
That's strange. How can the linker resolve the reference if the referenced symbol is not in the same section as the reference source? What happens when the final link completes?
$ cat t.s .section ".exit.text", "ax", %progbits mov r0, r0 a: mov r0, r0
.pushsection ".alt.smp.fixup", "a" .weak a .long a mov r0, r1 .popsection $ arm-linux-as -o t.o t.s $ arm-linux-nm t.o 00000004 W a $ arm-linux-objdump -Dr t.o
Disassembly of section .exit.text:
00000000 <a-0x4>:
0: e1a00000 nop (mov r0,r0)
00000004 <a>:
4: e1a00000 .word 0xe1a00000
Disassembly of section .alt.smp.fixup:
00000000 <.alt.smp.fixup>:
0: 00000000 .word 0x00000000
0: R_ARM_ABS32 a
4: e1a00001 mov r0, r1
which when linked with:
SECTIONS
{
.alt.smp.init : { *(.alt.smp.init) }
/DISCARD/ : { *(.exit.text) }
}$ arm-linux-ld -T t.lds -r -o t.oo t.o `a' referenced in section `.alt.smp.fixup' of t.o: defined in discarded section `.exit.text' of t.o
So I don't think weak symbols work like we want them to.
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 51 lines · Russell King - ARM Linux
Quoted 10 lines · Nicolas Pitre
Quoted 8 lines · Dave Martin
Alternatively, I wonder .alt.smp.init could make weak references instead of normal references: then if the referenced section is discarded, the reference will revert to 0 and the fixup code can ignore it (at the expense of wasting a bit of space in the fixup table ... but it's no worse than the current situation). ?From experimentation, it seems this doesn't work if the referenced symbol is defined in the same file, since the linker resolves the reference before discarding sections, but maybe there's a way around it...
Quoted 3 lines
That's strange. ?How can the linker resolve the reference if the referenced symbol is not in the same section as the reference source? What happens when the final link completes?
$ cat t.s ? ? ? ?.section ".exit.text", "ax", %progbits ? ? ? ?mov ? ? r0, r0 a: ? ? ?mov ? ? r0, r0? ? ? ?.pushsection ".alt.smp.fixup", "a"
? ? ? ?.weak ? a
? ? ? ?.long ? a
? ? ? ?mov ? ? r0, r1
? ? ? ?.popsection$ arm-linux-as -o t.o t.s $ arm-linux-nm t.o 00000004 W a $ arm-linux-objdump -Dr t.oDisassembly of section .exit.text:
00000000 <a-0x4>:
? 0: ?e1a00000? ? ? ?nop ? ? ? ? ? ? ? ? ? ? (mov r0,r0)00000004 <a>:
? 4: ?e1a00000? ? ? ?.word ?0xe1a00000Disassembly of section .alt.smp.fixup:
00000000 <.alt.smp.fixup>:
? 0: ? 00000000 ? ? ? ?.word ?0x00000000
? ? ? ? ? ? ? ? ? ? ? ?0:R_ARM_ABS32?a
? 4: ?e1a00001? ? ? ?mov ? ? r0, r1which when linked with:
SECTIONS
{
? ? ? ?.alt.smp.init : { *(.alt.smp.init) }
Quoted 8 lines
? ? ? ?/DISCARD/ : { *(.exit.text) }
}$ arm-linux-ld -T t.lds -r -o t.oo t.o `a' referenced in section `.alt.smp.fixup' of t.o: defined in discarded section `.exit.text' of t.oSo I don't think weak symbols work like we want them to.
That was the conclusion I came to also ... the linker seems to resolve references in each object before discarding sections, so the weak reference has already become concrete and section discard breaks it.
---Dave
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 8 lines · Dave Martin
Quoted 2 lines · Russell King - ARM Linux
So I don't think weak symbols work like we want them to.
That was the conclusion I came to also ... the linker seems to resolve references in each object before discarding sections, so the weak reference has already become concrete and section discard breaks it.
Well, I must add to the chorus.
And it seems to be impossible to obtain the name of the currently active section from gas either, which would have made the conditional omission of the fixup possible, or similar.
Bummer.
Nicolas
PATCH 3/14 ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h
Quoted 13 lines · Nicolas Pitre
Quoted 8 lines · Dave Martin
Quoted 2 lines · Russell King - ARM Linux
So I don't think weak symbols work like we want them to.
That was the conclusion I came to also ... the linker seems to resolve references in each object before discarding sections, so the weak reference has already become concrete and section discard breaks it.
Well, I must add to the chorus.
Quoted 8 lines
And it seems to be impossible to obtain the name of the currently active section from gas either, which would have made the conditional omission of the fixup possible, or similar.
Bummer.
Nicolas
I've achieved this sort of thing in the past by wrapping the assmbler. It's not pretty though, and it's unlikely anyone would be interested in merging such a thing...
The example below is really a hack and won't work well in the the presence of macros or conditional assembler. However, since gcc output contains none of either except in inline asm, you can get away with a surprising amount.
If it needed to be robust this could mostly be implemented in assembler macros, but the need to hook things like .section, combined with gas's refusal to redefine existing directives, means that you would have a run a script over the input first, to translate .section and friends into something you can hook.
And implementing anything non-trivial with assembler macros, while almost always possible (unlike crippled cpp) gets very painful and confusing...
Cheers
---Dave
$ chmod +x gasfilter filt-as $ PATH=$PWD:$PATH $ arm-linux-gnueabi-gcc -wrapper $PWD/filt-as -c tst.s $ arm-linux-gnueabi-objdump -dsh tst.o
tst.o: file format elf32-littlearm
Sections:
Idx Name Size VMA LMA File off Algn 0 .text 00000004 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 00000000 00000000 00000038 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 00000038 2**0
ALLOC
3 .text.fixup 00000004 00000000 00000000 00000038 2**0
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
4 .text.init 00000008 00000000 00000000 0000003c 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
5 .text.init.fixup 00000004 00000000 00000000 00000044 2**0
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
6 .ARM.attributes 00000021 00000000 00000000 00000048 2**0
CONTENTS, READONLY
Contents of section .text:
0000 00f020e3 .. .
Contents of section .text.fixup:
0000 00000000 ....
Contents of section .text.init:
0000 00f020e3 00f020e3 .. ... .
Contents of section .text.init.fixup:
0000 04000000 ....
Contents of section .ARM.attributes:
0000 41200000 00616561 62690001 16000000 A ...aeabi...... 0010 05372d41 00060a07 41080109 020a042c .7-A....A......, 0020 01 .
Disassembly of section .text:
00000000 <main>:
0: e320f000 nop {0}
Disassembly of section .text.fixup:
00000000 <.text.fixup>:
0: 00000000 .word 0x00000000
Disassembly of section .text.init:
00000000 <init>:
0: e320f000 nop {0}
00000004 <__fixup_3>:
4: e320f000 nop {0}
Disassembly of section .text.init.fixup:
00000000 <.text.init.fixup>:
0: 00000004 .word 0x00000004
filt-as +30 -0
@@ -0,0 +1,30 @@ +#!/bin/sh + +case "$1" in + as|*/as|*-as) ;; + *) exec "$@" +esac + +real_as=$1 +shift + +out=a.out +in=- + +while [ $# != 0 ]; do + case "$1" in + -o) + out=$2 + shift + ;; + *.s) + in=$1 + ;; + *) + args=$args\ $1 + esac + shift +done + +gasfilter <"$in" \ +| "$real_as" $args -o "$out"
gasfilter +68 -0
68 lines not on this page · raw message
tst.s +23 -0
@@ -0,0 +1,23 @@ +.macro fixup + _fixup \@ +.endm + +.macro _fixup num +__fixup_\num : + .xpushsection fixup, "a" + .long __fixup_\num + .xpopsection +.endm + +.globl main +main: + fixup + nop + +.section .text.init, "ax" +.globl init +init: nop + + fixup + nop +
PATCH 4/14 ARM: v6k: introduce CPU_V6K option
In reply to Russell King - ARM LinuxIntroduce a CPU_V6K configuration option for platforms to select if they have a V6K CPU core. This allows us to identify whether we need to support ARMv6 CPUs without the V6K SMP extensions at build time.
Currently CPU_V6K is just an alias for CPU_V6, and all places which reference CPU_V6 are replaced by (CPU_V6 || CPU_V6K).
Select CPU_V6K from platforms which are known to be V6K-only.
--- arch/arm/Kconfig | 10 ++++---- arch/arm/Makefile | 1 + arch/arm/boot/compressed/head.S | 2 +- arch/arm/boot/compressed/misc.c | 2 +- arch/arm/include/asm/cacheflush.h | 5 ++- arch/arm/include/asm/proc-fns.h | 2 +- arch/arm/kernel/debug.S | 2 +- arch/arm/kernel/perf_event_v6.c | 4 +- arch/arm/mm/Kconfig | 47 +++++++++++++++++++++++------------- arch/arm/mm/Makefile | 1 + arch/arm/mm/mmap.c | 2 +- 11 files changed, 47 insertions(+), 31 deletions(-)
arch/arm/Kconfig +5 -5
@@ -24,7 +24,7 @@ config ARM select HAVE_PERF_EVENTS select PERF_USE_VMALLOC select HAVE_REGS_AND_STACK_ACCESS_API - select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V7)) + select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)) select HAVE_C_RECORDMCOUNT select HAVE_GENERIC_HARDIRQS select HAVE_SPARSE_IRQ
@@ -1048,7 +1048,7 @@ config XSCALE_PMU default y config CPU_HAS_PMU - depends on (CPU_V6 || CPU_V7 || XSCALE_PMU) && \ + depends on (CPU_V6 || CPU_V6K || CPU_V7 || XSCALE_PMU) && \ (!ARCH_OMAP3 || OMAP3_EMU) default y bool
@@ -1064,7 +1064,7 @@ endif config ARM_ERRATA_411920 bool "ARM errata: Invalidation of the Instruction Cache operation can fail" - depends on CPU_V6 + depends on CPU_V6 || CPU_V6K help Invalidation of the Instruction Cache operation can fail. This erratum is present in 1136 (before r1p4), 1156 and 1176.
@@ -1361,7 +1361,7 @@ config HZ config THUMB2_KERNEL bool "Compile the kernel in Thumb-2 mode (EXPERIMENTAL)" - depends on CPU_V7 && !CPU_V6 && EXPERIMENTAL + depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL select AEABI select ARM_ASM_UNIFIED help
@@ -1852,7 +1852,7 @@ config FPE_FASTFPE config VFP bool "VFP-format floating point maths" - depends on CPU_V6 || CPU_ARM926T || CPU_V7 || CPU_FEROCEON + depends on CPU_V6 || CPU_V6K || CPU_ARM926T || CPU_V7 || CPU_FEROCEON help Say Y to include VFP support code in the kernel. This is needed if your hardware includes a VFP unit.
arch/arm/Makefile +1 -0
@@ -89,6 +89,7 @@ tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale) tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) +tune-$(CONFIG_CPU_V6K) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) ifeq ($(CONFIG_AEABI),y) CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork
arch/arm/boot/compressed/head.S +1 -1
@@ -21,7 +21,7 @@ #if defined(CONFIG_DEBUG_ICEDCC) -#ifdef CONFIG_CPU_V6 +#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) .macro loadsp, rb, tmp .endm .macro writeb, ch, rb
arch/arm/boot/compressed/misc.c +1 -1
@@ -36,7 +36,7 @@ extern void error(char *x); #ifdef CONFIG_DEBUG_ICEDCC -#ifdef CONFIG_CPU_V6 +#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) static void icedcc_putc(int ch) {
arch/arm/include/asm/cacheflush.h +3 -2
@@ -116,7 +116,7 @@# define MULTI_CACHE 1#endif -#if defined(CONFIG_CPU_V6 ) +#if defined(CONFIG_CPU_V6 ) || defined(CONFIG_CPU_V6K )//# ifdef _CACHE # define MULTI_CACHE 1//# else
@@ -316,7 +316,8 @@ extern void copy_to_user_page(struct vm_area_struct *, struct page *,* Optimized __flush_icache_all for the common cases. Note that UP ARMv7 * will fall through to use __flush_icache_all_generic. */ -#if (defined(CONFIG_CPU_V7 ) && defined(CONFIG_CPU_V6 )) || \ +#if (defined(CONFIG_CPU_V7 ) && \ + (defined(CONFIG_CPU_V6 ) || defined(CONFIG_CPU_V6K ))) || \ defined(CONFIG_SMP_ON_UP )#define __flush_icache_preferred __cpuc_flush_icache_all#elif __LINUX_ARM_ARCH__ >=7 && defined(CONFIG_SMP )
arch/arm/include/asm/proc-fns.h +1 -1
@@ -231,7 +231,7 @@# endif #endif -#ifdef CONFIG_CPU_V6 +#if defined(CONFIG_CPU_V6 ) || defined(CONFIG_CPU_V6K )# ifdef CPU_NAME # undef MULTI_CPU# define MULTI_CPU
arch/arm/kernel/debug.S +1 -1
@@ -25,7 +25,7 @@ .macro addruart, rp, rv .endm -#if defined(CONFIG_CPU_V6) +#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) .macro senduart, rd, rx mcr p14, 0, \rd, c0, c5, 0
arch/arm/kernel/perf_event_v6.c +2 -2
@@ -30,7 +30,7 @@* enable the interrupt. */ -#ifdef CONFIG_CPU_V6 +#if defined(CONFIG_CPU_V6 ) || defined(CONFIG_CPU_V6K )enum armv6_perf_types {ARMV6_PERFCTR_ICACHE_MISS =0x0 , ARMV6_PERFCTR_IBUF_STALL = 0x1,
@@ -669,4 +669,4 @@ static const struct arm_pmu *__init armv6mpcore_pmu_init(void) {return NULL ; } -#endif /* CONFIG_CPU_V6 */ +#endif /* CONFIG_CPU_V6 || CONFIG_CPU_V6K */
arch/arm/mm/Kconfig +30 -17
97 lines not on this page · raw message
arch/arm/mm/Makefile +1 -0
@@ -90,6 +90,7 @@ obj-$(CONFIG_CPU_XSC3) += proc-xsc3.o obj-$(CONFIG_CPU_MOHAWK) += proc-mohawk.o obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o obj-$(CONFIG_CPU_V6) += proc-v6.o +obj-$(CONFIG_CPU_V6K) += proc-v6.o obj-$(CONFIG_CPU_V7) += proc-v7.o AFLAGS_proc-v6.o :=-Wa,-march=armv6
arch/arm/mm/mmap.c +1 -1
@@ -31,7 +31,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,struct mm_struct *mm = current->mm;struct vm_area_struct *vma;unsigned long start_addr; -#ifdef CONFIG_CPU_V6 +#if defined(CONFIG_CPU_V6 ) || defined(CONFIG_CPU_V6K )unsigned int cache_type;int do_align =0 , aliasing =0 ;
Signature · 1 line
1.6.2.5
PATCH 4/14 ARM: v6k: introduce CPU_V6K option
Quoted 10 lines · Russell King - ARM Linux
Introduce a
CPU_V6Kconfiguration option for platforms to select if they have a V6K CPU core. This allows us to identify whether we need to support ARMv6 CPUs without the V6K SMP extensions at build time.Currently
CPU_V6Kis just an alias forCPU_V6, and all places which referenceCPU_V6are replaced by (CPU_V6||CPU_V6K).Select
CPU_V6Kfrom platforms which are known to be V6K-only.Signed-off-by Russell King <[email protected]>
PATCH 4/14 ARM: v6k: introduce CPU_V6K option
In reply to Russell King - ARM LinuxHi Russell,
Quoted 10 lines
Introduce a
CPU_V6Kconfiguration option for platforms to select if they have a V6K CPU core. This allows us to identify whether we need to support ARMv6 CPUs without the V6K SMP extensions at build time.Currently
CPU_V6Kis just an alias forCPU_V6, and all places which referenceCPU_V6are replaced by (CPU_V6||CPU_V6K).Select
CPU_V6Kfrom platforms which are known to be V6K-only.Signed-off-by Russell King <[email protected]>
[...]
Quoted 10 lines
arch/arm/Makefile +0
-0@@ -89,6 +89,7 @@ tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
+tune-$(CONFIG_CPU_V6K) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
Can we change the tune target to 1176 for v6k?
arch/arm/Makefile
Quoted 7 lines
config
DMA_CACHE_RWFOarch/arm/Makefile +1
-1bool "Enable read/write for ownership DMA cache maintenance" - depends on CPU_V6 && SMP + depends on (CPU_V6 || CPU_V6K) && SMP default y help The Snoop Control Unit on ARM11MPCore does not detect the
Can we lose the CPU_V6 check here? RWFO is only required for 11MPCore so I think we just need to check CPU_V6K && SMP.
Will
PATCH 4/14 ARM: v6k: introduce CPU_V6K option
Quoted 4 lines · Will Deacon
Quoted 4 lines
arch/arm/Makefile +0
-0
Quoted 8 lines
Quoted 6 lines
arch/arm/Makefile +0
-0@@ -89,6 +89,7 @@ tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
+tune-$(CONFIG_CPU_V6K) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)Can we change the tune target to 1176 for v6k?
At first glance, GCC doesn't seem to do anything different for 1136 vs 1176:
ARM_CORE("arm1136j-s", arm1136js, 6J, FL_LDSCHED, 9e)
ARM_CORE("arm1176jz-s", arm1176jzs, 6ZK, FL_LDSCHED, 9e)
ARM_CORE("mpcore", mpcore, 6K, FL_LDSCHED | FL_VFPV2, 9e)The 6J/6K are used to set the __ARM_ARCH_xx__ definition. Everything else between 1136 and 1176 is the same. In fact, looking at the .md files, switching to 1176 may make things worse:
arm1020e.md: (and (eq_attr "tune" "arm1020e,arm1022e")
arm1020e.md: (const (if_then_else (and (eq_attr "tune" "arm1020e,arm1022e")
arm1026ejs.md: (and (eq_attr "tune" "arm1026ejs")
arm1136jfs.md: (and (eq_attr "tune" "arm1136js,arm1136jfs")
arm926ejs.md: (and (eq_attr "tune" "arm926ejs")
arm-cores.def: If you update this table, you must update the "tune" attribute
in
arm.h: {"tune", "%{!mcpu=*:%{!mtune=*:-mtune=%(VALUE)}}" }, \
arm.md: (eq_attr "tune" "arm926ejs,arm1020e,arm1026ejs,arm1136js,arm1136jfs,cortexa8")
arm.md: (eq_attr "tune" "!arm1020e,arm1022e,cortexa8"))
arm-tune.md:(define_attr "tune"
cortex-a8.md: (and (eq_attr "tune" "cortexa8")
cortex-a8-neon.md: (and (eq_attr "tune" "cortexa8")Nothing seems to tune for arm1176, but it looks like quite a bit of work has been put into providing gcc with a pipeline description for arm1136.
The above is from gcc 4.3.5 sources.
Quoted 10 lines
arch/arm/Makefile
Quoted 7 lines
config
DMA_CACHE_RWFOarch/arm/Makefile +1
-1bool "Enable read/write for ownership DMA cache maintenance" - depends on CPU_V6 && SMP + depends on (CPU_V6 || CPU_V6K) && SMP default y help The Snoop Control Unit on ARM11MPCore does not detect theCan we lose the
CPU_V6check here? RWFO is only required for 11MPCore so I think we just need to checkCPU_V6K&& SMP.
I'd rather not in this patch - this patch adds CPU_V6K as an alias for CPU_V6 - so eveywhere which referenced CPU_V6 becomes (CPU_V6 || CPU_V6K). We could remove it in a later patch though.
PATCH 4/14 ARM: v6k: introduce CPU_V6K option
Quoted 3 lines · Russell King - ARM Linux
I'd rather not in this patch - this patch adds
CPU_V6Kas an alias forCPU_V6- so eveywhere which referencedCPU_V6becomes (CPU_V6||CPU_V6K). We could remove it in a later patch though.
Here's a follow-up patch to do that. There's a few other things which could do with updating now that we have CPU_Vx* straightened out. I've also recently noticed that the v6 and v7 cache stuff doesn't use the direct-call optimization (see commented out bits in cacheflush.h).
That was because my original V6 support used the block cache operations, which had to be run-time tested for presence, and so modified the global cpu_cache methods directly. As the block cache stuff was dropped, we should re-enable this optimization.
That said, I'd rather not add too much to this series as I think it needs to go into mainline ASAP - and probably stable as well, even though it's on the large side - once properly and fully tested.
8<----
Subject: [PATCH] ARM: v6k: DMA_CACHE_RWFO isn't appropriate for non-v6k CPUs
Limit DMA_CACHE_RWFO to only v6k SMP CPUs - V6 CPUs aren't SMP capable, so the read/write for ownership work-around doesn't apply to them.
--- arch/arm/mm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mm/Kconfig +1 -1
@@ -775,7 +775,7 @@ config NEEDS_SYSCALL_FOR_CMPXCHG config DMA_CACHE_RWFO bool "Enable read/write for ownership DMA cache maintenance" - depends on (CPU_V6 || CPU_V6K) && SMP + depends on CPU_V6K && SMP default y help The Snoop Control Unit on ARM11MPCore does not detect the
Signature · 1 line
1.6.2.5
PATCH 4/14 ARM: v6k: introduce CPU_V6K option
Quoted 10 lines · Russell King - ARM Linux
Quoted 3 lines
I'd rather not in this patch - this patch adds
CPU_V6Kas an alias forCPU_V6- so eveywhere which referencedCPU_V6becomes (CPU_V6||CPU_V6K). We could remove it in a later patch though.Here's a follow-up patch to do that. There's a few other things which could do with updating now that we have CPU_Vx* straightened out. I've also recently noticed that the v6 and v7 cache stuff doesn't use the direct-call optimization (see commented out bits in
cacheflush.h).
Quoted 8 lines
That was because my original V6 support used the block cache operations, which had to be run-time tested for presence, and so modified the global
cpu_cachemethods directly. As the block cache stuff was dropped, we should re-enable this optimization.That said, I'd rather not add too much to this series as I think it needs to go into mainline ASAP - and probably stable as well, even though it's on the large side - once properly and fully tested.
Understood. Pruning the Kconfig is an optimisation and can be done once the initial bulk is merged.
Quoted 15 lines
Subject: [PATCH] ARM: v6k:
DMA_CACHE_RWFOisn't appropriate for non-v6k CPUsLimit
DMA_CACHE_RWFOto only v6k SMP CPUs - V6 CPUs aren't SMP capable, so the read/write for ownership work-around doesn't apply to them.Signed-off-by Russell King <[email protected]>--- arch/arm/mm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/mm/Kconfig +0
-0
arch/arm/mm/Kconfig config NEEDS_SYSCALL_FOR_CMPXCHG · line 781
Quoted 8 lines
arch/arm/mm/Kconfig +1
-1@@ -775,7 +775,7 @@ config NEEDS_SYSCALL_FOR_CMPXCHG config DMA_CACHE_RWFO bool "Enable read/write for ownership DMA cache maintenance" - depends on (CPU_V6 || CPU_V6K) && SMP + depends on CPU_V6K && SMP default y help The Snoop Control Unit on ARM11MPCore does not detect the
Looks good to me:
Will
RE: [PATCH 04/14] ARM: v6k: introduce CPU_V6K option
In reply to Russell King - ARM LinuxQuoted 10 lines · Russell King - ARM Linux
Quoted 3 lines
I'd rather not in this patch - this patch adds
CPU_V6Kas an alias forCPU_V6- so eveywhere which referencedCPU_V6becomes (CPU_V6||CPU_V6K). We could remove it in a later patch though.Here's a follow-up patch to do that. There's a few other things which could do with updating now that we have CPU_Vx* straightened out. I've also recently noticed that the v6 and v7 cache stuff doesn't use the direct-call optimization (see commented out bits in
cacheflush.h).
Quoted 8 lines
That was because my original V6 support used the block cache operations, which had to be run-time tested for presence, and so modified the global
cpu_cachemethods directly. As the block cache stuff was dropped, we should re-enable this optimization.That said, I'd rather not add too much to this series as I think it needs to go into mainline ASAP - and probably stable as well, even though it's on the large side - once properly and fully tested.
Understood. Pruning the Kconfig is an optimisation and can be done once the initial bulk is merged.
Quoted 15 lines
Subject: [PATCH] ARM: v6k:
DMA_CACHE_RWFOisn't appropriate for non-v6k CPUsLimit
DMA_CACHE_RWFOto only v6k SMP CPUs - V6 CPUs aren't SMP capable, so the read/write for ownership work-around doesn't apply to them.Signed-off-by Russell King <[email protected]>--- arch/arm/mm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/mm/Kconfig +0
-0
arch/arm/mm/Kconfig config NEEDS_SYSCALL_FOR_CMPXCHG · line 781
Quoted 8 lines
arch/arm/mm/Kconfig +1
-1@@ -775,7 +775,7 @@ config NEEDS_SYSCALL_FOR_CMPXCHG config DMA_CACHE_RWFO bool "Enable read/write for ownership DMA cache maintenance" - depends on (CPU_V6 || CPU_V6K) && SMP + depends on CPU_V6K && SMP default y help The Snoop Control Unit on ARM11MPCore does not detect the
Looks good to me:
Will
RE: [PATCH 04/14] ARM: v6k: introduce CPU_V6K option
In reply to Russell King - ARM LinuxHi Russell,
Quoted 10 lines
Introduce a
CPU_V6Kconfiguration option for platforms to select if they have a V6K CPU core. This allows us to identify whether we need to support ARMv6 CPUs without the V6K SMP extensions at build time.Currently
CPU_V6Kis just an alias forCPU_V6, and all places which referenceCPU_V6are replaced by (CPU_V6||CPU_V6K).Select
CPU_V6Kfrom platforms which are known to be V6K-only.Signed-off-by Russell King <[email protected]>
[...]
Quoted 10 lines
arch/arm/Makefile +0
-0@@ -89,6 +89,7 @@ tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
+tune-$(CONFIG_CPU_V6K) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
Can we change the tune target to 1176 for v6k?
arch/arm/Makefile
Quoted 7 lines
config
DMA_CACHE_RWFOarch/arm/Makefile +1
-1bool "Enable read/write for ownership DMA cache maintenance" - depends on CPU_V6 && SMP + depends on (CPU_V6 || CPU_V6K) && SMP default y help The Snoop Control Unit on ARM11MPCore does not detect the
Can we lose the CPU_V6 check here? RWFO is only required for 11MPCore so I think we just need to check CPU_V6K && SMP.
Will
PATCH 5/14 ARM: v6k: Realview EB 11MPCore and PB11MPCore use V6K architecture CPUs
In reply to Russell King - ARM LinuxMake Realview EB ARM11MPCore and PB11MPCore select the new V6K CPU option.
--- arch/arm/mach-realview/Kconfig | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-realview/Kconfig +3 -2
@@ -17,7 +17,7 @@ config REALVIEW_EB_A9MP config REALVIEW_EB_ARM11MP bool "Support ARM11MPCore tile" depends on MACH_REALVIEW_EB - select CPU_V6 + select CPU_V6K select ARCH_HAS_BARRIERS if SMP help Enable support for the ARM11MPCore tile on the Realview platform.
@@ -33,7 +33,7 @@ config REALVIEW_EB_ARM11MP_REVB config MACH_REALVIEW_PB11MP bool "Support RealView/PB11MPCore platform" - select CPU_V6 + select CPU_V6K select ARM_GIC select HAVE_PATA_PLATFORM select ARCH_HAS_BARRIERS if SMP
@@ -42,6 +42,7 @@ config MACH_REALVIEW_PB11MP PB11MPCore is a platform with an on-board ARM11MPCore and has support for PCI-E and Compact Flash. +# ARMv6 CPU without K extensions, but does have the new exclusive ops config MACH_REALVIEW_PB1176 bool "Support RealView/PB1176 platform" select CPU_V6
Signature · 1 line
1.6.2.5
PATCH 6/14 ARM: v6k: Dove platforms use V6K architecture CPUs
In reply to Russell King - ARM LinuxMake Dove platforms select the new V6K CPU option.
--- arch/arm/mach-dove/Kconfig | 4 +++- arch/arm/mm/Kconfig | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)
arch/arm/mach-dove/Kconfig +3 -1
@@ -5,12 +5,14 @@ menu "Marvell Dove Implementations" config MACH_DOVE_DB bool "Marvell DB-MV88AP510 Development Board" select I2C_BOARDINFO + select CPU_V6K help Say 'Y' here if you want your kernel to support the Marvell DB-MV88AP510 Development Board. - config MACH_CM_A510 +config MACH_CM_A510 bool "CompuLab CM-A510 Board" + select CPU_V6K help Say 'Y' here if you want your kernel to support the CompuLab CM-A510 Board.
arch/arm/mm/Kconfig +2 -2
@@ -390,7 +390,7 @@ config CPU_PJ4 # ARMv6 config CPU_V6 - bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || ARCH_DOVE + bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX select CPU_32v6 select CPU_ABRT_EV6 select CPU_PABRT_V6
@@ -403,7 +403,7 @@ config CPU_V6 # ARMv6k config CPU_V6K - bool "Support ARM V6K processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || ARCH_DOVE + bool "Support ARM V6K processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX select CPU_32v6 select CPU_32v6K if !ARCH_OMAP2 select CPU_ABRT_EV6
Signature · 1 line
1.6.2.5
PATCH 6/14 ARM: v6k: Dove platforms use V6K architecture CPUs
Quoted 3 lines · Russell King - ARM Linux
Make Dove platforms select the new V6K CPU option.
Signed-off-by Russell King <[email protected]>
I'd suggest doing the following instead of attaching the selection to each individual board target , as the whole Dove architecture is V6K:
arch/arm/Kconfig +1 -0
@@ -457,6 +457,7 @@ config ARCH_IXP4XX config ARCH_DOVE bool "Marvell Dove" + select CPU_V6K select PCI select ARCH_REQUIRE_GPIOLIB select GENERIC_CLOCKEVENTS
arch/arm/mach-dove/Kconfig +0 -2
@@ -5,14 +5,12 @@ menu "Marvell Dove Implementations" config MACH_DOVE_DB bool "Marvell DB-MV88AP510 Development Board" select I2C_BOARDINFO - select CPU_V6K help Say 'Y' here if you want your kernel to support the Marvell DB-MV88AP510 Development Board. config MACH_CM_A510 bool "CompuLab CM-A510 Board" - select CPU_V6K help Say 'Y' here if you want your kernel to support the CompuLab CM-A510 Board.
Quoted 56 lines
--- arch/arm/mach-dove/Kconfig | 4 +++- arch/arm/mm/Kconfig | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)arch/arm/mach-dove/Kconfig +3
-1@@ -5,12 +5,14 @@ menu "Marvell Dove Implementations" config MACH_DOVE_DB bool "Marvell DB-MV88AP510 Development Board" select I2C_BOARDINFO + select CPU_V6K help Say 'Y' here if you want your kernel to support the Marvell DB-MV88AP510 Development Board. - config MACH_CM_A510 +config MACH_CM_A510 bool "CompuLab CM-A510 Board" + select CPU_V6K help Say 'Y' here if you want your kernel to support the CompuLab CM-A510 Board.arch/arm/mm/Kconfig +2
-2@@ -390,7 +390,7 @@ config CPU_PJ4 # ARMv6 config CPU_V6 - bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || ARCH_DOVE + bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX select CPU_32v6 select CPU_ABRT_EV6 select CPU_PABRT_V6@@ -403,7 +403,7 @@ config CPU_V6 # ARMv6k config CPU_V6K - bool "Support ARM V6K processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || ARCH_DOVE + bool "Support ARM V6K processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX select CPU_32v6 select CPU_32v6K if !ARCH_OMAP2 select CPU_ABRT_EV6Signature · 7 lines
1.6.2.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 7/14 ARM: v6k: select clear exclusive code seqences according to V6 variants
In reply to Russell King - ARM LinuxIf CONFIG_CPU_V6 is enabled, then the kernel must support ARMv6 CPUs which don't have the V6K extensions implemented. Always use the dummy store-exclusive method to ensure that the exclusive monitors are cleared.
If CONFIG_CPU_V6 is not set, but CONFIG_CPU_32v6K is enabled, then we have the K extensions available on all CPUs we're building support for, so we can use the new clear-exclusive instruction.
--- arch/arm/kernel/entry-header.S | 14 +++++++------- arch/arm/mm/abort-ev6.S | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/kernel/entry-header.S +7 -7
@@ -76,13 +76,13 @@ #ifndef CONFIG_THUMB2_KERNEL .macro svc_exit, rpsr msr spsr_cxsf, \rpsr -#if defined(CONFIG_CPU_32v6K) - clrex @ clear the exclusive monitor - ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr -#elif defined (CONFIG_CPU_V6) +#if defined(CONFIG_CPU_V6) ldr r0, [sp] strex r1, r2, [sp] @ clear the exclusive monitor ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr +#elif defined(CONFIG_CPU_32v6K) + clrex @ clear the exclusive monitor + ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr #else ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr #endif
@@ -92,10 +92,10 @@ ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr ldr lr, [sp, #\offset + S_PC]! @ get pc msr spsr_cxsf, r1 @ save in spsr_svc -#if defined(CONFIG_CPU_32v6K) - clrex @ clear the exclusive monitor -#elif defined (CONFIG_CPU_V6) +#if defined(CONFIG_CPU_V6) strex r1, r2, [sp] @ clear the exclusive monitor +#elif defined(CONFIG_CPU_32v6K) + clrex @ clear the exclusive monitor #endif .if \fast ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
arch/arm/mm/abort-ev6.S +3 -3
@@ -20,11 +20,11 @@ */ .align 5 ENTRY(v6_early_abort) -#ifdef CONFIG_CPU_32v6K - clrex -#else +#ifdef CONFIG_CPU_V6 sub r1, sp, #4 @ Get unused stack location strex r0, r1, [r1] @ Clear the exclusive monitor +#elif defined(CONFIG_CPU_32v6K) + clrex #endif mrc p15, 0, r1, c5, c0, 0 @ get FSR mrc p15, 0, r0, c6, c0, 0 @ get FAR
Signature · 1 line
1.6.2.5
PATCH 7/14 ARM: v6k: select clear exclusive code seqences according to V6 variants
Quoted 10 lines · Russell King - ARM Linux
If
CONFIG_CPU_V6is enabled, then the kernel must support ARMv6 CPUs which don't have the V6K extensions implemented. Always use the dummy store-exclusive method to ensure that the exclusive monitors are cleared.If
CONFIG_CPU_V6is not set, butCONFIG_CPU_32v6Kis enabled, then we have the K extensions available on all CPUs we're building support for, so we can use the new clear-exclusive instruction.Signed-off-by Russell King <[email protected]>
PATCH 8/14 ARM: v6k: select cmpxchg code sequences according to V6 variants
In reply to Russell King - ARM LinuxIf CONFIG_CPU_V6 is enabled, we must avoid the byte/halfword/doubleword exclusive operations, which aren't implemented before V6K. Use the generic versions (or omit them) instead.
If CONFIG_CPU_V6 is not set, but CONFIG_CPU_32v6K is enabled, we have the K extnesions, so use these new instructions.
--- arch/arm/include/asm/system.h | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-)
arch/arm/include/asm/system.h +9 -8
@@ -347,6 +347,7 @@ void cpu_idle_wait(void);#include <asm-generic/cmpxchg-local.h> #if __LINUX_ARM_ARCH__ <6 +/* min ARCH < ARMv6 */ #ifdef CONFIG_SMP #error "SMP is not supported on this platform"
@@ -365,7 +366,7 @@ void cpu_idle_wait(void);#include <asm-generic/cmpxchg.h> #endif -#else /* __LINUX_ARM_ARCH__ >= 6 */ +#else /* min ARCH >= ARMv6 */ extern void __bad_cmpxchg (volatile void *ptr,int size);
@@ -379,7 +380,7 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,unsigned long oldval, res;switch (size) { -#ifdef CONFIG_CPU_32v6K +#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */ case 1: do { asm volatile("@ __cmpxchg1\n"
@@ -404,7 +405,7 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, : "memory", "cc"); } while (res);break ; -#endif /* CONFIG_CPU_32v6K */ +#endif case 4 : do { asm volatile("@ __cmpxchg4\n"
@@ -450,12 +451,12 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,unsigned long ret;switch (size) { -#ifndef CONFIG_CPU_32v6K +#ifdef CONFIG_CPU_V6 /* min ARCH == ARMv6 */ case 1 :case 2 : ret =__cmpxchg_local_generic (ptr, old, new, size);break ; -#endif /* !CONFIG_CPU_32v6K */ +#endif default : ret =__cmpxchg (ptr, old, new, size); }
@@ -469,7 +470,7 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr, (unsigned long)(n), \ sizeof(*(ptr)))) -#ifdef CONFIG_CPU_32v6K +#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */ /* * Note : ARMv7-M (currently unsupported by Linux) does not support
@@ -524,11 +525,11 @@ static inline unsigned long long __cmpxchg64_mb(volatile void *ptr, (unsigned long long)(o), \ (unsigned long long)(n))) -#else /* !CONFIG_CPU_32v6K */ +#else /* min ARCH = ARMv6 */ #define cmpxchg64_local (ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) -#endif /* CONFIG_CPU_32v6K */ +#endif #endif /* __LINUX_ARM_ARCH__ >= 6 */
Signature · 1 line
1.6.2.5
PATCH 8/14 ARM: v6k: select cmpxchg code sequences according to V6 variants
Quoted 8 lines · Russell King - ARM Linux
If
CONFIG_CPU_V6is enabled, we must avoid the byte/halfword/doubleword exclusive operations, which aren't implemented before V6K. Use the generic versions (or omit them) instead.If
CONFIG_CPU_V6is not set, butCONFIG_CPU_32v6Kis enabled, we have the K extnesions, so use these new instructions.Signed-off-by Russell King <[email protected]>
PATCH 9/14 ARM: v6k: select generic atomic64 code according to V6 variants
In reply to Russell King - ARM LinuxIf CONFIG_CPU_V6 is enabled, avoid using the double-word exclusive instructions in the kernel's atomic implementations as these are not supported. Fall back to the generic spinlock code instead.
--- arch/arm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/Kconfig +1 -1
@@ -7,7 +7,7 @@ config ARM select HAVE_MEMBLOCK select RTC_LIB select SYS_SUPPORTS_APM_EMULATION - select GENERIC_ATOMIC64 if (!CPU_32v6K || !AEABI) + select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) select HAVE_OPROFILE if (HAVE_PERF_EVENTS) select HAVE_ARCH_KGDB select HAVE_KPROBES if (!XIP_KERNEL && !THUMB2_KERNEL)
Signature · 1 line
1.6.2.5
PATCH 9/14 ARM: v6k: select generic atomic64 code according to V6 variants
Quoted 5 lines · Russell King - ARM Linux
If
CONFIG_CPU_V6is enabled, avoid using the double-word exclusive instructions in the kernel's atomic implementations as these are not supported. Fall back to the generic spinlock code instead.Signed-off-by Russell King <[email protected]>
PATCH 9/14 ARM: v6k: select generic atomic64 code according to V6 variants
In reply to Russell King - ARM LinuxQuoted 14 lines
If
CONFIG_CPU_V6is enabled, avoid using the double-word exclusive instructions in the kernel's atomic implementations as these are not supported. Fall back to the generic spinlock code instead.Signed-off-by Russell King <[email protected]>--- arch/arm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/Kconfig +0
-0
arch/arm/Kconfig config ARM · line 13
Quoted 8 lines
arch/arm/Kconfig +1
-1@@ -7,7 +7,7 @@ config ARM select HAVE_MEMBLOCK select RTC_LIB select SYS_SUPPORTS_APM_EMULATION - select GENERIC_ATOMIC64 if (!CPU_32v6K || !AEABI) + select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) select HAVE_OPROFILE if (HAVE_PERF_EVENTS) select HAVE_ARCH_KGDB select HAVE_KPROBES if (!XIP_KERNEL && !THUMB2_KERNEL)
Thanks,
Will
RE: [PATCH 09/14] ARM: v6k: select generic atomic64 code according to V6 variants
In reply to Russell King - ARM LinuxQuoted 14 lines
If
CONFIG_CPU_V6is enabled, avoid using the double-word exclusive instructions in the kernel's atomic implementations as these are not supported. Fall back to the generic spinlock code instead.Signed-off-by Russell King <[email protected]>--- arch/arm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/Kconfig +0
-0
arch/arm/Kconfig config ARM · line 13
Quoted 8 lines
arch/arm/Kconfig +1
-1@@ -7,7 +7,7 @@ config ARM select HAVE_MEMBLOCK select RTC_LIB select SYS_SUPPORTS_APM_EMULATION - select GENERIC_ATOMIC64 if (!CPU_32v6K || !AEABI) + select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) select HAVE_OPROFILE if (HAVE_PERF_EVENTS) select HAVE_ARCH_KGDB select HAVE_KPROBES if (!XIP_KERNEL && !THUMB2_KERNEL)
Thanks,
Will
PATCH 10/14 ARM: v6k: select TLS register code according to V6 variants
In reply to Russell King - ARM LinuxIf CONFIG_CPU_V6 is enabled, we may or may not have the TLS register. Use the conditional code which copes with this variability. Otherwise, if CONFIG_CPU_32v6K is set, we know we have the TLS register on all supported CPUs, so use it unconditionally.
--- arch/arm/include/asm/tls.h | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)
arch/arm/include/asm/tls.h +5 -6
@@ -28,15 +28,14 @@#define tls_emu 1#define has_tls_reg 1#define set_tls set_tls_none -#elif __LINUX_ARM_ARCH__ >=7 || \ - (__LINUX_ARM_ARCH__ ==6 && defined(CONFIG_CPU_32v6K)) -#define tls_emu 0 -#define has_tls_reg 1 -#define set_tls set_tls_v6k -#elif __LINUX_ARM_ARCH__ ==6 +#elif defined(CONFIG_CPU_V6 )#define tls_emu 0#define has_tls_reg (elf_hwcap & HWCAP_TLS)#define set_tls set_tls_v6 +#elif defined(CONFIG_CPU_32v6K) +#define tls_emu 0 +#define has_tls_reg 1 +#define set_tls set_tls_v6k#else #define tls_emu 0#define has_tls_reg 0
Signature · 1 line
1.6.2.5
PATCH 10/14 ARM: v6k: select TLS register code according to V6 variants
Quoted 6 lines · Russell King - ARM Linux
If
CONFIG_CPU_V6is enabled, we may or may not have the TLS register. Use the conditional code which copes with this variability. Otherwise, ifCONFIG_CPU_32v6Kis set, we know we have the TLS register on all supported CPUs, so use it unconditionally.Signed-off-by Russell King <[email protected]>
Note: this is becoming a bit confusing and prone to mistake when we have:
CONFIG_CPU_V6 CONFIG_CPU_V6K CONFIG_CPU_32v6 CONFIG_CPU_32v6K
I don't know what to suggest for a less similar naming scheme between the CPU design and the allowed instruction set though.
Quoted 38 lines
--- arch/arm/include/asm/tls.h | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)arch/arm/include/asm/tls.h +5
-6@@ -28,15 +28,14 @@#define tls_emu 1#define has_tls_reg 1#define set_tls set_tls_none -#elif __LINUX_ARM_ARCH__ >=7 || \ - (__LINUX_ARM_ARCH__ ==6 && defined(CONFIG_CPU_32v6K)) -#define tls_emu 0 -#define has_tls_reg 1 -#define set_tls set_tls_v6k -#elif __LINUX_ARM_ARCH__ ==6 +#elif defined(CONFIG_CPU_V6 )#define tls_emu 0#define has_tls_reg (elf_hwcap & HWCAP_TLS)#define set_tls set_tls_v6 +#elif defined(CONFIG_CPU_32v6K) +#define tls_emu 0 +#define has_tls_reg 1 +#define set_tls set_tls_v6k#else #define tls_emu 0#define has_tls_reg 0Signature · 7 lines
1.6.2.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 10/14 ARM: v6k: select TLS register code according to V6 variants
Quoted 7 lines · Nicolas Pitre
Quoted 5 lines · Russell King - ARM Linux
If
CONFIG_CPU_V6is enabled, we may or may not have the TLS register. Use the conditional code which copes with this variability. Otherwise, ifCONFIG_CPU_32v6Kis set, we know we have the TLS register on all supported CPUs, so use it unconditionally.
Quoted 5 lines
Quoted 1 line
Signed-off-by Russell King <[email protected]>Acked-by Nicolas Pitre <[email protected]>Note: this is becoming a bit confusing and prone to mistake when we have:
Agreed.
Quoted 7 lines
CONFIG_CPU_V6 CONFIG_CPU_V6K CONFIG_CPU_32v6 CONFIG_CPU_32v6KI don't know what to suggest for a less similar naming scheme between the CPU design and the allowed instruction set though.
It's best to consider CONFIG_CPU_V6/CONFIG_CPU_V6K/CONFIG_CPU_V7 in the same light as CONFIG_CPU_ARM926T etc. It selects a specific CPU core (or family of CPU cores) rather than an architecture - the fact that it _may_ tie up with an architecture is incidental.
The CPU_32vX selects the major architecture version. 32vX<letter> selects sub-options of the architecture.
It may be better at some point to get rid of the CPU_32v* and replace them with CPU_ARCH_V* instead, which makes it clear that these ones definitely refer to the architecture versions.
The last point while we're here is I don't think it helps to have the conditionals spread between the Kconfig files and this file - I'd much rather see them all in Kconfig so we can see exactly how we end up with each option (TLS_EMUL, TLS_V6, TLS_V6K) in one place.
PATCH 10/14 ARM: v6k: select TLS register code according to V6 variants
Quoted 3 lines · Russell King - ARM Linux
It may be better at some point to get rid of the CPU_32v* and replace them with CPU_ARCH_V* instead, which makes it clear that these ones definitely refer to the architecture versions.
Last point on this is that I think we want to sanitize PJ4.
If we think about CPU_V7 as being the selection of ARM CPUs which are V7 architectures, CPU_PJ4 should be a separate config option selecting all the same symbols which CPU_V7 does - and that should also select proc-v7.S for building.
I'm not sure it makes sense to have (eg) the V7 perf events available on PJ4 or the ARM errata for their V7 cores?
Does PJ4 have VFPv3? Is Neon available on PJ4? What about the DCC debug registers?
etc.
PATCH 10/14 ARM: v6k: select TLS register code according to V6 variants
Quoted 12 lines · Russell King - ARM Linux
Quoted 3 lines · Russell King - ARM Linux
It may be better at some point to get rid of the CPU_32v* and replace them with CPU_ARCH_V* instead, which makes it clear that these ones definitely refer to the architecture versions.
Last point on this is that I think we want to sanitize PJ4.
If we think about
CPU_V7as being the selection of ARM CPUs which are V7 architectures,CPU_PJ4should be a separate config option selecting all the same symbols whichCPU_V7does - and that should also selectproc-v7.Sfor building.
Quoted 5 lines
I'm not sure it makes sense to have (eg) the V7 perf events available on PJ4 or the ARM errata for their V7 cores?
Does PJ4 have VFPv3? Is Neon available on PJ4? What about the DCC debug registers?
Agreed. Actually this is also the same issue with Dove.
Nicolas
PATCH 10/14 ARM: v6k: select TLS register code according to V6 variants
In reply to Russell King - ARM LinuxQuoted 5 lines · Russell King - ARM Linux
Quoted 1 line · Nicolas Pitre
Note: this is becoming a bit confusing and prone to mistake when we have:
Agreed.
Quoted 8 lines
Quoted 4 lines
CONFIG_CPU_V6 CONFIG_CPU_V6K CONFIG_CPU_32v6 CONFIG_CPU_32v6KIt may be better at some point to get rid of the CPU_32v* and replace them with CPU_ARCH_V* instead, which makes it clear that these ones definitely refer to the architecture versions.
Agreed.
Quoted 4 lines
The last point while we're here is I don't think it helps to have the conditionals spread between the
Kconfigfiles and this file - I'd much rather see them all inKconfigso we can see exactly how we end up with each option (TLS_EMUL,TLS_V6,TLS_V6K) in one place.
Yep, although I'd suggest a naming based on the implementation and not on the CPU level it happens to be used on. Something like TLS_EMUL, TLS_HW_REG, TLS_HIVECT, where (TLS_HW_REG && TLS_HIVECT) would correspond to the current 'if defined(CONFIG_CPU_V6)' case. That would allow for an eventual combination of CONFIG_CPU_32v5 and CONFIG_CPU_32v6 (that would be Kirkwood + Dove).
Nicolas
PATCH 10/14 ARM: v6k: select TLS register code according to V6 variants
In reply to Nicolas PitreQuoted 10 lines · Nicolas Pitre
Quoted 6 lines · Russell King - ARM Linux
If
CONFIG_CPU_V6is enabled, we may or may not have the TLS register. Use the conditional code which copes with this variability. Otherwise, ifCONFIG_CPU_32v6Kis set, we know we have the TLS register on all supported CPUs, so use it unconditionally.Signed-off-by Russell King <[email protected]>Acked-by Nicolas Pitre <[email protected]>
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
In reply to Russell King - ARM LinuxRather than turning off CPU domain switching when the build architecture includes ARMv6K, thereby causing problems for ARMv6-supporting kernels, turn it on when it's required to support a CPU architecture.
--- arch/arm/mm/Kconfig | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mm/Kconfig +5 -2
@@ -435,25 +435,30 @@ config CPU_32v3 bool select TLS_REG_EMUL if SMP || !MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP + select CPU_USE_DOMAINS if MMU config CPU_32v4 bool select TLS_REG_EMUL if SMP || !MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP + select CPU_USE_DOMAINS if MMU config CPU_32v4T bool select TLS_REG_EMUL if SMP || !MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP + select CPU_USE_DOMAINS if MMU config CPU_32v5 bool select TLS_REG_EMUL if SMP || !MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP + select CPU_USE_DOMAINS if MMU config CPU_32v6 bool select TLS_REG_EMUL if !CPU_32v6K && !MMU + select CPU_USE_DOMAINS if CPU_V6 && MMU config CPU_32v6K bool "Support ARM V6K processor extensions" if !SMP
@@ -620,8 +625,6 @@ config CPU_CP15_MPU config CPU_USE_DOMAINS bool - depends on MMU - default y if !CPU_32v6K help This option enables or disables the use of domain switching via the set_fs() function.
Signature · 1 line
1.6.2.5
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 5 lines · Russell King - ARM Linux
Rather than turning off CPU domain switching when the build architecture includes ARMv6K, thereby causing problems for ARMv6-supporting kernels, turn it on when it's required to support a CPU architecture.
Signed-off-by Russell King <[email protected]>
Quoted 57 lines
--- arch/arm/mm/Kconfig | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)arch/arm/mm/Kconfig +5
-2@@ -435,25 +435,30 @@ config CPU_32v3 bool select TLS_REG_EMUL if SMP || !MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP + select CPU_USE_DOMAINS if MMU config CPU_32v4 bool select TLS_REG_EMUL if SMP || !MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP + select CPU_USE_DOMAINS if MMU config CPU_32v4T bool select TLS_REG_EMUL if SMP || !MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP + select CPU_USE_DOMAINS if MMU config CPU_32v5 bool select TLS_REG_EMUL if SMP || !MMU select NEEDS_SYSCALL_FOR_CMPXCHG if SMP + select CPU_USE_DOMAINS if MMU config CPU_32v6 bool select TLS_REG_EMUL if !CPU_32v6K && !MMU + select CPU_USE_DOMAINS if CPU_V6 && MMU config CPU_32v6K bool "Support ARM V6K processor extensions" if !SMP@@ -620,8 +625,6 @@ config CPU_CP15_MPU config CPU_USE_DOMAINS bool - depends on MMU - default y if !CPU_32v6K help This option enables or disables the use of domain switching via the set_fs() function.Signature · 7 lines
1.6.2.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 9 lines · Nicolas Pitre
Quoted 5 lines · Russell King - ARM Linux
Rather than turning off CPU domain switching when the build architecture includes ARMv6K, thereby causing problems for ARMv6-supporting kernels, turn it on when it's required to support a CPU architecture.
Signed-off-by Russell King <[email protected]>Acked-by Nicolas Pitre <[email protected]>
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
In reply to Russell King - ARM LinuxQuoted 3 lines · Russell King - ARM Linux
Rather than turning off CPU domain switching when the build architecture includes ARMv6K, thereby causing problems for ARMv6-supporting kernels, turn it on when it's required to support a CPU architecture.
(sorry, I'm well behind list messages, didn't reply earlier)
Does it mean that we get domains enabled even for ARMv7 when ARMv6 is built in the same kernel? The side effect is that user read-only addresses are writable by the kernel and SWP emulation no longer works.
Signature · 1 line
Catalin
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 6 lines · Catalin Marinas
Quoted 3 lines · Russell King - ARM Linux
Rather than turning off CPU domain switching when the build architecture includes ARMv6K, thereby causing problems for ARMv6-supporting kernels, turn it on when it's required to support a CPU architecture.
Quoted 6 lines
(sorry, I'm well behind list messages, didn't reply earlier)
Does it mean that we get domains enabled even for ARMv7 when ARMv6 is built in the same kernel? The side effect is that user read-only addresses are writable by the kernel and SWP emulation no longer works.
It means that a kernel with ARMv6 through to ARMv7 will have CPU domains enabled. So maybe we want:
config CPU_32v6
select CPU_USE_DOMAINS if !CPU_V6K && MMU
instead?
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 14 lines · Russell King - ARM Linux
Quoted 6 lines · Catalin Marinas
Quoted 3 lines · Russell King - ARM Linux
Rather than turning off CPU domain switching when the build architecture includes ARMv6K, thereby causing problems for ARMv6-supporting kernels, turn it on when it's required to support a CPU architecture.
Quoted 6 lines
(sorry, I'm well behind list messages, didn't reply earlier)
Does it mean that we get domains enabled even for ARMv7 when ARMv6 is built in the same kernel? The side effect is that user read-only addresses are writable by the kernel and SWP emulation no longer works.
Quoted 7 lines
It means that a kernel with ARMv6 through to ARMv7 will have CPU domains enabled. So maybe we want:
config
CPU_32v6select CPU_USE_DOMAINS if !CPU_V6K && MMUinstead?
Does this mean that we could still configure a kernel to run on CPU_V6 with domains disabled? The vectors page becomes read-only and setting the TLS would fail.
My point is that we may want SWP_EMULATE disabled (or depending on ! CPU_USE_DOMAINS). With domains enabled every read-only user page is writeable by the kernel. This has the side-effect that SWP emulation using LDREX/STREX breaks COW.
We could change early_trap_init() to always use the vectors_page rather than the high mapping and determine at run-time (patch the code) whether set_pte_ext sets R/W kernel permissions for RO user pages.
Signature · 1 line
Catalin
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 3 lines · Catalin Marinas
Does this mean that we could still configure a kernel to run on
CPU_V6with domains disabled? The vectors page becomes read-only and setting the TLS would fail.
Yes it will, so that's not acceptable either.
Quoted 4 lines
My point is that we may want
SWP_EMULATEdisabled (or depending on !CPU_USE_DOMAINS). With domains enabled every read-only user page is writeable by the kernel. This has the side-effect that SWP emulation using LDREX/STREX breaks COW.
Yes, and maybe we should instead just enable the SWP instruction by default on ARMv7, and if SWP emulation is built, disable it at that point.
Quoted 3 lines
We could change
early_trap_init()to always use thevectors_pagerather than the high mapping and determine at run-time (patch the code) whetherset_pte_extsets R/W kernel permissions for RO user pages.
With aliasing caches that becomes much more difficult.
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Catalin Marinas
My point is that we may want
SWP_EMULATEdisabled (or depending on !CPU_USE_DOMAINS). With domains enabled every read-only user page is writeable by the kernel. This has the side-effect that SWP emulation using LDREX/STREX breaks COW.Yes, and maybe we should instead just enable the SWP instruction by default on ARMv7, and if SWP emulation is built, disable it at that point.
We can't disable the SWP instruction as long as domains are enabled (COW not working for in-kernel STREX).
On ARMv7 we could always force R/O kernel/user pages in set_pte_ext independent of the domains setting and have early_trap_init() use vectors_page() if cpu_architecture() >= 7 (this would actually catch ARM11MPCore as well because of the way we interpret CPUID).
Signature · 1 line
Catalin
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 10 lines · Catalin Marinas
Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Catalin Marinas
My point is that we may want
SWP_EMULATEdisabled (or depending on !CPU_USE_DOMAINS). With domains enabled every read-only user page is writeable by the kernel. This has the side-effect that SWP emulation using LDREX/STREX breaks COW.Yes, and maybe we should instead just enable the SWP instruction by default on ARMv7, and if SWP emulation is built, disable it at that point.
Quoted 7 lines
We can't disable the SWP instruction as long as domains are enabled (COW not working for in-kernel STREX).
On ARMv7 we could always force R/O kernel/user pages in
set_pte_extindependent of the domains setting and haveearly_trap_init()usevectors_page()ifcpu_architecture()>= 7 (this would actually catch ARM11MPCore as well because of the way we interpret CPUID).
What about a kernel covering ARMv6 too? Writing to an aliased mapping of the vectors page (as required for TLS emulation) will require additional cache maintainence on every context switch.
1. SWP emulation requires domain support turned off
2. We can't turn domains off without creating a vectors page alias
3. We can't have a separate vectors alias with ARMv6 VIPT aliasing caches without additional cache maintainence.
I don't think overloading the context switch with yet more conditionals based on yet more TLS combinations is a practical solution.
So, ARMv6 TLS emulation, and SWP emulation are incompatible with each other.
So either we don't have the SWP instruction at all on ARMv6+, or we have it enabled in hardware, or we don't and use the emulation where possible.
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 14 lines · Russell King - ARM Linux
Quoted 13 lines · Catalin Marinas
Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Catalin Marinas
My point is that we may want
SWP_EMULATEdisabled (or depending on !CPU_USE_DOMAINS). With domains enabled every read-only user page is writeable by the kernel. This has the side-effect that SWP emulation using LDREX/STREX breaks COW.Yes, and maybe we should instead just enable the SWP instruction by default on ARMv7, and if SWP emulation is built, disable it at that point.
We can't disable the SWP instruction as long as domains are enabled (COW not working for in-kernel STREX).
Quoted 8 lines
Quoted 4 lines
On ARMv7 we could always force R/O kernel/user pages in
set_pte_extindependent of the domains setting and haveearly_trap_init()usevectors_page()ifcpu_architecture()>= 7 (this would actually catch ARM11MPCore as well because of the way we interpret CPUID).What about a kernel covering ARMv6 too? Writing to an aliased mapping of the vectors page (as required for TLS emulation) will require additional cache maintainence on every context switch.
With your latest patches, do we use the TLS emulation on ARMv7 (UP) if v6 is compiled in? If that's the case, we may have a problem - I talked to the toolchain guys and it looks like code optimised for ARMv7 reads the TLS register directly without going through the kuser helper. So you may have people taking an Ubuntu filesystem (v7 only) and a pre-built OMAP image with TLS emulation even on Cortex-A8 and things won't work as expected.
On ARMv6 with domains enabled, cpu_v6_set_pte_ext() maps the vectors page as kernel R/W. The cpu_v7_set_pte_ext() could map it as kernel RO and use the TLS register. The only other place where this matters on ARMv7 is early_trap_init() but it's easily fixable on this architecture.
Quoted 1 line
1. SWP emulation requires domain support turned off
Not necessarily - it requires RO user pages to be kernel RO (though this feature came with the domains removal patch).
Quoted 1 line
2. We can't turn domains off without creating a vectors page alias
Correct.
Quoted 2 lines
3. We can't have a separate vectors alias with ARMv6 VIPT aliasing caches without additional cache maintainence.
Correct.
Quoted 2 lines
I don't think overloading the context switch with yet more conditionals based on yet more TLS combinations is a practical solution.
Yet another run-time code patching for the TLS, though it gets a bit complex. But we may need to solve it for the v7 filesystem case I mentioned above.
Quoted 2 lines
So, ARMv6 TLS emulation, and SWP emulation are incompatible with each other.
Yes.
Quoted 2 lines
So either we don't have the SWP instruction at all on ARMv6+, or we have it enabled in hardware, or we don't and use the emulation where possible.
If we can't sort out TLS register setting on v6+v7 kernels (I think we should), then we must have the SWP instruction enabled (no emulation). Which gets us back to the SWP_EMULATE depend on (CPU_V7 && !CPU_V6).
Signature · 1 line
Catalin
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 20 lines · Catalin Marinas
Quoted 19 lines · Russell King - ARM Linux
Quoted 17 lines · Catalin Marinas
Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Catalin Marinas
My point is that we may want
SWP_EMULATEdisabled (or depending on !CPU_USE_DOMAINS). With domains enabled every read-only user page is writeable by the kernel. This has the side-effect that SWP emulation using LDREX/STREX breaks COW.Yes, and maybe we should instead just enable the SWP instruction by default on ARMv7, and if SWP emulation is built, disable it at that point.
We can't disable the SWP instruction as long as domains are enabled (COW not working for in-kernel STREX).
On ARMv7 we could always force R/O kernel/user pages in
set_pte_extindependent of the domains setting and haveearly_trap_init()usevectors_page()ifcpu_architecture()>= 7 (this would actually catch ARM11MPCore as well because of the way we interpret CPUID).
Quoted 8 lines
Quoted 3 lines
What about a kernel covering ARMv6 too? Writing to an aliased mapping of the vectors page (as required for TLS emulation) will require additional cache maintainence on every context switch.
With your latest patches, do we use the TLS emulation on ARMv7 (UP) if v6 is compiled in? If that's the case, we may have a problem - I talked to the toolchain guys and it looks like code optimised for ARMv7 reads the TLS register directly without going through the kuser helper.
That's not a problem, because you wouldn't run ARMv7 optimized userspace on an ARMv6 CPU. That's not what this whole exercise is about.
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Catalin Marinas
With your latest patches, do we use the TLS emulation on ARMv7 (UP) if v6 is compiled in? If that's the case, we may have a problem - I talked to the toolchain guys and it looks like code optimised for ARMv7 reads the TLS register directly without going through the kuser helper.
That's not a problem, because you wouldn't run ARMv7 optimized userspace on an ARMv6 CPU. That's not what this whole exercise is about.
But you can run ARMv7 optimised userspace on ARMv7 CPU with a kernel image compiled for v6+v7.
Signature · 1 line
Catalin
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 7 lines · Catalin Marinas
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines · Catalin Marinas
With your latest patches, do we use the TLS emulation on ARMv7 (UP) if v6 is compiled in? If that's the case, we may have a problem - I talked to the toolchain guys and it looks like code optimised for ARMv7 reads the TLS register directly without going through the kuser helper.
Quoted 5 lines
Quoted 2 lines
That's not a problem, because you wouldn't run ARMv7 optimized userspace on an ARMv6 CPU. That's not what this whole exercise is about.
But you can run ARMv7 optimised userspace on ARMv7 CPU with a kernel image compiled for v6+v7.
Yes.
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
In reply to Catalin MarinasQuoted 24 lines · Catalin Marinas
Quoted 14 lines · Russell King - ARM Linux
Quoted 13 lines · Catalin Marinas
Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Catalin Marinas
My point is that we may want
SWP_EMULATEdisabled (or depending on !CPU_USE_DOMAINS). With domains enabled every read-only user page is writeable by the kernel. This has the side-effect that SWP emulation using LDREX/STREX breaks COW.Yes, and maybe we should instead just enable the SWP instruction by default on ARMv7, and if SWP emulation is built, disable it at that point.
We can't disable the SWP instruction as long as domains are enabled (COW not working for in-kernel STREX).
Quoted 8 lines
Quoted 4 lines
On ARMv7 we could always force R/O kernel/user pages in
set_pte_extindependent of the domains setting and haveearly_trap_init()usevectors_page()ifcpu_architecture()>= 7 (this would actually catch ARM11MPCore as well because of the way we interpret CPUID).What about a kernel covering ARMv6 too? Writing to an aliased mapping of the vectors page (as required for TLS emulation) will require additional cache maintainence on every context switch.
Quoted 7 lines
With your latest patches, do we use the TLS emulation on ARMv7 (UP) if v6 is compiled in? If that's the case, we may have a problem - I talked to the toolchain guys and it looks like code optimised for ARMv7 reads the TLS register directly without going through the kuser helper. So you may have people taking an Ubuntu filesystem (v7 only) and a pre-built OMAP image with TLS emulation even on Cortex-A8 and things won't work as expected.
You're really making a mountain out of TLS.
If we have a v6+v6k+v7 kernel, then the way the kernel TLS code is built, we will use the TLS register if that's available on the hardware. If it isn't, we will write the TLS value directly to virtual 0xffff0ffc.
So, a kernel built for v6+v6k+v7, when run on v7, will set the hardware TLS register, and your v7 optimized binaries which access the TLS register directly will work. Same for v6k.
For v6, you won't be able to run v7 optimized binaries on that hardware anyway, because it doesn't have the TLS register, and as such the instructions which access it will fault. That's true whether you have a v6 only kernel or a v6+v6k+v7 kernel.
What we're discussing has nothing at all to do with getting v7 binaries running on v6 hardware. That's just not going to happen.
Quoted 4 lines
On ARMv6 with domains enabled,
cpu_v6_set_pte_ext()maps the vectors page as kernel R/W. Thecpu_v7_set_pte_ext()could map it as kernel RO and use the TLS register. The only other place where this matters on ARMv7 isearly_trap_init()but it's easily fixable on this architecture.
That's pointless. There's no "could map the vectors page" - set_pte_ext() doesn't know what's the vectors page and what isn't. It's about how set_pte_ext() maps pages which are marked with just L_PTE_USER.
All L_PTE_USER pages get mapped as user read-only. Whether they get mapped SVC read-only or SVC read-write depends on whether we support domains. Without domains, they're mapped SVC read-write, and we need to use the ldrt/strt instructions. With domains, they're mapped SVC read-only, and we no longer need the ldrt/strt instructions.
Quoted 4 lines
Quoted 1 line
1. SWP emulation requires domain support turned off
Not necessarily - it requires RO user pages to be kernel RO (though this feature came with the domains removal patch).
Yes it does because without domains, we need user pages to be kernel read-only, which also makes the vectors page kernel read-only.
Quoted 7 lines
Quoted 1 line
2. We can't turn domains off without creating a vectors page alias
Correct.
Quoted 2 lines
3. We can't have a separate vectors alias with ARMv6 VIPT aliasing caches without additional cache maintainence.
Quoted 7 lines
Correct.
Quoted 2 lines
I don't think overloading the context switch with yet more conditionals based on yet more TLS combinations is a practical solution.
Yet another run-time code patching for the TLS, though it gets a bit complex.
It _already_ is complex. We don't need any more complexity there. Have a look in asm/tls.h to see that there's already four different cases we have to consider.
Quoted 1 line
But we may need to solve it for the v7 filesystem case I mentioned above.
No we don't. We're already selecting the code appropriately from four different cases for the supported processor types. We don't need "maybe the vectors page is read-only" introducing another two cases with complex cache flushing and location of the vectors page, and we certainly don't need this complication at runtime.
Quoted 3 lines
If we can't sort out TLS register setting on v6+v7 kernels (I think we should), then we must have the SWP instruction enabled (no emulation). Which gets us back to the
SWP_EMULATEdepend on (CPU_V7&& !CPU_V6).
That I think is the right solution. It sorts out the issues without additional overhead.
The only use which SWP_EMULATE gets us then is detecting userspace programs which use the SWP instruction - and that can only happen on a V7-only or v6k+v7 targetted kernel.
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 10 lines · Russell King - ARM Linux
Quoted 7 lines · Catalin Marinas
With your latest patches, do we use the TLS emulation on ARMv7 (UP) if v6 is compiled in? If that's the case, we may have a problem - I talked to the toolchain guys and it looks like code optimised for ARMv7 reads the TLS register directly without going through the kuser helper. So you may have people taking an Ubuntu filesystem (v7 only) and a pre-built OMAP image with TLS emulation even on Cortex-A8 and things won't work as expected.
You're really making a mountain out of TLS.
Not really, just asking for clarification as I haven't checked all your patches recently.
Quoted 7 lines
If we have a v6+v6k+v7 kernel, then the way the kernel TLS code is built, we will use the TLS register if that's available on the hardware. If it isn't, we will write the TLS value directly to virtual
0xffff0ffc.So, a kernel built for v6+v6k+v7, when run on v7, will set the hardware TLS register, and your v7 optimized binaries which access the TLS register directly will work. Same for v6k.
Great.
Quoted 2 lines
What we're discussing has nothing at all to do with getting v7 binaries running on v6 hardware. That's just not going to happen.
I wasn't suggesting this. That's not easily possible.
Quoted 8 lines
Quoted 4 lines
On ARMv6 with domains enabled,
cpu_v6_set_pte_ext()maps the vectors page as kernel R/W. Thecpu_v7_set_pte_ext()could map it as kernel RO and use the TLS register. The only other place where this matters on ARMv7 isearly_trap_init()but it's easily fixable on this architecture.That's pointless. There's no "could map the vectors page" -
set_pte_ext()doesn't know what's the vectors page and what isn't. It's about howset_pte_ext()maps pages which are marked with justL_PTE_USER.
What I meant is that we leave cpu_v6_set_pte_ext as it is (with R/W kernel access for RO user pages) and always mark such pages kernel RO in cpu_v7_set_pte_ext. See patch at the end of this email.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
1. SWP emulation requires domain support turned off
Not necessarily - it requires RO user pages to be kernel RO (though this feature came with the domains removal patch).
Yes it does because without domains, we need user pages to be kernel read-only, which also makes the vectors page kernel read-only.
But even with domains we can make user pages kernel RO for ARMv7 only.
Quoted 3 lines
The only use which
SWP_EMULATEgets us then is detecting userspace programs which use the SWP instruction - and that can only happen on a V7-only or v6k+v7 targetted kernel.
In some MP hardware configurations, SWP may not ensure atomicity across all the CPUs. Exclusives would ensure this behaviour.
The patch below allows domains to be enabled on ARMv7 and also use SWP emulation (tested on VE + A9 with domains enabled):
arch/arm/kernel/traps.c +9 -5
@@ -758,17 +758,21 @@ static void __init kuser_get_tls_init(unsigned long vectors)void __init early_trap_init (void ) { -#if defined(CONFIG_CPU_USE_DOMAINS ) -unsigned long vectors =CONFIG_VECTORS_BASE ; -#else -unsigned long vectors = (unsigned long )vectors_page; -#endif +unsigned long vectors;extern char __stubs_start[], __stubs_end[];extern char __vectors_start[], __vectors_end[];extern char __kuser_helper_start[], __kuser_helper_end[];int kuser_sz = __kuser_helper_end - __kuser_helper_start;/* +* On ARMv7, user RO pages are mapped as kernel RO. +*/ +if (cpu_architecture () >=7 ) + vectors = (unsigned long )vectors_page; +else + vectors =CONFIG_VECTORS_BASE ; + +/* * Copy the vectors, stubs and kuser helpers (in entry-armv.S) * into the vector page, mapped at 0xffff0000, and ensure these * are visible to the instruction stream.
arch/arm/mm/proc-v7.S +0 -5
@@ -146,11 +146,6 @@ ENTRY(cpu_v7_set_pte_ext) tst r1, #L_PTE_USER orrne r3, r3, #PTE_EXT_AP1 -#ifdef CONFIG_CPU_USE_DOMAINS - @ allow kernel read/write access to read-only user pages - tstne r3, #PTE_EXT_APX - bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 -#endif tst r1, #L_PTE_XN orrne r3, r3, #PTE_EXT_XN
Signature · 1 line
Catalin
PATCH 11/14 ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Quoted 19 lines · Catalin Marinas
Quoted 10 lines · Russell King - ARM Linux
Quoted 7 lines · Catalin Marinas
With your latest patches, do we use the TLS emulation on ARMv7 (UP) if v6 is compiled in? If that's the case, we may have a problem - I talked to the toolchain guys and it looks like code optimised for ARMv7 reads the TLS register directly without going through the kuser helper. So you may have people taking an Ubuntu filesystem (v7 only) and a pre-built OMAP image with TLS emulation even on Cortex-A8 and things won't work as expected.
You're really making a mountain out of TLS.
Not really, just asking for clarification as I haven't checked all your patches recently.
Quoted 4 lines
If we have a v6+v6k+v7 kernel, then the way the kernel TLS code is built, we will use the TLS register if that's available on the hardware. If it isn't, we will write the TLS value directly to virtual
0xffff0ffc.
Quoted 5 lines
Quoted 3 lines
So, a kernel built for v6+v6k+v7, when run on v7, will set the hardware TLS register, and your v7 optimized binaries which access the TLS register directly will work. Same for v6k.
Great.
Yes AFAIK we sorted out the TLS issue already a while back for v6+v6k+v7.
Regards,
Tony
PATCH 12/14 ARM: v6k: do not disable CPU_32v6K based on platform selection
In reply to Russell King - ARM LinuxCPU_32v6K controls whether we use the ARMv6K extension instructions in the kernel, and in some places whether we use SMP-safe code sequences (eg, bitops.)
MX3 prevents the selection of this option to ensure that it is not enabled for their CPU, which is ARMv6 only. Now that we've split the CPU_V6 option, V6K support won't be offered for MX3 anymore.
OMAP prevents the selection of this option in an attempt to produce a kernel which runs on architectures from ARMv6 to ARMv7 MPCore. We now achieve this in a different way (see the previous patches).
As such, we no longer need to offer this as a configuration option to the user.
--- arch/arm/mm/Kconfig | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-)
arch/arm/mm/Kconfig +3 -11
@@ -405,7 +405,7 @@ config CPU_V6 config CPU_V6K bool "Support ARM V6K processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX select CPU_32v6 - select CPU_32v6K if !ARCH_OMAP2 + select CPU_32v6K select CPU_ABRT_EV6 select CPU_PABRT_V6 select CPU_CACHE_V6
@@ -418,7 +418,7 @@ config CPU_V6K # ARMv7 config CPU_V7 bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX - select CPU_32v6K if !ARCH_OMAP2 + select CPU_32v6K select CPU_32v7 select CPU_ABRT_EV7 select CPU_PABRT_V7
@@ -461,15 +461,7 @@ config CPU_32v6 select CPU_USE_DOMAINS if CPU_V6 && MMU config CPU_32v6K - bool "Support ARM V6K processor extensions" if !SMP - depends on CPU_V6 || CPU_V6K || CPU_V7 - default y if SMP && !(ARCH_MX3 || ARCH_OMAP2) - help - Say Y here if your ARMv6 processor supports the 'K' extension. - This enables the kernel to use some instructions not present - on previous processors, and as such a kernel build with this - enabled will not boot on processors with do not support these - instructions. + bool config CPU_32v7 bool
Signature · 1 line
1.6.2.5
PATCH 12/14 ARM: v6k: do not disable CPU_32v6K based on platform selection
Quoted 8 lines · Russell King - ARM Linux
CPU_32v6Kcontrols whether we use the ARMv6K extension instructions in the kernel, and in some places whether we use SMP-safe code sequences (eg, bitops.)MX3 prevents the selection of this option to ensure that it is not enabled for their CPU, which is ARMv6 only. Now that we've split the
CPU_V6option, V6K support won't be offered for MX3 anymore.
Quoted 8 lines
OMAP prevents the selection of this option in an attempt to produce a kernel which runs on architectures from ARMv6 to ARMv7 MPCore. We now achieve this in a different way (see the previous patches).
As such, we no longer need to offer this as a configuration option to the user.
Signed-off-by Russell King <[email protected]>
PATCH 13/14 ARM: v6k: allow swp emulation again when ARMv7 is enabled
In reply to Russell King - ARM LinuxNow that we build a v6+v6k+v7 kernel with -march=armv6k for everything, we don't need to disable swp emulation to work around the build problem with OMAP.
--- arch/arm/mm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mm/Kconfig +1 -1
@@ -652,7 +652,7 @@ config ARM_THUMBEE config SWP_EMULATE bool "Emulate SWP/SWPB instructions" - depends on CPU_V7 && !CPU_V6 + depends on CPU_V7 select HAVE_PROC_CPU if PROC_FS default y if SMP help
Signature · 1 line
1.6.2.5
PATCH 13/14 ARM: v6k: allow swp emulation again when ARMv7 is enabled
Quoted 5 lines · Russell King - ARM Linux
Now that we build a v6+v6k+v7 kernel with -march=armv6k for everything, we don't need to disable swp emulation to work around the build problem with OMAP.
Signed-off-by Russell King <[email protected]>
Glad to see this issue sorted out.
PATCH 14/14 ARM: v6k: only allow SMP if we have v6k or v7 CPU
In reply to Russell King - ARM LinuxSMP extensions are only supported on ARMv6k or ARMv7 architectures, so only offer the option if we're building for such an architecture.
--- arch/arm/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/Kconfig +1 -0
@@ -1250,6 +1250,7 @@ source "kernel/time/Kconfig" config SMP bool "Symmetric Multi-Processing (EXPERIMENTAL)" depends on EXPERIMENTAL + depends on CPU_V6K || CPU_V7 depends on GENERIC_CLOCKEVENTS depends on REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP || \ MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
Signature · 1 line
1.6.2.5
PATCH 14/14 ARM: v6k: only allow SMP if we have v6k or v7 CPU
Quoted 4 lines · Russell King - ARM Linux
SMP extensions are only supported on ARMv6k or ARMv7 architectures, so only offer the option if we're building for such an architecture.
Signed-off-by Russell King <[email protected]>
cover Fix issues with ARMv6+v6k+v7 kernels
In reply to Russell King - ARM LinuxQuoted 21 lines · Russell King - ARM Linux
This patch series reworks the ARMv6/ARMv6K support options, code selection, and bit operations such that it's possible to safely build a kernel which supports ARMv6, ARMv6K, ARMv7 and ARMv7 SMP in one image.
Currently, we use
CPU_V6for both ARMv6 and ARMv6K, settingCPU_32v6Kif we have the K extensions.CPU_32v6Kdirectly controlled whether we should include the ARMv6K instructions (clrex, load/store exclusive byte, half-word, double). As the bitops code uses the load/store exclusive byte operations, unsettingCPU_32v6Kresults in these falling back to their non-SMP local-irq-disabling variants. These are only safe in uniprocessor environments.So, the first two patches convert the bitops to use the ARMv6 load/store exclusive word operations - and ensuring correctness by ensuring that the pointer passed in is word-aligned.
We then introduce a new
CPU_V6Kwhich indicates that we're including an ARMv6K CPU in the build, which frees upCPU_V6to mean that we're including an ARMv6 non-K CPU.
Quoted 6 lines
We can then use
CPU_V6to ensure that the non-v6K code paths which are still SMP safe are selected.Without this patch set, such a kernel will be unsafe when run on SMP platforms as it omits necessary SMP code to ensure that bit operations are safe.
Amazing, based on a quick test this series boots just fine on non-v6K omap2420 using omap2plus_defconfig :)
Tony
cover Fix issues with ARMv6+v6k+v7 kernels
In reply to Russell King - ARM LinuxQuoted 4 lines · Russell King - ARM Linux
This patch series reworks the ARMv6/ARMv6K support options, code selection, and bit operations such that it's possible to safely build a kernel which supports ARMv6, ARMv6K, ARMv7 and ARMv7 SMP in one image.
Is it posible to implement CPU_ARCH_ARMv6K as well for runtime checks?
Signature · 1 line
Kirill A. Shutemov
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 7 lines · Kirill A. Shutemov
Quoted 4 lines · Russell King - ARM Linux
This patch series reworks the ARMv6/ARMv6K support options, code selection, and bit operations such that it's possible to safely build a kernel which supports ARMv6, ARMv6K, ARMv7 and ARMv7 SMP in one image.
Is it posible to implement
CPU_ARCH_ARMv6Kas well for runtime checks?
Err what? There's no CPU_ARCH_ARMv6K.
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 10 lines · Russell King - ARM Linux
Quoted 7 lines · Kirill A. Shutemov
Quoted 4 lines · Russell King - ARM Linux
This patch series reworks the ARMv6/ARMv6K support options, code selection, and bit operations such that it's possible to safely build a kernel which supports ARMv6, ARMv6K, ARMv7 and ARMv7 SMP in one image.
Is it posible to implement
CPU_ARCH_ARMv6Kas well for runtime checks?Err what? There's no
CPU_ARCH_ARMv6K.
I some cases we need runtime check for K extention (see exceptions_init()) Is there any facility for it?
Signature · 1 line
Kirill A. Shutemov
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 14 lines · Kirill A. Shutemov
Quoted 10 lines · Russell King - ARM Linux
Quoted 7 lines · Kirill A. Shutemov
Quoted 4 lines · Russell King - ARM Linux
This patch series reworks the ARMv6/ARMv6K support options, code selection, and bit operations such that it's possible to safely build a kernel which supports ARMv6, ARMv6K, ARMv7 and ARMv7 SMP in one image.
Is it posible to implement
CPU_ARCH_ARMv6Kas well for runtime checks?Err what? There's no
CPU_ARCH_ARMv6K.I some cases we need runtime check for K extention (see
exceptions_init()) Is there any facility for it?
cover Fix issues with ARMv6+v6k+v7 kernels
In reply to Russell King - ARM LinuxRussell,
Quoted 32 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- owner at vger.kernel.org] On Behalf Of Russell King - ARM Linux
Sent: Tuesday, January 18, 2011 12:51 AM
To: linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
Subject: [PATCH 00/14] Fix issues with ARMv6+v6k+v7 kernelsThis patch series reworks the ARMv6/ARMv6K support options, code selection, and bit operations such that it's possible to safely build a kernel which supports ARMv6, ARMv6K, ARMv7 and ARMv7 SMP in one image.
Currently, we use
CPU_V6for both ARMv6 and ARMv6K, settingCPU_32v6K
if we have the K extensions.CPU_32v6Kdirectly controlled whether we should include the ARMv6K instructions (clrex, load/store exclusive
byte, half-word, double). As the bitops code uses the load/store exclusive byte operations, unsettingCPU_32v6Kresults in these falling back to their non-SMP local-irq-disabling variants. These are only safe in uniprocessor environments.So, the first two patches convert the bitops to use the ARMv6 load/store
exclusive word operations - and ensuring correctness by ensuring that
the pointer passed in is word-aligned.We then introduce a new
CPU_V6Kwhich indicates that we're including an ARMv6K CPU in the build, which frees upCPU_V6to mean that we're including an ARMv6 non-K CPU.
Quoted 8 lines
We can then use
CPU_V6to ensure that the non-v6K code paths which are
still SMP safe are selected.Without this patch set, such a kernel will be unsafe when run on SMP platforms as it omits necessary SMP code to ensure that bit operations are safe.
--
Have tested this series on OMAP4430 and OMAP3430. Don't know if it helps to push some of these patches to be part of rc cycles. At least the SMP specific fixes should get merged otherwise, builds like omap2plus_defconfig won't be running right configuration on SMP machine.
Regards,
Santosh
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 5 lines · Santosh Shilimkar
Have tested this series on OMAP4430 and OMAP3430. Don't know if it helps to push some of these patches to be part of rc cycles. At least the SMP specific fixes should get merged otherwise, builds like
omap2plus_defconfigwon't be running right configuration on SMP machine.
It's _too_ _late_ in the rc cycle for a fix of this size. As I've said (several times) it was only possible for rc1. That boat has been missed as we're now on rc4. We could see 2.6.38 in as little as two weeks time.
27 files changed, 183 insertions(+), 197 deletions(-)
is too big.
There's still the outstanding question over:
ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
which remains unsettled.
I think it's probably going to be better to _purposely_ break the OMAP build when it covers v6 and v7 CPUs in these kernels as I don't think it's sanely fixable given where we are. Again, that's something I _did_ point out@the time.
I really can't help it if there is a lack of co-operation from people to get necessary fixes properly tested in a timely manner.
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 21 lines
-----Original Message-----
From: Russell King - ARM Linux [mailto:linux at arm.linux.org.uk]
Sent: Tuesday, February 08, 2011 10:18 PM
To: Santosh Shilimkar
Cc: linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
Subject: Re: [PATCH 00/14] Fix issues with ARMv6+v6k+v7 kernelsQuoted 5 lines · Santosh Shilimkar
Have tested this series on OMAP4430 and OMAP3430. Don't know if it helps to push some of these patches to be part of rc cycles. At least the SMP specific fixes should get merged otherwise, builds like
omap2plus_defconfigwon't be running right configuration on SMP machine.It's _too_ _late_ in the rc cycle for a fix of this size. As I've said
(several times) it was only possible for rc1. That boat has been missed
as we're now on rc4. We could see 2.6.38 in as little as two weeks time.
Quoted 4 lines
27 files changed, 183 insertions(+), 197 deletions(-)is too big.
Ok. Sorry about delay in testing out these patches.
Quoted 5 lines
There's still the outstanding question over:
ARM: v6k: use CPU domain feature if we include support for arch <
ARMv6K
Quoted 9 lines
which remains unsettled.
I think it's probably going to be better to _purposely_ break the OMAP
build when it covers v6 and v7 CPUs in these kernels as I don't think it's
sanely fixable given where we are. Again, that's something I _did_ point out at the time.
Any alternative possible other than breaking the omap2plus build? It's quite useful to have one build which covers majority of the omap machines.
Regards,
Santosh
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 3 lines · Santosh Shilimkar
Quoted 3 lines
I think it's probably going to be better to _purposely_ break the OMAP build when it covers v6 and v7 CPUs in these kernels as I don't think it's sanely fixable given where we are.
Agreed. At least making SMP unavailable when both v6 and v7 are configured should be small and good enough for 2.6.38-rc5.
Quoted 3 lines
Any alternative possible other than breaking the omap2plus build? It's quite useful to have one build which covers majority of the omap machines.
Just merge this patch series in your testing tree, or create two configs (two builds) instead of only (a broken) one.
Or use linux-next for testing which would be even more beneficial.
Nicolas
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 8 lines · Nicolas Pitre
Quoted 3 lines · Santosh Shilimkar
Quoted 3 lines
I think it's probably going to be better to _purposely_ break the OMAP build when it covers v6 and v7 CPUs in these kernels as I don't think it's sanely fixable given where we are.
Agreed. At least making SMP unavailable when both v6 and v7 are configured should be small and good enough for 2.6.38-rc5.
That's probably the best solution as then we can still do boot testing on all omap2plus_defconfig boards.
Tony
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 15 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- owner at vger.kernel.org] On Behalf Of Tony Lindgren
Sent: Wednesday, February 09, 2011 6:06 AM
To: Nicolas Pitre
Cc: Santosh Shilimkar; Russell King - ARM Linux; linux- omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 00/14] Fix issues with ARMv6+v6k+v7 kernelsQuoted 3 lines · Nicolas Pitre
Quoted 1 line · Santosh Shilimkar
Quoted 1 line
I think it's probably going to be better to _purposely_ break
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
OMAP build when it covers v6 and v7 CPUs in these kernels as I
Quoted 9 lines
don't
Quoted 4 lines
Quoted 1 line
Quoted 1 line
think it's sanely fixable given where we are.
Agreed. At least making SMP unavailable when both v6 and v7 are configured should be small and good enough for 2.6.38-rc5.
That's probably the best solution as then we can still do boot testing on all
omap2plus_defconfigboards.
Just to be clear, are we saying disable SMP from omap2plus build. If the v6, v7 is not fixable then, we also need a SMP config for OMAP. Just boot test with SMP disable config for OMAP4 is not enough.
Regards,
Santosh
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 21 lines · Santosh Shilimkar
Quoted 21 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- owner at vger.kernel.org] On Behalf Of Tony Lindgren
Sent: Wednesday, February 09, 2011 6:06 AM
To: Nicolas Pitre
Cc: Santosh Shilimkar; Russell King - ARM Linux; linux- omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 00/14] Fix issues with ARMv6+v6k+v7 kernelsQuoted 3 lines · Nicolas Pitre
Quoted 1 line · Santosh Shilimkar
Quoted 1 line
I think it's probably going to be better to _purposely_ break
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
OMAP build when it covers v6 and v7 CPUs in these kernels as I
don't
Quoted 4 lines
Quoted 1 line
Quoted 1 line
think it's sanely fixable given where we are.
Agreed. ?At least making SMP unavailable when both v6 and v7 are configured should be small and good enough for 2.6.38-rc5.
Quoted 7 lines
Quoted 3 lines
That's probably the best solution as then we can still do boot testing on all
omap2plus_defconfigboards.Just to be clear, are we saying disable SMP from omap2plus build. If the v6, v7 is not fixable then, we also need a SMP config for OMAP. Just boot test with SMP disable config for OMAP4 is not enough.
You could also have a "v7+" unified kernel -- i.e., supporting OMAP3+4+SMP. This is what we currently do in Linaro, since we're focusing on v7 and above.
Cheers
---Dave
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 42 lines
-----Original Message-----
From: Dave Martin [mailto:dave.martin at linaro.org]
Sent: Wednesday, February 09, 2011 3:18 PM
To: Santosh Shilimkar
Cc: Tony Lindgren; Nicolas Pitre; linux-omap at vger.kernel.org; Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 00/14] Fix issues with ARMv6+v6k+v7 kernelsQuoted 9 lines · Santosh Shilimkar
Quoted 9 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- owner at vger.kernel.org] On Behalf Of Tony Lindgren
Sent: Wednesday, February 09, 2011 6:06 AM
To: Nicolas Pitre
Cc: Santosh Shilimkar; Russell King - ARM Linux; linux- omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 00/14] Fix issues with ARMv6+v6k+v7 kernelsQuoted 4 lines
Quoted 4 lines · Nicolas Pitre
Quoted 3 lines · Santosh Shilimkar
Quoted 2 lines
Quoted 2 lines
I think it's probably going to be better to _purposely_
break
Quoted 2 lines
Quoted 2 lines
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
OMAP build when it covers v6 and v7 CPUs in these kernels
as I
Quoted 4 lines
Quoted 4 lines
don't
Quoted 3 lines
Quoted 1 line
Quoted 1 line
think it's sanely fixable given where we are.
Agreed. ?At least making SMP unavailable when both v6 and v7
are
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
configured should be small and good enough for 2.6.38-rc5.
That's probably the best solution as then we can still do boot testing on all
omap2plus_defconfigboards.Just to be clear, are we saying disable SMP from omap2plus build. If the v6, v7 is not fixable then, we also need a SMP config for OMAP. Just boot test with SMP disable config for OMAP4 is not enough.
Quoted 5 lines
You could also have a "v7+" unified kernel -- i.e., supporting OMAP3+4+SMP.
This is what we currently do in Linaro, since we're focusing on v7 and above.
This sounds good way forward considering future OMAP architectures as well.
But I let Tony comment on this idea.
Regards,
Santosh
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 11 lines · Santosh Shilimkar
Quoted 7 lines
From: Dave Martin [mailto:dave.martin at linaro.org]
You could also have a "v7+" unified kernel -- i.e., supporting OMAP3+4+SMP.
This is what we currently do in Linaro, since we're focusing on v7 and above.This sounds good way forward considering future OMAP architectures as well.
But I let Tony comment on this idea.
AFAIK these issues will be hopefully sorted out by the time the next merge window opens. For the -rc cycle, disabling SMP in config if ARMv6 is selected should do the trick.
Regards,
Tony
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 17 lines
-----Original Message-----
From: Tony Lindgren [mailto:tony at atomide.com]
Sent: Wednesday, February 09, 2011 9:54 PM
To: Santosh Shilimkar
Cc: Dave Martin; Nicolas Pitre; linux-omap at vger.kernel.org; Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 00/14] Fix issues with ARMv6+v6k+v7 kernelsQuoted 5 lines · Santosh Shilimkar
Quoted 5 lines
From: Dave Martin [mailto:dave.martin at linaro.org]
You could also have a "v7+" unified kernel -- i.e., supporting OMAP3+4+SMP.
This is what we currently do in Linaro, since we're focusing onv7
Quoted 2 lines
Quoted 2 lines
and above.
Quoted 9 lines
Quoted 4 lines
This sounds good way forward considering future OMAP architectures as well.
But I let Tony comment on this idea.
AFAIK these issues will be hopefully sorted out by the time the next merge window opens. For the -rc cycle, disabling SMP in config if ARMv6 is selected should do the trick.
Ok.
Regards,
Santosh
cover Fix issues with ARMv6+v6k+v7 kernels
In reply to Tony LindgrenQuoted 8 lines · Tony Lindgren
Quoted 7 lines · Santosh Shilimkar
Quoted 7 lines
From: Dave Martin [mailto:dave.martin at linaro.org]
You could also have a "v7+" unified kernel -- i.e., supporting OMAP3+4+SMP.
This is what we currently do in Linaro, since we're focusing on v7 and above.
Quoted 8 lines
Quoted 4 lines
This sounds good way forward considering future OMAP architectures as well.
But I let Tony comment on this idea.
AFAIK these issues will be hopefully sorted out by the time the next merge window opens. For the -rc cycle, disabling SMP in config if ARMv6 is selected should do the trick.
That's not soo easy - as we don't know in the Kconfig whether we include ARMv6 rather than ARMv6K. It's exactly the same problem I ran into which inflated the v6v7 patchset.
Maybe the best thing to do is:
config CPU_32v6K
bool "Support ARM V6K processor extensions" if !SMP
depends on CPU_V6 || CPU_V7
default y if SMP && !(ARCH_MX3 || ARCH_OMAP2)drop the ' && !(ARCH_MX3 || ARCH_OMAP2)' and just let people run into the resulting undefined instruction traps if they try to run the kernel on V6 non-K hardware. Not ideal, but I don't see any other 'simple' solution to this.
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 25 lines · Russell King - ARM Linux
Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Santosh Shilimkar
Quoted 7 lines
From: Dave Martin [mailto:dave.martin at linaro.org]
You could also have a "v7+" unified kernel -- i.e., supporting OMAP3+4+SMP.
This is what we currently do in Linaro, since we're focusing on v7 and above.Quoted 8 lines
Quoted 4 lines
This sounds good way forward considering future OMAP architectures as well.
But I let Tony comment on this idea.
AFAIK these issues will be hopefully sorted out by the time the next merge window opens. For the -rc cycle, disabling SMP in config if ARMv6 is selected should do the trick.
That's not soo easy - as we don't know in the
Kconfigwhether we include ARMv6 rather than ARMv6K. It's exactly the same problem I ran into which inflated the v6v7 patchset.Maybe the best thing to do is:
config
CPU_32v6K
Quoted 8 lines
bool "Support ARM V6K processor extensions" if !SMP depends on CPU_V6 || CPU_V7 default y if SMP && !(ARCH_MX3 || ARCH_OMAP2)drop the ' && !(ARCH_MX3 ||
ARCH_OMAP2)' and just let people run into the resulting undefined instruction traps if they try to run the kernel on V6 non-K hardware. Not ideal, but I don't see any other 'simple' solution to this.
Right, this is what I propose. Merging this will cause conflicts with the v6v7 patchset.
8<-----
Subject: [PATCH] ARM: Avoid building unsafe kernels on OMAP2 and MX3
OMAP2 (armv6) and MX3 turn off support for the V6K instructions, which when they include support for SMP kernels means that the resulting kernel is unsafe on SMP and can result in corrupted filesystems as we end up using unsafe bitops.
Re-enable the use of V6K instructions on such kernels, and let such kernels running on V6 CPUs eat undefined instruction faults which will be much safer than filesystem corruption. Next merge window we can fix this properly (as it requires a much bigger set of changes.)
--- arch/arm/mm/Kconfig | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mm/Kconfig +2 -2
@@ -405,7 +405,7 @@ config CPU_V6 config CPU_32v6K bool "Support ARM V6K processor extensions" if !SMP depends on CPU_V6 || CPU_V7 - default y if SMP && !(ARCH_MX3 || ARCH_OMAP2) + default y if SMP help Say Y here if your ARMv6 processor supports the 'K' extension. This enables the kernel to use some instructions not present
@@ -416,7 +416,7 @@ config CPU_32v6K # ARMv7 config CPU_V7 bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX - select CPU_32v6K if !ARCH_OMAP2 + select CPU_32v6K select CPU_32v7 select CPU_ABRT_EV7 select CPU_PABRT_V7
Signature · 1 line
1.6.2.5
cover Fix issues with ARMv6+v6k+v7 kernels
In reply to Russell King - ARM LinuxQuoted 25 lines · Russell King - ARM Linux
Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Santosh Shilimkar
Quoted 7 lines
From: Dave Martin [mailto:dave.martin at linaro.org]
You could also have a "v7+" unified kernel -- i.e., supporting OMAP3+4+SMP.
This is what we currently do in Linaro, since we're focusing on v7 and above.Quoted 8 lines
Quoted 4 lines
This sounds good way forward considering future OMAP architectures as well.
But I let Tony comment on this idea.
AFAIK these issues will be hopefully sorted out by the time the next merge window opens. For the -rc cycle, disabling SMP in config if ARMv6 is selected should do the trick.
That's not soo easy - as we don't know in the
Kconfigwhether we include ARMv6 rather than ARMv6K. It's exactly the same problem I ran into which inflated the v6v7 patchset.Maybe the best thing to do is:
config
CPU_32v6K
Quoted 8 lines
bool "Support ARM V6K processor extensions" if !SMP depends on CPU_V6 || CPU_V7 default y if SMP && !(ARCH_MX3 || ARCH_OMAP2)drop the ' && !(ARCH_MX3 ||
ARCH_OMAP2)' and just let people run into the resulting undefined instruction traps if they try to run the kernel on V6 non-K hardware. Not ideal, but I don't see any other 'simple' solution to this.
This should be good enough. We're looking for a temporary stopgate solution to prevent people from corrupting their data, and the real fix will be available in the next kernel.
Nicolas
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 31 lines · Nicolas Pitre
Quoted 29 lines · Russell King - ARM Linux
Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Santosh Shilimkar
Quoted 7 lines
From: Dave Martin [mailto:dave.martin at linaro.org]
You could also have a "v7+" unified kernel -- i.e., supporting OMAP3+4+SMP.
This is what we currently do in Linaro, since we're focusing on v7 and above.Quoted 8 lines
Quoted 4 lines
This sounds good way forward considering future OMAP architectures as well.
But I let Tony comment on this idea.
AFAIK these issues will be hopefully sorted out by the time the next merge window opens. For the -rc cycle, disabling SMP in config if ARMv6 is selected should do the trick.
That's not soo easy - as we don't know in the
Kconfigwhether we include ARMv6 rather than ARMv6K. It's exactly the same problem I ran into which inflated the v6v7 patchset.Maybe the best thing to do is:
config
CPU_32v6Kbool "Support ARM V6K processor extensions" if !SMP depends on CPU_V6 || CPU_V7 default y if SMP && !(ARCH_MX3 || ARCH_OMAP2)
Quoted 8 lines
Quoted 4 lines
drop the ' && !(ARCH_MX3 ||
ARCH_OMAP2)' and just let people run into the resulting undefined instruction traps if they try to run the kernel on V6 non-K hardware. Not ideal, but I don't see any other 'simple' solution to this.This should be good enough. We're looking for a temporary stopgate solution to prevent people from corrupting their data, and the real fix will be available in the next kernel.
OK. This patch will be needed anyways for the real fixes. And no temporary apply-undo type patching needed. The only drawback is that omap2420 and 2430 won't boot with omap2plus_defconfig, but that will be only for a few weeks.
cover Fix issues with ARMv6+v6k+v7 kernels
In reply to Russell King - ARM LinuxQuoted 11 lines · Russell King - ARM Linux
Quoted 5 lines · Santosh Shilimkar
Have tested this series on OMAP4430 and OMAP3430. Don't know if it helps to push some of these patches to be part of rc cycles. At least the SMP specific fixes should get merged otherwise, builds like
omap2plus_defconfigwon't be running right configuration on SMP machine.It's _too_ _late_ in the rc cycle for a fix of this size. ?As I've said (several times) it was only possible for rc1. ?That boat has been missed as we're now on rc4. ?We could see 2.6.38 in as little as two weeks time.
Quoted 7 lines
?27 files changed, 183 insertions(+), 197 deletions(-)
is too big.
There's still the outstanding question over:
?ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K
Could we make the domains usage a run-time feature based on the architecture version? For ARMv7, we need to have the vectors page read-only anyway if the SWP emulation is enabled (and I posted a simple patch in a reply to your email).
The issue I see is that ARM11MPCore is reported as v7 though we still use domains on this processor (we could always remove the domains if TLS register is available or use some more precise architecture version identification).
Signature · 1 line
Catalin
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 9 lines · Catalin Marinas
Could we make the domains usage a run-time feature based on the architecture version? For ARMv7, we need to have the vectors page read-only anyway if the SWP emulation is enabled (and I posted a simple patch in a reply to your email).
The issue I see is that ARM11MPCore is reported as v7 though we still use domains on this processor (we could always remove the domains if TLS register is available or use some more precise architecture version identification).
We could also do the below, which I think is more logical - SWP emulation requires that CPU domains aren't enabled, so let's make that explicit in the Kconfig.
arch/arm/mm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mm/Kconfig +1 -1
@@ -644,7 +644,7 @@ config ARM_THUMBEE config SWP_EMULATE bool "Emulate SWP/SWPB instructions" - depends on CPU_V7 && !CPU_V6 + depends on !CPU_USE_DOMAINS && CPU_V7 && !CPU_V6 select HAVE_PROC_CPU if PROC_FS default y if SMP help
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines · Catalin Marinas
Could we make the domains usage a run-time feature based on the architecture version? For ARMv7, we need to have the vectors page read-only anyway if the SWP emulation is enabled (and I posted a simple patch in a reply to your email).
Quoted 8 lines
Quoted 4 lines
The issue I see is that ARM11MPCore is reported as v7 though we still use domains on this processor (we could always remove the domains if TLS register is available or use some more precise architecture version identification).
We could also do the below, which I think is more logical - SWP emulation requires that CPU domains aren't enabled, so let's make that explicit in the
Kconfig.
This may work but it is to restrictive IMHO. SWP emulation only requires that RO user pages are also RO for the kernel. And there is a simple fix for this:
arch/arm/kernel/traps.c +9 -5
@@ -758,17 +758,21 @@ static void __init kuser_get_tls_init(unsigned long vectors)void __init early_trap_init (void ) { -#if defined(CONFIG_CPU_USE_DOMAINS ) -unsigned long vectors =CONFIG_VECTORS_BASE ; -#else -unsigned long vectors = (unsigned long )vectors_page; -#endif +unsigned long vectors;extern char __stubs_start[], __stubs_end[];extern char __vectors_start[], __vectors_end[];extern char __kuser_helper_start[], __kuser_helper_end[];int kuser_sz = __kuser_helper_end - __kuser_helper_start;/* +* On ARMv7, user RO pages are mapped as kernel RO. +*/ +if (cpu_architecture () >=7 ) + vectors = (unsigned long )vectors_page; +else + vectors =CONFIG_VECTORS_BASE ; + +/* * Copy the vectors, stubs and kuser helpers (in entry-armv.S) * into the vector page, mapped at 0xffff0000, and ensure these * are visible to the instruction stream.
arch/arm/mm/proc-v7.S +0 -5
@@ -146,11 +146,6 @@ ENTRY(cpu_v7_set_pte_ext) tst r1, #L_PTE_USER orrne r3, r3, #PTE_EXT_AP1 -#ifdef CONFIG_CPU_USE_DOMAINS - @ allow kernel read/write access to read-only user pages - tstne r3, #PTE_EXT_APX - bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 -#endif tst r1, #L_PTE_XN orrne r3, r3, #PTE_EXT_XN
Signature · 1 line
Catalin
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 12 lines · Catalin Marinas
Quoted 11 lines · Russell King - ARM Linux
Quoted 9 lines · Catalin Marinas
Could we make the domains usage a run-time feature based on the architecture version? For ARMv7, we need to have the vectors page read-only anyway if the SWP emulation is enabled (and I posted a simple patch in a reply to your email).
The issue I see is that ARM11MPCore is reported as v7 though we still use domains on this processor (we could always remove the domains if TLS register is available or use some more precise architecture version identification).
Quoted 5 lines
Quoted 3 lines
We could also do the below, which I think is more logical - SWP emulation requires that CPU domains aren't enabled, so let's make that explicit in the
Kconfig.This may work but it is to restrictive IMHO.
At this point I really don't care - mainly because of the lack of support from the community for sorting out these problems and testing solutions to them.
It's the simplest solution for the corner we find ourselves in with all this crap, and avoids any possibility of any side effects caused by having different behaviours from the same kernel.
I've merged it into my tree and I'm intending to push it upstream. We can then readdress it later once we have the real v6v7 crap fixed.
cover Fix issues with ARMv6+v6k+v7 kernels
In reply to Catalin MarinasQuoted 12 lines · Catalin Marinas
Quoted 11 lines · Russell King - ARM Linux
Quoted 9 lines · Catalin Marinas
Could we make the domains usage a run-time feature based on the architecture version? For ARMv7, we need to have the vectors page read-only anyway if the SWP emulation is enabled (and I posted a simple patch in a reply to your email).
The issue I see is that ARM11MPCore is reported as v7 though we still use domains on this processor (we could always remove the domains if TLS register is available or use some more precise architecture version identification).
Quoted 8 lines
Quoted 3 lines
We could also do the below, which I think is more logical - SWP emulation requires that CPU domains aren't enabled, so let's make that explicit in the
Kconfig.This may work but it is to restrictive IMHO. SWP emulation only requires that RO user pages are also RO for the kernel. And there is a simple fix for this:
The patch below is making the code more straight forward regardless of any swp emulation issues.
Quoted 59 lines
arch/arm/kernel/traps.c +9
-5@@ -758,17 +758,21 @@ static void __init kuser_get_tls_init(unsigned long vectors)void __init early_trap_init (void ) { -#if defined(CONFIG_CPU_USE_DOMAINS ) -unsigned long vectors =CONFIG_VECTORS_BASE ; -#else -unsigned long vectors = (unsigned long )vectors_page; -#endif +unsigned long vectors;extern char __stubs_start[], __stubs_end[];extern char __vectors_start[], __vectors_end[];extern char __kuser_helper_start[], __kuser_helper_end[];int kuser_sz = __kuser_helper_end - __kuser_helper_start;/* +* On ARMv7, user RO pages are mapped as kernel RO. +*/ +if (cpu_architecture () >=7 ) + vectors = (unsigned long )vectors_page; +else + vectors =CONFIG_VECTORS_BASE ; + +/* * Copy the vectors, stubs and kuser helpers (in entry-armv.S) * into the vector page, mapped at 0xffff0000, and ensure these * are visible to the instruction stream. arch/arm/mm/proc-v7.S +0
-5@@ -146,11 +146,6 @@ ENTRY(cpu_v7_set_pte_ext) tst r1, #L_PTE_USER orrne r3, r3, #PTE_EXT_AP1 -#ifdef CONFIG_CPU_USE_DOMAINS - @ allow kernel read/write access to read-only user pages - tstne r3, #PTE_EXT_APX - bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 -#endif tst r1, #L_PTE_XN orrne r3, r3, #PTE_EXT_XNSignature · 9 lines
-- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
cover Fix issues with ARMv6+v6k+v7 kernels
Quoted 2 lines · Nicolas Pitre
The patch below is making the code more straight forward regardless of any swp emulation issues.
I don't know where you get that idea from. What it does is make a kernel built with a standard set of options have differing behaviour on v7 and pre-v7 architectures.
On v7 architectures, the vectors page and user pages all become read only to SVC mode. On pre-v7 architectures on the same kernel, they are read- write to SVC mode.
What we have now is that these pages are only read-only when CPU domains are turned off - for everything. So we know that if CPU domains are enabled, it's read/write, otherwise it's read only. That's more straight forward than what this patch creates IMHO.