* [PATCH] ARM: perf: modify kuser rmb() call to compile for Thumb-2
@ 2010-03-03 11:47 Will Deacon
2010-03-03 11:56 ` Jamie Iles
2010-03-04 16:33 ` [tip:perf/pebs] perf, ARM: Modify " tip-bot for Will Deacon
0 siblings, 2 replies; 3+ messages in thread
From: Will Deacon @ 2010-03-03 11:47 UTC (permalink / raw)
To: linux-kernel
Cc: Will Deacon, Russell King - ARM Linux, Jamie Iles, Ingo Molnar
The Thumb-2 instruction set does not provide an encoding
for sub pc, r0, #95 as present in the rmb() definition used
by perf. This results in compilation failure when using a
compiler targetting an instruction set other than ARM.
This patch redefines rmb() for ARM by casting the address
of the kuser helper to a function pointer, therefore getting
the compiler to take care of making the call.
Patch taken against tip/master.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Jamie Iles <jamie.iles@picochip.com>
Cc: Ingo Molnar <mingo@elte.hu>
---
tools/perf/perf.h | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 75f941b..6fb379b 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -65,9 +65,7 @@
* Use the __kuser_memory_barrier helper in the CPU helper page. See
* arch/arm/kernel/entry-armv.S in the kernel source for details.
*/
-#define rmb() asm volatile("mov r0, #0xffff0fff; mov lr, pc;" \
- "sub pc, r0, #95" ::: "r0", "lr", "cc", \
- "memory")
+#define rmb() ((void(*)(void))0xffff0fa0)()
#define cpu_relax() asm volatile("":::"memory")
#endif
--
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: perf: modify kuser rmb() call to compile for Thumb-2
2010-03-03 11:47 [PATCH] ARM: perf: modify kuser rmb() call to compile for Thumb-2 Will Deacon
@ 2010-03-03 11:56 ` Jamie Iles
2010-03-04 16:33 ` [tip:perf/pebs] perf, ARM: Modify " tip-bot for Will Deacon
1 sibling, 0 replies; 3+ messages in thread
From: Jamie Iles @ 2010-03-03 11:56 UTC (permalink / raw)
To: Will Deacon
Cc: linux-kernel, Russell King - ARM Linux, Jamie Iles, Ingo Molnar
On Wed, Mar 03, 2010 at 11:47:58AM +0000, Will Deacon wrote:
> The Thumb-2 instruction set does not provide an encoding
> for sub pc, r0, #95 as present in the rmb() definition used
> by perf. This results in compilation failure when using a
> compiler targetting an instruction set other than ARM.
>
> This patch redefines rmb() for ARM by casting the address
> of the kuser helper to a function pointer, therefore getting
> the compiler to take care of making the call.
>
> Patch taken against tip/master.
>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
> Cc: Jamie Iles <jamie.iles@picochip.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> ---
> tools/perf/perf.h | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/perf.h b/tools/perf/perf.h
> index 75f941b..6fb379b 100644
> --- a/tools/perf/perf.h
> +++ b/tools/perf/perf.h
> @@ -65,9 +65,7 @@
> * Use the __kuser_memory_barrier helper in the CPU helper page. See
> * arch/arm/kernel/entry-armv.S in the kernel source for details.
> */
> -#define rmb() asm volatile("mov r0, #0xffff0fff; mov lr, pc;" \
> - "sub pc, r0, #95" ::: "r0", "lr", "cc", \
> - "memory")
> +#define rmb() ((void(*)(void))0xffff0fa0)()
This will take care of doing the CPU barrier but don't we still need a
compiler memory barrier? I guess you could do:
#define rmb() ({ \
((void(*)(void))0xffff0fa0)(); \
asm volatile("" ::: "memory"); \
})
Jamie
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/pebs] perf, ARM: Modify kuser rmb() call to compile for Thumb-2
2010-03-03 11:47 [PATCH] ARM: perf: modify kuser rmb() call to compile for Thumb-2 Will Deacon
2010-03-03 11:56 ` Jamie Iles
@ 2010-03-04 16:33 ` tip-bot for Will Deacon
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Will Deacon @ 2010-03-04 16:33 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, will.deacon,
efault, jamie.iles, fweisbec, linux, tglx, mingo
Commit-ID: da7196e1f986c846ffa8b2ec385223fad38e8518
Gitweb: http://git.kernel.org/tip/da7196e1f986c846ffa8b2ec385223fad38e8518
Author: Will Deacon <will.deacon@arm.com>
AuthorDate: Wed, 3 Mar 2010 11:47:58 +0000
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 4 Mar 2010 12:13:28 +0100
perf, ARM: Modify kuser rmb() call to compile for Thumb-2
The Thumb-2 instruction set does not provide an encoding
for sub pc, r0, #95 as present in the rmb() definition used
by perf. This results in compilation failure when using a
compiler targetting an instruction set other than ARM.
This patch redefines rmb() for ARM by casting the address
of the kuser helper to a function pointer, therefore getting
the compiler to take care of making the call.
Patch taken against tip/master.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Jamie Iles <jamie.iles@picochip.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1267616878-2154-1-git-send-email-will.deacon@arm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/perf.h | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 75f941b..6fb379b 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -65,9 +65,7 @@
* Use the __kuser_memory_barrier helper in the CPU helper page. See
* arch/arm/kernel/entry-armv.S in the kernel source for details.
*/
-#define rmb() asm volatile("mov r0, #0xffff0fff; mov lr, pc;" \
- "sub pc, r0, #95" ::: "r0", "lr", "cc", \
- "memory")
+#define rmb() ((void(*)(void))0xffff0fa0)()
#define cpu_relax() asm volatile("":::"memory")
#endif
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-04 16:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-03 11:47 [PATCH] ARM: perf: modify kuser rmb() call to compile for Thumb-2 Will Deacon
2010-03-03 11:56 ` Jamie Iles
2010-03-04 16:33 ` [tip:perf/pebs] perf, ARM: Modify " tip-bot for Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox