* [PATCH] ARM: kprobes: work around build errors
@ 2011-10-08 15:07 Arnd Bergmann
2011-10-08 15:35 ` Dr. David Alan Gilbert
2011-10-10 7:05 ` Tixy
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2011-10-08 15:07 UTC (permalink / raw)
To: linux-arm-kernel
I got a few build errors for kprobes playing with randconfig on the
latest kernel. While this patch manages to avoid these errors, I'm
pretty sure that it is not the ideal solution.
The errors I got in arm are while building for ARMv6 with
the arm-linux-gnueabihf-gcc-4.6 provided by Linaro, which
results in these messages:
/tmp/ccGpftnj.s: Assembler messages:
/tmp/ccGpftnj.s:22066: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
/tmp/ccGpftnj.s:22099: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
/tmp/ccGpftnj.s:22128: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'
/tmp/ccGpftnj.s:23781: Error: selected processor does not support ARM mode `strexd r0,r2,r3,[sp]'
/tmp/ccGpftnj.s:23802: Error: selected processor does not support ARM mode `ldrexd r2,r3,[sp]'
/tmp/ccGpftnj.s:23823: Error: selected processor does not support ARM mode `strexb r0,r2,[sp]'
/tmp/ccGpftnj.s:23844: Error: selected processor does not support ARM mode `ldrexb r2,[sp]'
/tmp/ccGpftnj.s:23865: Error: selected processor does not support ARM mode `strexh r0,r2,[sp]'
/tmp/ccGpftnj.s:23886: Error: selected processor does not support ARM mode `ldrexh r2,[sp]'
/tmp/ccGpftnj.s:25836: Warning: base register written back, and overlaps second transfer register
The errors for the thumb variant are using the same tool
chain, but obviously in v7 thumb2 mode. The error I got
is
/tmp/cczp95OW.s:18721: Error: offset out of range
Reducing the amount of padding in the "TEST_BF_X("bpl.w 2f",0x1000)"
test case resolves this, and I experimentally found 0xe20 to be the
maximum value in this location, but that is different if I change the
surrounding code. This one is much harder to reproduce and I can
provide the configuration file I used if that helps.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
index fc82de8..ba9c600 100644
--- a/arch/arm/kernel/kprobes-test-arm.c
+++ b/arch/arm/kernel/kprobes-test-arm.c
@@ -367,9 +367,11 @@ void kprobe_arm_test_cases(void)
TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
+#if __LINUX_ARM_ARCH__ >= 7
TEST_RRR( "mls r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
TEST_RRR( "mlshi r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
TEST_RR( "mls lr, r",1, VAL2,", r",2, VAL3,", r13")
+#endif
TEST_UNSUPPORTED(".word 0xe06f3291 @ mls pc, r1, r2, r3")
TEST_UNSUPPORTED(".word 0xe060329f @ mls r0, pc, r2, r3")
TEST_UNSUPPORTED(".word 0xe0603f91 @ mls r0, r1, pc, r3")
@@ -447,7 +449,7 @@ void kprobe_arm_test_cases(void)
TEST_UNSUPPORTED(".word 0xe1500090") /* Unallocated space */
TEST_UNSUPPORTED(".word 0xe1600090") /* Unallocated space */
TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
-#if __LINUX_ARM_ARCH__ >= 6
+#if __LINUX_ARM_ARCH__ >= 7
TEST_UNSUPPORTED("ldrex r2, [sp]")
TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
diff --git a/arch/arm/kernel/kprobes-test-thumb.c b/arch/arm/kernel/kprobes-test-thumb.c
index 5e726c3..bcf5e6b 100644
--- a/arch/arm/kernel/kprobes-test-thumb.c
+++ b/arch/arm/kernel/kprobes-test-thumb.c
@@ -746,7 +746,7 @@ CONDITION_INSTRUCTIONS(22,
TEST_BB("bne.w 2b")
TEST_BF("bgt.w 2f")
TEST_BB("blt.w 2b")
- TEST_BF_X("bpl.w 2f",0x1000)
+ TEST_BF_X("bpl.w 2f",0xe20)
)
TEST_UNSUPPORTED("msr cpsr, r0")
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM: kprobes: work around build errors
2011-10-08 15:07 [PATCH] ARM: kprobes: work around build errors Arnd Bergmann
@ 2011-10-08 15:35 ` Dr. David Alan Gilbert
2011-10-10 7:05 ` Tixy
1 sibling, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2011-10-08 15:35 UTC (permalink / raw)
To: linux-arm-kernel
* Arnd Bergmann (arnd at arndb.de) wrote:
> I got a few build errors for kprobes playing with randconfig on the
> latest kernel. While this patch manages to avoid these errors, I'm
> pretty sure that it is not the ideal solution.
>
> The errors I got in arm are while building for ARMv6 with
> the arm-linux-gnueabihf-gcc-4.6 provided by Linaro, which
> results in these messages:
>
> /tmp/ccGpftnj.s: Assembler messages:
> /tmp/ccGpftnj.s:22066: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
> /tmp/ccGpftnj.s:22099: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
> /tmp/ccGpftnj.s:22128: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'
> /tmp/ccGpftnj.s:23781: Error: selected processor does not support ARM mode `strexd r0,r2,r3,[sp]'
> /tmp/ccGpftnj.s:23802: Error: selected processor does not support ARM mode `ldrexd r2,r3,[sp]'
> /tmp/ccGpftnj.s:23823: Error: selected processor does not support ARM mode `strexb r0,r2,[sp]'
> /tmp/ccGpftnj.s:23844: Error: selected processor does not support ARM mode `ldrexb r2,[sp]'
> /tmp/ccGpftnj.s:23865: Error: selected processor does not support ARM mode `strexh r0,r2,[sp]'
> /tmp/ccGpftnj.s:23886: Error: selected processor does not support ARM mode `ldrexh r2,[sp]'
> /tmp/ccGpftnj.s:25836: Warning: base register written back, and overlaps second transfer register
>
> The errors for the thumb variant are using the same tool
> chain, but obviously in v7 thumb2 mode. The error I got
> is
>
> /tmp/cczp95OW.s:18721: Error: offset out of range
>
> Reducing the amount of padding in the "TEST_BF_X("bpl.w 2f",0x1000)"
> test case resolves this, and I experimentally found 0xe20 to be the
> maximum value in this location, but that is different if I change the
> surrounding code. This one is much harder to reproduce and I can
> provide the configuration file I used if that helps.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
> index fc82de8..ba9c600 100644
> --- a/arch/arm/kernel/kprobes-test-arm.c
> +++ b/arch/arm/kernel/kprobes-test-arm.c
<snip>
> -#if __LINUX_ARM_ARCH__ >= 6
> +#if __LINUX_ARM_ARCH__ >= 7
> TEST_UNSUPPORTED("ldrex r2, [sp]")
> TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
> TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
The ldrexd and strexd are supported on one of the ARMv6 varients
(6k I think from memory) which makes stuff a bit more complicated.
(and I think the plain ldrex that's the first one in that set
works on older CPUs).
Dave
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ gro.gilbert @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: kprobes: work around build errors
2011-10-08 15:07 [PATCH] ARM: kprobes: work around build errors Arnd Bergmann
2011-10-08 15:35 ` Dr. David Alan Gilbert
@ 2011-10-10 7:05 ` Tixy
2011-10-10 7:40 ` Jon Medhurst (Tixy)
1 sibling, 1 reply; 4+ messages in thread
From: Tixy @ 2011-10-10 7:05 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, 2011-10-08 at 17:07 +0200, Arnd Bergmann wrote:
> I got a few build errors for kprobes playing with randconfig on the
> latest kernel. While this patch manages to avoid these errors, I'm
> pretty sure that it is not the ideal solution.
It's the practical solution and what I did in other places of the code.
I didn't think it was worth the effort to introduce runtime CPU
detection to the test framework, especially as the kprobes
implementation which is tested in these situations is itself not
dependent on CPU version. (Though if we're heading for a 'single zImage'
then I may have to rethink this at some point.)
> The errors I got in arm are while building for ARMv6 with
> the arm-linux-gnueabihf-gcc-4.6 provided by Linaro, which
> results in these messages:
>
> /tmp/ccGpftnj.s: Assembler messages:
> /tmp/ccGpftnj.s:22066: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
> /tmp/ccGpftnj.s:22099: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
> /tmp/ccGpftnj.s:22128: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'
> /tmp/ccGpftnj.s:23781: Error: selected processor does not support ARM mode `strexd r0,r2,r3,[sp]'
> /tmp/ccGpftnj.s:23802: Error: selected processor does not support ARM mode `ldrexd r2,r3,[sp]'
> /tmp/ccGpftnj.s:23823: Error: selected processor does not support ARM mode `strexb r0,r2,[sp]'
> /tmp/ccGpftnj.s:23844: Error: selected processor does not support ARM mode `ldrexb r2,[sp]'
> /tmp/ccGpftnj.s:23865: Error: selected processor does not support ARM mode `strexh r0,r2,[sp]'
> /tmp/ccGpftnj.s:23886: Error: selected processor does not support ARM mode `ldrexh r2,[sp]'
> /tmp/ccGpftnj.s:25836: Warning: base register written back, and overlaps second transfer register
>
> The errors for the thumb variant are using the same tool
> chain, but obviously in v7 thumb2 mode. The error I got
> is
>
> /tmp/cczp95OW.s:18721: Error: offset out of range
>
> Reducing the amount of padding in the "TEST_BF_X("bpl.w 2f",0x1000)"
> test case resolves this, and I experimentally found 0xe20 to be the
> maximum value in this location, but that is different if I change the
> surrounding code. This one is much harder to reproduce and I can
> provide the configuration file I used if that helps.
The padding value of 0x1000 was deliberately chosen as it forces a
different instruction encoding to be used. This encoding was introduced
in ARMv6T2 so the test case should instead be made conditional on
__LINUX_ARM_ARCH__ >= 7.
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
> index fc82de8..ba9c600 100644
> --- a/arch/arm/kernel/kprobes-test-arm.c
> +++ b/arch/arm/kernel/kprobes-test-arm.c
> @@ -367,9 +367,11 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
> TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
>
> +#if __LINUX_ARM_ARCH__ >= 7
> TEST_RRR( "mls r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
> TEST_RRR( "mlshi r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
> TEST_RR( "mls lr, r",1, VAL2,", r",2, VAL3,", r13")
> +#endif
> TEST_UNSUPPORTED(".word 0xe06f3291 @ mls pc, r1, r2, r3")
> TEST_UNSUPPORTED(".word 0xe060329f @ mls r0, pc, r2, r3")
> TEST_UNSUPPORTED(".word 0xe0603f91 @ mls r0, r1, pc, r3")
> @@ -447,7 +449,7 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe1500090") /* Unallocated space */
> TEST_UNSUPPORTED(".word 0xe1600090") /* Unallocated space */
> TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
> -#if __LINUX_ARM_ARCH__ >= 6
> +#if __LINUX_ARM_ARCH__ >= 7
> TEST_UNSUPPORTED("ldrex r2, [sp]")
> TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
> TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
As Dave Gilbert pointed out, the "ldrex r2, [sp]" is legal on ARMv6 so
this would be better as...
#if __LINUX_ARM_ARCH__ >= 6
TEST_UNSUPPORTED("ldrex r2, [sp]")
#endif
#if __LINUX_ARM_ARCH__ >= 7
TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
With the changes I suggested: Acked-by: Jon Medhurst <tixy@yxit.co.uk>
Thanks for your randconfig fixes. As you can probably tell, I only
tested the code on v5 and v7 hardware as that was what I had, but I
could still have compile tested it for v6.
--
Tixy
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: kprobes: work around build errors
2011-10-10 7:05 ` Tixy
@ 2011-10-10 7:40 ` Jon Medhurst (Tixy)
0 siblings, 0 replies; 4+ messages in thread
From: Jon Medhurst (Tixy) @ 2011-10-10 7:40 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 2011-10-10 at 08:05 +0100, Tixy wrote:
> On Sat, 2011-10-08 at 17:07 +0200, Arnd Bergmann wrote:
> > The errors for the thumb variant are using the same tool
> > chain, but obviously in v7 thumb2 mode. The error I got
> > is
> >
> > /tmp/cczp95OW.s:18721: Error: offset out of range
> >
> > Reducing the amount of padding in the "TEST_BF_X("bpl.w 2f",0x1000)"
> > test case resolves this, and I experimentally found 0xe20 to be the
> > maximum value in this location, but that is different if I change the
> > surrounding code. This one is much harder to reproduce and I can
> > provide the configuration file I used if that helps.
>
> The padding value of 0x1000 was deliberately chosen as it forces a
> different instruction encoding to be used. This encoding was introduced
> in ARMv6T2 so the test case should instead be made conditional on
> __LINUX_ARM_ARCH__ >= 7.
This last bit about adding __LINUX_ARM_ARCH__ >= 7 is obviously rubbish
as the Thumb tests are only ever compiled for v7 CPUs and that is what
you were doing. It seams that the problem may instead lie with the
toolchain or could it be a config issue where Thumb kernels are built
for v6 instruction set?
I believe the Thumb test tests were built OK in Linaro's 11.09 release
and the code compiles when I build for a BeagleBoard with gcc version
"4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu3)".
--
Tixy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-10 7:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-08 15:07 [PATCH] ARM: kprobes: work around build errors Arnd Bergmann
2011-10-08 15:35 ` Dr. David Alan Gilbert
2011-10-10 7:05 ` Tixy
2011-10-10 7:40 ` Jon Medhurst (Tixy)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).