2012-08-22 14:31:06

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 0/4] ARM: patches for randconfig build errors

Hi Russell,

I've done some testing with the experimental multiplatform tree
and that uncovered a few preexisting bugs. Here are the ones
that should go through your tree. Please have a look to
see if the fixes make sense. I can put the patches in the patch
tracker or send you a pull request then.

Arnd
---
Cc: Jon Medhurst <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Russell King <[email protected]>
Cc: Shinya Kuribayashi <[email protected]>
Cc: Stephen Boyd <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Will Deacon <[email protected]>

Arnd Bergmann (4):
ARM: export read_current_timer
ARM: allow PID_IN_CONTEXTIDR only for ARMv7
ARM: export set_irq_flags/irq_set_chip_and_handler
ARM: kprobes: make more tests conditional

arch/arm/Kconfig.debug | 1 +
arch/arm/kernel/arch_timer.c | 2 ++
arch/arm/kernel/irq.c | 2 ++
arch/arm/kernel/kprobes-test-arm.c | 4 +++-
kernel/irq/chip.c | 2 ++
5 files changed, 10 insertions(+), 1 deletion(-)

--
1.7.10


2012-08-22 14:30:05

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 4/4] ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we
should make the test conditional on at least ARMv7. ldrex/strex
are available in ARMv6K or ARMv7, which we can test by checking
the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
/tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
/tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Jon Medhurst <[email protected]>
Cc: Russell King <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Leif Lindholm <[email protected]>
---
arch/arm/kernel/kprobes-test-arm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
index 38c1a3b..3e87ff7 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")
@@ -454,7 +456,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
+#ifdef CONFIG_CPU_32v6K
TEST_UNSUPPORTED("ldrex r2, [sp]")
TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
--
1.7.10

2012-08-22 14:30:12

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 2/4] ARM: allow PID_IN_CONTEXTIDR only for ARMv7

When ARMv6 is enabled, we build the kernel with -march=armv6 or
-march=armv6k, which means the bfi instruction is not available.
Instead, it only works with -march=armv6t2 or -march=armv7-a.

Without this patch, building rand-enIHAOL results in:

/tmp/ccwCsCXC.s: Assembler messages:
/tmp/ccwCsCXC.s:49: Error: selected processor does not support ARM mode `bfi r3,r2,#0,#8'

Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/Kconfig.debug | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index f15f82b..11b9ff4 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -398,6 +398,7 @@ config ARM_KPROBES_TEST
config PID_IN_CONTEXTIDR
bool "Write the current PID to the CONTEXTIDR register"
depends on CPU_COPY_V6
+ depends on CPU_V7 && !CPU_V6
help
Enabling this option causes the kernel to write the current PID to
the PROCID field of the CONTEXTIDR register, at the expense of some
--
1.7.10

2012-08-22 14:30:19

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 3/4] ARM: export set_irq_flags/irq_set_chip_and_handler

The recently added Emma Mobile GPIO driver calls set_irq_flags
and irq_set_chip_and_handler for the interrupts it exports and
it can be built as a module, which currently fails with

ERROR: "set_irq_flags" [drivers/gpio/gpio-em.ko] undefined!
ERROR: "irq_set_chip_and_handler_name" [drivers/gpio/gpio-em.ko] undefined!

We either need to replace the call to set_irq_flags with something
else or export that function. This patch does the latter.

Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/kernel/irq.c | 2 ++
kernel/irq/chip.c | 2 ++
2 files changed, 4 insertions(+)

diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 16cedb4..8961650 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -34,6 +34,7 @@
#include <linux/list.h>
#include <linux/kallsyms.h>
#include <linux/proc_fs.h>
+#include <linux/export.h>

#include <asm/exception.h>
#include <asm/mach/arch.h>
@@ -109,6 +110,7 @@ void set_irq_flags(unsigned int irq, unsigned int iflags)
/* Order is clear bits in "clr" then set bits in "set" */
irq_modify_status(irq, clr, set & ~clr);
}
+EXPORT_SYMBOL_GPL(set_irq_flags);

void __init init_IRQ(void)
{
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index eebd6d5..3c3cea3 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -13,6 +13,7 @@
#include <linux/irq.h>
#include <linux/msi.h>
#include <linux/module.h>
+#include <linux/export.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>

@@ -671,6 +672,7 @@ irq_set_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
irq_set_chip(irq, chip);
__irq_set_handler(irq, handle, 0, name);
}
+EXPORT_SYMBOL_GPL(irq_set_chip_and_handler_name);

void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
{
--
1.7.10

2012-08-22 14:30:23

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 1/4] ARM: export read_current_timer

read_current_timer is used in the get_cycles() function when
ARM_ARCH_TIMER is set, and that function can be inlined into
driver modules, so we should export the function to avoid
errors like

ERROR: "read_current_timer" [drivers/video/udlfb.ko] undefined!
ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!

Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Shinya Kuribayashi <[email protected]>
Cc: Stephen Boyd <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/kernel/arch_timer.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index cf25880..6327d1f 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -14,6 +14,7 @@
#include <linux/device.h>
#include <linux/smp.h>
#include <linux/cpu.h>
+#include <linux/export.h>
#include <linux/jiffies.h>
#include <linux/clockchips.h>
#include <linux/interrupt.h>
@@ -232,6 +233,7 @@ int read_current_timer(unsigned long *timer_val)
*timer_val = arch_counter_get_cntpct();
return 0;
}
+EXPORT_SYMBOL_GPL(read_current_timer);

static struct clocksource clocksource_counter = {
.name = "arch_sys_counter",
--
1.7.10

2012-08-22 14:40:17

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH 2/4] ARM: allow PID_IN_CONTEXTIDR only for ARMv7

Hi Arnd,

On Wed, Aug 22, 2012 at 03:29:38PM +0100, Arnd Bergmann wrote:
> When ARMv6 is enabled, we build the kernel with -march=armv6 or
> -march=armv6k, which means the bfi instruction is not available.
> Instead, it only works with -march=armv6t2 or -march=armv7-a.
>
> Without this patch, building rand-enIHAOL results in:
>
> /tmp/ccwCsCXC.s: Assembler messages:
> /tmp/ccwCsCXC.s:49: Error: selected processor does not support ARM mode `bfi r3,r2,#0,#8'
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: Russell King <[email protected]>
> ---
> arch/arm/Kconfig.debug | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index f15f82b..11b9ff4 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -398,6 +398,7 @@ config ARM_KPROBES_TEST
> config PID_IN_CONTEXTIDR
> bool "Write the current PID to the CONTEXTIDR register"
> depends on CPU_COPY_V6
> + depends on CPU_V7 && !CPU_V6
> help
> Enabling this option causes the kernel to write the current PID to
> the PROCID field of the CONTEXTIDR register, at the expense of some

Nah, I'll fix the contextidr_notifier instead. I forgot that this stuff gets
used on non-SMP v6 platforms.

Cheers,

Will

2012-08-22 14:42:45

by Nicolas Pitre

[permalink] [raw]
Subject: Re: [PATCH 4/4] ARM: kprobes: make more tests conditional

On Wed, 22 Aug 2012, Arnd Bergmann wrote:

> The mls instruction is not available in ARMv6K or below, so we
> should make the test conditional on at least ARMv7. ldrex/strex
> are available in ARMv6K or ARMv7, which we can test by checking
> the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

The ldrex/strex instructions are available on ARMv6. It's only the d
variants (strexd/ldrexd) which are only available from ARMv6k.


Nicolas

2012-08-22 14:44:55

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 2/4] ARM: allow PID_IN_CONTEXTIDR only for ARMv7

On Wednesday 22 August 2012, Will Deacon wrote:
> > @@ -398,6 +398,7 @@ config ARM_KPROBES_TEST
> > config PID_IN_CONTEXTIDR
> > bool "Write the current PID to the CONTEXTIDR register"
> > depends on CPU_COPY_V6
> > + depends on CPU_V7 && !CPU_V6
> > help
> > Enabling this option causes the kernel to write the current PID to
> > the PROCID field of the CONTEXTIDR register, at the expense of some
>
> Nah, I'll fix the contextidr_notifier instead. I forgot that this stuff gets
> used on non-SMP v6 platforms.
>

Ok, thanks!

Arnd

2012-08-22 15:19:27

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 4/4] ARM: kprobes: make more tests conditional

On Wednesday 22 August 2012, Nicolas Pitre wrote:
> On Wed, 22 Aug 2012, Arnd Bergmann wrote:
>
> > The mls instruction is not available in ARMv6K or below, so we
> > should make the test conditional on at least ARMv7. ldrex/strex
> > are available in ARMv6K or ARMv7, which we can test by checking
> > the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.
>
> The ldrex/strex instructions are available on ARMv6. It's only the d
> variants (strexd/ldrexd) which are only available from ARMv6k.

Ok. How is the version below then? I haven't tested this one yet.

Arnd

8<---
>From d878ab212cf0ac1957be83ad80dc734ace2b476c Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 16 Aug 2012 07:49:31 +0000
Subject: [PATCH] ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we
should make the test conditional on at least ARMv7. ldrexd/strexd
are available in ARMv6K or ARMv7, which we can test by checking
the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
/tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
/tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Jon Medhurst <[email protected]>
Cc: Russell King <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Leif Lindholm <[email protected]>
---
arch/arm/kernel/kprobes-test-arm.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
index 38c1a3b..fc9f6e0 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")
@@ -456,8 +458,10 @@ void kprobe_arm_test_cases(void)
TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
#if __LINUX_ARM_ARCH__ >= 6
TEST_UNSUPPORTED("ldrex r2, [sp]")
+#ifdef CONFIG_CPU_32v6K
TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
+#endif
TEST_UNSUPPORTED("strexb r0, r2, [sp]")
TEST_UNSUPPORTED("ldrexb r2, [sp]")
TEST_UNSUPPORTED("strexh r0, r2, [sp]")
--
1.7.10

2012-08-22 15:38:51

by Nicolas Pitre

[permalink] [raw]
Subject: Re: [PATCH 4/4] ARM: kprobes: make more tests conditional

On Wed, 22 Aug 2012, Arnd Bergmann wrote:

> On Wednesday 22 August 2012, Nicolas Pitre wrote:
> > On Wed, 22 Aug 2012, Arnd Bergmann wrote:
> >
> > > The mls instruction is not available in ARMv6K or below, so we
> > > should make the test conditional on at least ARMv7. ldrex/strex
> > > are available in ARMv6K or ARMv7, which we can test by checking
> > > the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.
> >
> > The ldrex/strex instructions are available on ARMv6. It's only the d
> > variants (strexd/ldrexd) which are only available from ARMv6k.
>
> Ok. How is the version below then? I haven't tested this one yet.

In fact, I think the b variants are ARMv6k+ as well. Only the plain
(non b non d) variants are available on ARMv6.


>
> Arnd
>
> 8<---
> From d878ab212cf0ac1957be83ad80dc734ace2b476c Mon Sep 17 00:00:00 2001
> From: Arnd Bergmann <[email protected]>
> Date: Thu, 16 Aug 2012 07:49:31 +0000
> Subject: [PATCH] ARM: kprobes: make more tests conditional
>
> The mls instruction is not available in ARMv6K or below, so we
> should make the test conditional on at least ARMv7. ldrexd/strexd
> are available in ARMv6K or ARMv7, which we can test by checking
> the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.
>
> /tmp/ccuMTZ8D.s: Assembler messages:
> /tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
> /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
> /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Jon Medhurst <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Nicolas Pitre <[email protected]>
> Cc: Leif Lindholm <[email protected]>
> ---
> arch/arm/kernel/kprobes-test-arm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
> index 38c1a3b..fc9f6e0 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")
> @@ -456,8 +458,10 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
> #if __LINUX_ARM_ARCH__ >= 6
> TEST_UNSUPPORTED("ldrex r2, [sp]")
> +#ifdef CONFIG_CPU_32v6K
> TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
> TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
> +#endif
> TEST_UNSUPPORTED("strexb r0, r2, [sp]")
> TEST_UNSUPPORTED("ldrexb r2, [sp]")
> TEST_UNSUPPORTED("strexh r0, r2, [sp]")
> --
> 1.7.10
>

2012-08-22 17:15:19

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 1/4] ARM: export read_current_timer

On 08/22/12 07:29, Arnd Bergmann wrote:
> read_current_timer is used in the get_cycles() function when
> ARM_ARCH_TIMER is set, and that function can be inlined into
> driver modules, so we should export the function to avoid
> errors like
>
> ERROR: "read_current_timer" [drivers/video/udlfb.ko] undefined!
> ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Shinya Kuribayashi <[email protected]>

Acked-by: Stephen Boyd <[email protected]>

I ran into this last week but forgot to send the patch. Thanks.

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

2012-08-22 17:50:17

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH 1/4] ARM: export read_current_timer

On Wed, Aug 22, 2012 at 06:15:14PM +0100, Stephen Boyd wrote:
> On 08/22/12 07:29, Arnd Bergmann wrote:
> > read_current_timer is used in the get_cycles() function when
> > ARM_ARCH_TIMER is set, and that function can be inlined into
> > driver modules, so we should export the function to avoid
> > errors like
> >
> > ERROR: "read_current_timer" [drivers/video/udlfb.ko] undefined!
> > ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!
> >
> > Signed-off-by: Arnd Bergmann <[email protected]>
> > Cc: Shinya Kuribayashi <[email protected]>
>
> Acked-by: Stephen Boyd <[email protected]>
>
> I ran into this last week but forgot to send the patch. Thanks.

Looks good to me, thanks Arnd:

Acked-by: Will Deacon <[email protected]>

On the topic of the timer stuff: Shinya/Stephen, did you have a chance to
look at the registration stuff that was proposed? I'm happy to push it if
people will actually use it.

Cheers,

Will

2012-08-22 17:57:34

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 1/4] ARM: export read_current_timer

On 08/22/12 10:49, Will Deacon wrote:
> On the topic of the timer stuff: Shinya/Stephen, did you have a chance to
> look at the registration stuff that was proposed? I'm happy to push it if
> people will actually use it.

Yes I have tested it on our internal trees and it looks good. I plan to
send a patch to move MSM's timers over to it later this week so that we
have at least two users upstream.

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

2012-08-22 17:58:29

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH 1/4] ARM: export read_current_timer

On Wed, Aug 22, 2012 at 06:57:20PM +0100, Stephen Boyd wrote:
> On 08/22/12 10:49, Will Deacon wrote:
> > On the topic of the timer stuff: Shinya/Stephen, did you have a chance to
> > look at the registration stuff that was proposed? I'm happy to push it if
> > people will actually use it.
>
> Yes I have tested it on our internal trees and it looks good. I plan to
> send a patch to move MSM's timers over to it later this week so that we
> have at least two users upstream.

Awesome, I'll dust that series off at -rc3 then.

Will

2012-08-22 18:41:45

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCHv3 4/4] ARM: kprobes: make more tests conditional

On Wednesday 22 August 2012, Nicolas Pitre wrote:
> On Wed, 22 Aug 2012, Arnd Bergmann wrote:
> > >
> > > The ldrex/strex instructions are available on ARMv6. It's only the d
> > > variants (strexd/ldrexd) which are only available from ARMv6k.
> >
> > Ok. How is the version below then? I haven't tested this one yet.
>
> In fact, I think the b variants are ARMv6k+ as well. Only the plain
> (non b non d) variants are available on ARMv6.

Ok, third attempt then. This leaves ldrex for ARMv6 but marks
{st,ld}rex{b,h,d} as V6K specific (which includes ARMv7).

Arnd

8<-----
>From 6eab418c61c18393006f30d189e2f28d6e403040 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 16 Aug 2012 07:49:31 +0000
Subject: [PATCH] ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we
should make the test conditional on at least ARMv7. ldrexd/strexd
are available in ARMv6K or ARMv7, which we can test by checking
the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
/tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
/tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Jon Medhurst <[email protected]>
Cc: Russell King <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Leif Lindholm <[email protected]>
---
arch/arm/kernel/kprobes-test-arm.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
index 38c1a3b..58dd6c3 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")
@@ -456,6 +458,7 @@ void kprobe_arm_test_cases(void)
TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
#if __LINUX_ARM_ARCH__ >= 6
TEST_UNSUPPORTED("ldrex r2, [sp]")
+#ifdef CONFIG_CPU_32v6K
TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
TEST_UNSUPPORTED("strexb r0, r2, [sp]")
@@ -463,6 +466,7 @@ void kprobe_arm_test_cases(void)
TEST_UNSUPPORTED("strexh r0, r2, [sp]")
TEST_UNSUPPORTED("ldrexh r2, [sp]")
#endif
+#endif
TEST_GROUP("Extra load/store instructions")

TEST_RPR( "strh r",0, VAL1,", [r",1, 48,", -r",2, 24,"]")
--
1.7.10


2012-08-22 19:44:02

by Nicolas Pitre

[permalink] [raw]
Subject: Re: [PATCHv3 4/4] ARM: kprobes: make more tests conditional

On Wed, 22 Aug 2012, Arnd Bergmann wrote:

> On Wednesday 22 August 2012, Nicolas Pitre wrote:
> > On Wed, 22 Aug 2012, Arnd Bergmann wrote:
> > > >
> > > > The ldrex/strex instructions are available on ARMv6. It's only the d
> > > > variants (strexd/ldrexd) which are only available from ARMv6k.
> > >
> > > Ok. How is the version below then? I haven't tested this one yet.
> >
> > In fact, I think the b variants are ARMv6k+ as well. Only the plain
> > (non b non d) variants are available on ARMv6.
>
> Ok, third attempt then. This leaves ldrex for ARMv6 but marks
> {st,ld}rex{b,h,d} as V6K specific (which includes ARMv7).
>
> Arnd
>
> 8<-----
> From 6eab418c61c18393006f30d189e2f28d6e403040 Mon Sep 17 00:00:00 2001
> From: Arnd Bergmann <[email protected]>
> Date: Thu, 16 Aug 2012 07:49:31 +0000
> Subject: [PATCH] ARM: kprobes: make more tests conditional
>
> The mls instruction is not available in ARMv6K or below, so we
> should make the test conditional on at least ARMv7. ldrexd/strexd
> are available in ARMv6K or ARMv7, which we can test by checking
> the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.
>
> /tmp/ccuMTZ8D.s: Assembler messages:
> /tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
> /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
> /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Jon Medhurst <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Nicolas Pitre <[email protected]>
> Cc: Leif Lindholm <[email protected]>

Acked-by: Nicolas Pitre <[email protected]>


> ---
> arch/arm/kernel/kprobes-test-arm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
> index 38c1a3b..58dd6c3 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")
> @@ -456,6 +458,7 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
> #if __LINUX_ARM_ARCH__ >= 6
> TEST_UNSUPPORTED("ldrex r2, [sp]")
> +#ifdef CONFIG_CPU_32v6K
> TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
> TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
> TEST_UNSUPPORTED("strexb r0, r2, [sp]")
> @@ -463,6 +466,7 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED("strexh r0, r2, [sp]")
> TEST_UNSUPPORTED("ldrexh r2, [sp]")
> #endif
> +#endif
> TEST_GROUP("Extra load/store instructions")
>
> TEST_RPR( "strh r",0, VAL1,", [r",1, 48,", -r",2, 24,"]")
> --
> 1.7.10
>
>
>

2012-08-22 23:52:18

by Tixy

[permalink] [raw]
Subject: Re: [PATCHv3 4/4] ARM: kprobes: make more tests conditional

On Wed, 2012-08-22 at 18:41 +0000, Arnd Bergmann wrote:
> On Wednesday 22 August 2012, Nicolas Pitre wrote:
> > On Wed, 22 Aug 2012, Arnd Bergmann wrote:
> > > >
> > > > The ldrex/strex instructions are available on ARMv6. It's only the d
> > > > variants (strexd/ldrexd) which are only available from ARMv6k.
> > >
> > > Ok. How is the version below then? I haven't tested this one yet.
> >
> > In fact, I think the b variants are ARMv6k+ as well. Only the plain
> > (non b non d) variants are available on ARMv6.
>
> Ok, third attempt then. This leaves ldrex for ARMv6 but marks
> {st,ld}rex{b,h,d} as V6K specific (which includes ARMv7).

ARMv7 does set CPU_32v6K, because arch/arm/mm/Kconfig has

config CPU_V7
bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX
select CPU_32v6K
select CPU_32v7

but this seems more for peripheral reasons not because all the various
CPU configs systematically select the earlier architecture variants,
e.g. CPU_V7 doesn't select CPU_32v6.

So I would have been inclined to test for

#if defined(CONFIG_CPU_32v6K) || (__LINUX_ARM_ARCH__ >= 7)

but as the current patch is functionally correct I'm not going to
suggest a v4 patch :-)

If you do feel so inclined for a v4 however ;-) you could also make the
mls part of the patch tidier by moving the added #endif to instead
terminate the preceding "#if __LINUX_ARM_ARCH__ >= 6", i.e.

@@ -367,8 +367,10 @@ void kprobe_arm_test_cases(void)
TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
+#endif

+#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")


this looks funny in patch form, but the resulting source file is more
consistent with other conditional tests.


> Arnd
>
> 8<-----
> From 6eab418c61c18393006f30d189e2f28d6e403040 Mon Sep 17 00:00:00 2001
> From: Arnd Bergmann <[email protected]>
> Date: Thu, 16 Aug 2012 07:49:31 +0000
> Subject: [PATCH] ARM: kprobes: make more tests conditional
>
> The mls instruction is not available in ARMv6K or below, so we
> should make the test conditional on at least ARMv7. ldrexd/strexd
> are available in ARMv6K or ARMv7, which we can test by checking
> the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.
>
> /tmp/ccuMTZ8D.s: Assembler messages:
> /tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
> /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
> /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Jon Medhurst <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Nicolas Pitre <[email protected]>
> Cc: Leif Lindholm <[email protected]>
> ---
> arch/arm/kernel/kprobes-test-arm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
> index 38c1a3b..58dd6c3 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")
> @@ -456,6 +458,7 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
> #if __LINUX_ARM_ARCH__ >= 6
> TEST_UNSUPPORTED("ldrex r2, [sp]")
> +#ifdef CONFIG_CPU_32v6K
> TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
> TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
> TEST_UNSUPPORTED("strexb r0, r2, [sp]")
> @@ -463,6 +466,7 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED("strexh r0, r2, [sp]")
> TEST_UNSUPPORTED("ldrexh r2, [sp]")
> #endif
> +#endif
> TEST_GROUP("Extra load/store instructions")
>
> TEST_RPR( "strh r",0, VAL1,", [r",1, 48,", -r",2, 24,"]")

2012-08-23 03:57:07

by Shinya Kuribayashi

[permalink] [raw]
Subject: Re: [PATCH 1/4] ARM: export read_current_timer

On 8/23/2012 2:49 AM, Will Deacon wrote:
> On Wed, Aug 22, 2012 at 06:15:14PM +0100, Stephen Boyd wrote:
>> On 08/22/12 07:29, Arnd Bergmann wrote:
>>> read_current_timer is used in the get_cycles() function when
>>> ARM_ARCH_TIMER is set, and that function can be inlined into
>>> driver modules, so we should export the function to avoid
>>> errors like
>>>
>>> ERROR: "read_current_timer" [drivers/video/udlfb.ko] undefined!
>>> ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!
>>>
>>> Signed-off-by: Arnd Bergmann <[email protected]>
>>> Cc: Shinya Kuribayashi <[email protected]>
>>
>> Acked-by: Stephen Boyd <[email protected]>
>>
>> I ran into this last week but forgot to send the patch. Thanks.
>
> Looks good to me, thanks Arnd:
>
> Acked-by: Will Deacon <[email protected]>

I haven't hit with this so far with our configs though, but why not?

Acked-by: Shinya Kuribayashi <[email protected]>

2012-08-23 04:23:59

by Shinya Kuribayashi

[permalink] [raw]
Subject: Re: [PATCH 1/4] ARM: export read_current_timer

On 8/23/2012 2:58 AM, Will Deacon wrote:
> On Wed, Aug 22, 2012 at 06:57:20PM +0100, Stephen Boyd wrote:
>> On 08/22/12 10:49, Will Deacon wrote:
>>> On the topic of the timer stuff: Shinya/Stephen, did you have a chance to
>>> look at the registration stuff that was proposed? I'm happy to push it if
>>> people will actually use it.
>>
>> Yes I have tested it on our internal trees and it looks good. I plan to
>> send a patch to move MSM's timers over to it later this week so that we
>> have at least two users upstream.

And I think other A9 MPcore platforms, namely OMAP and EXYNOS, would
also be candidates, who tried to skip calibrate_delay() in the past
(OMAP) or currently provide non-smp_twd timers as localtimers (EXYNOS).
I may miss the latest status of those BSPs, but believe that we would
have more users (>2) in the future.

> Awesome, I'll dust that series off at -rc3 then.

It works for me for weeks without troubles, looking forward to it.
--
Shinya Kuribayashi
Renesas Electronics

2012-08-23 12:09:37

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCHv4 4/4] ARM: kprobes: make more tests conditional

On Wednesday 22 August 2012, Tixy wrote:

> If you do feel so inclined for a v4 however ;-) you could also make the
> mls part of the patch tidier by moving the added #endif to instead
> terminate the preceding "#if __LINUX_ARM_ARCH__ >= 6", i.e.
>
> @@ -367,8 +367,10 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
> TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
> +#endif
>
> +#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")
>
>
> this looks funny in patch form, but the resulting source file is more
> consistent with other conditional tests.

Ok, here we go.

Arnd


commit abfef4db8731591fbb721262bd4712662aaa6d14
Author: Arnd Bergmann <[email protected]>
Date: Thu Aug 16 07:49:31 2012 +0000

ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we
should make the test conditional on at least ARMv7. ldrexd/strexd
are available in ARMv6K or ARMv7, which we can test by checking
the CONFIG_CPU_32v6K symbol.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
/tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
/tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Signed-off-by: Arnd Bergmann <[email protected]>
Cc: Jon Medhurst <[email protected]>
Cc: Russell King <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Leif Lindholm <[email protected]>

diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
index 38c1a3b..8393129 100644
--- a/arch/arm/kernel/kprobes-test-arm.c
+++ b/arch/arm/kernel/kprobes-test-arm.c
@@ -366,7 +366,9 @@ void kprobe_arm_test_cases(void)
TEST_UNSUPPORTED(".word 0xe04f0392 @ umaal r0, pc, r2, r3")
TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
+#endif

+#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")
@@ -456,6 +458,8 @@ void kprobe_arm_test_cases(void)
TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
#if __LINUX_ARM_ARCH__ >= 6
TEST_UNSUPPORTED("ldrex r2, [sp]")
+#endif
+#if (__LINUX_ARM_ARCH__ >= 7) || defined(CONFIG_CPU_32v6K)
TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
TEST_UNSUPPORTED("strexb r0, r2, [sp]")

2012-08-23 12:26:09

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCHv3 4/4] ARM: kprobes: make more tests conditional

On Thu, Aug 23, 2012 at 12:51:01AM +0100, Tixy wrote:
> On Wed, 2012-08-22 at 18:41 +0000, Arnd Bergmann wrote:
> > On Wednesday 22 August 2012, Nicolas Pitre wrote:
> > > On Wed, 22 Aug 2012, Arnd Bergmann wrote:
> > > > >
> > > > > The ldrex/strex instructions are available on ARMv6. It's only the d
> > > > > variants (strexd/ldrexd) which are only available from ARMv6k.
> > > >
> > > > Ok. How is the version below then? I haven't tested this one yet.
> > >
> > > In fact, I think the b variants are ARMv6k+ as well. Only the plain
> > > (non b non d) variants are available on ARMv6.
> >
> > Ok, third attempt then. This leaves ldrex for ARMv6 but marks
> > {st,ld}rex{b,h,d} as V6K specific (which includes ARMv7).
>
> ARMv7 does set CPU_32v6K, because arch/arm/mm/Kconfig has
>
> config CPU_V7
> bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX
> select CPU_32v6K
> select CPU_32v7
>
> but this seems more for peripheral reasons not because all the various
> CPU configs systematically select the earlier architecture variants,
> e.g. CPU_V7 doesn't select CPU_32v6.
>
> So I would have been inclined to test for
>
> #if defined(CONFIG_CPU_32v6K) || (__LINUX_ARM_ARCH__ >= 7)

FWIW, the selection of the optimised atomic64 implementation for ARM (which
uses the double-word exclusive instructions) boils down to CONFIG_CPU_32v6K,
so I think the additional __LINUX_ARM_ARCH__ check is probably overkill.

Will

2012-08-23 17:30:29

by Tixy

[permalink] [raw]
Subject: Re: [PATCHv4 4/4] ARM: kprobes: make more tests conditional

On Thu, 2012-08-23 at 12:09 +0000, Arnd Bergmann wrote:
> commit abfef4db8731591fbb721262bd4712662aaa6d14
> Author: Arnd Bergmann <[email protected]>
> Date: Thu Aug 16 07:49:31 2012 +0000
>
> ARM: kprobes: make more tests conditional
>
> The mls instruction is not available in ARMv6K or below, so we
> should make the test conditional on at least ARMv7. ldrexd/strexd
> are available in ARMv6K or ARMv7, which we can test by checking
> the CONFIG_CPU_32v6K symbol.
>
> /tmp/ccuMTZ8D.s: Assembler messages:
> /tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
> /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
> /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Jon Medhurst <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Nicolas Pitre <[email protected]>
> Cc: Leif Lindholm <[email protected]>

Thanks for your indulgence :-) With the white-space damage fixed...

Acked-by: Jon Medhurst <[email protected]>

I test built this for v6, v6k and v7 before and after applying the patch
to verify if behaves as expected, so you can add my Tested-by if you
want.

I also tried a v4 platform (forgot we supported those) and there will be
a patch coming to fix that...


> diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
> index 38c1a3b..8393129 100644
> --- a/arch/arm/kernel/kprobes-test-arm.c
> +++ b/arch/arm/kernel/kprobes-test-arm.c
> @@ -366,7 +366,9 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe04f0392 @ umaal r0, pc, r2, r3")
> TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
> TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
> +#endif
>
> +#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")
> @@ -456,6 +458,8 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
> #if __LINUX_ARM_ARCH__ >= 6
> TEST_UNSUPPORTED("ldrex r2, [sp]")
> +#endif
> +#if (__LINUX_ARM_ARCH__ >= 7) || defined(CONFIG_CPU_32v6K)
> TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
> TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
> TEST_UNSUPPORTED("strexb r0, r2, [sp]")

2012-08-23 18:04:27

by Nicolas Pitre

[permalink] [raw]
Subject: Re: [PATCHv4 4/4] ARM: kprobes: make more tests conditional

On Thu, 23 Aug 2012, Arnd Bergmann wrote:

> On Wednesday 22 August 2012, Tixy wrote:
>
> > If you do feel so inclined for a v4 however ;-) you could also make the
> > mls part of the patch tidier by moving the added #endif to instead
> > terminate the preceding "#if __LINUX_ARM_ARCH__ >= 6", i.e.
> >
> > @@ -367,8 +367,10 @@ void kprobe_arm_test_cases(void)
> > TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
> > TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
> > +#endif
> >
> > +#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")
> >
> >
> > this looks funny in patch form, but the resulting source file is more
> > consistent with other conditional tests.
>
> Ok, here we go.
>
> Arnd
>
>
> commit abfef4db8731591fbb721262bd4712662aaa6d14
> Author: Arnd Bergmann <[email protected]>
> Date: Thu Aug 16 07:49:31 2012 +0000
>
> ARM: kprobes: make more tests conditional
>
> The mls instruction is not available in ARMv6K or below, so we
> should make the test conditional on at least ARMv7. ldrexd/strexd
> are available in ARMv6K or ARMv7, which we can test by checking
> the CONFIG_CPU_32v6K symbol.
>
> /tmp/ccuMTZ8D.s: Assembler messages:
> /tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode `mls r0,r1,r2,r3'
> /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode `mlshi r7,r8,r9,r10'
> /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Cc: Jon Medhurst <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Nicolas Pitre <[email protected]>
> Cc: Leif Lindholm <[email protected]>

Acked-by: Nicolas Pitre <[email protected]>


>
> diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
> index 38c1a3b..8393129 100644
> --- a/arch/arm/kernel/kprobes-test-arm.c
> +++ b/arch/arm/kernel/kprobes-test-arm.c
> @@ -366,7 +366,9 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe04f0392 @ umaal r0, pc, r2, r3")
> TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
> TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
> +#endif
>
> +#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")
> @@ -456,6 +458,8 @@ void kprobe_arm_test_cases(void)
> TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */
> #if __LINUX_ARM_ARCH__ >= 6
> TEST_UNSUPPORTED("ldrex r2, [sp]")
> +#endif
> +#if (__LINUX_ARM_ARCH__ >= 7) || defined(CONFIG_CPU_32v6K)
> TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]")
> TEST_UNSUPPORTED("ldrexd r2, r3, [sp]")
> TEST_UNSUPPORTED("strexb r0, r2, [sp]")
>