[PATCH v2] x86, perf: Fix arch_perf_out_copy_user and copy_from_user_nmi return values

2013-08-16 Thread Jed Davis
on x86, and to help prevent bugs caused by this surprising difference (and simplify callers, which mostly want to know if the number of uncopied bytes is nonzero). Signed-off-by: Jed Davis --- arch/x86/kernel/cpu/perf_event.c | 8 ++-- arch/x86/kernel/cpu/perf_event_intel_ds.c | 6

[PATCH v2] x86, perf: Fix arch_perf_out_copy_user and copy_from_user_nmi return values

2013-08-16 Thread Jed Davis
on x86, and to help prevent bugs caused by this surprising difference (and simplify callers, which mostly want to know if the number of uncopied bytes is nonzero). Signed-off-by: Jed Davis j...@mozilla.com --- arch/x86/kernel/cpu/perf_event.c | 8 ++-- arch/x86/kernel/cpu

[PATCH 2/2] x86: Fix copy_from_user_nmi return to match copy_from_user.

2013-07-29 Thread Jed Davis
of uncopied bytes is nonzero). Signed-off-by: Jed Davis --- arch/x86/include/asm/perf_event.h | 9 + arch/x86/kernel/cpu/perf_event.c | 8 ++-- arch/x86/kernel/cpu/perf_event_intel_ds.c | 6 ++ arch/x86/kernel/cpu/perf_event_intel_lbr.c | 4 +--- arch/x86/lib

[PATCH 1/2] perf: Fix handling of arch_perf_out_copy_user return value.

2013-07-29 Thread Jed Davis
adds a second wrapper to re-reverse it for perf; the next patch in this series will clean it up. Signed-off-by: Jed Davis --- arch/x86/include/asm/perf_event.h | 9 - kernel/events/internal.h | 11 ++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch

Re: [PATCH] ARM: Fix r7/r11 confusion when CONFIG_THUMB2_KERNEL=y

2013-07-29 Thread Jed Davis
On Mon, Jul 22, 2013 at 07:52:39PM +0100, Dave Martin wrote: > On Sun, Jul 21, 2013 at 10:37:53PM +0100, Will Deacon wrote: > > Ok, I think I'm with you now. I also think that a better solution would be > > to try and limit the r7/fp confusion to one place, perhaps behind something > > like: > >

Re: [PATCH] ARM: Fix r7/r11 confusion when CONFIG_THUMB2_KERNEL=y

2013-07-29 Thread Jed Davis
On Mon, Jul 22, 2013 at 07:52:39PM +0100, Dave Martin wrote: On Sun, Jul 21, 2013 at 10:37:53PM +0100, Will Deacon wrote: Ok, I think I'm with you now. I also think that a better solution would be to try and limit the r7/fp confusion to one place, perhaps behind something like: void

[PATCH 1/2] perf: Fix handling of arch_perf_out_copy_user return value.

2013-07-29 Thread Jed Davis
adds a second wrapper to re-reverse it for perf; the next patch in this series will clean it up. Signed-off-by: Jed Davis j...@mozilla.com --- arch/x86/include/asm/perf_event.h | 9 - kernel/events/internal.h | 11 ++- 2 files changed, 18 insertions(+), 2 deletions

[PATCH 2/2] x86: Fix copy_from_user_nmi return to match copy_from_user.

2013-07-29 Thread Jed Davis
of uncopied bytes is nonzero). Signed-off-by: Jed Davis j...@mozilla.com --- arch/x86/include/asm/perf_event.h | 9 + arch/x86/kernel/cpu/perf_event.c | 8 ++-- arch/x86/kernel/cpu/perf_event_intel_ds.c | 6 ++ arch/x86/kernel/cpu/perf_event_intel_lbr.c | 4

Re: [PATCH] ARM: Fix r7/r11 confusion when CONFIG_THUMB2_KERNEL=y

2013-07-19 Thread Jed Davis
On Mon, Jul 15, 2013 at 02:54:20PM +0100, Will Deacon wrote: > On Sat, Jul 13, 2013 at 04:18:20AM +0100, Jed Davis wrote: [...] > > Effects of this are probably limited to failure of EHABI unwinding when > > starting from a function that uses r7 to restore it

Re: [PATCH] ARM: perf: Implement perf_arch_fetch_caller_regs

2013-07-19 Thread Jed Davis
On Mon, Jul 15, 2013 at 02:53:42PM +0100, Will Deacon wrote: > On Sat, Jul 13, 2013 at 04:17:14AM +0100, Jed Davis wrote: [...] > > +#ifdef CONFIG_THUMB2_KERNEL > > +#define perf_arch_fetch_caller_regs(regs, ip) &

Re: [PATCH] ARM: perf: Implement perf_arch_fetch_caller_regs

2013-07-19 Thread Jed Davis
On Mon, Jul 15, 2013 at 02:53:42PM +0100, Will Deacon wrote: On Sat, Jul 13, 2013 at 04:17:14AM +0100, Jed Davis wrote: [...] +#ifdef CONFIG_THUMB2_KERNEL +#define perf_arch_fetch_caller_regs(regs, ip) \ + do

Re: [PATCH] ARM: Fix r7/r11 confusion when CONFIG_THUMB2_KERNEL=y

2013-07-19 Thread Jed Davis
On Mon, Jul 15, 2013 at 02:54:20PM +0100, Will Deacon wrote: On Sat, Jul 13, 2013 at 04:18:20AM +0100, Jed Davis wrote: [...] Effects of this are probably limited to failure of EHABI unwinding when starting from a function that uses r7 to restore its stack pointer, but the possibility

[PATCH] ARM: Fix r7/r11 confusion when CONFIG_THUMB2_KERNEL=y

2013-07-12 Thread Jed Davis
e its stack pointer, but the possibility for further breakage (which would be invisible on non-Thumb kernels) is worrying. With this change, it is hoped, r7 is consistently referred to as "r7", and "fp" always means r11; this costs a few extra ifdefs, but it should help prevent future

[PATCH] ARM: perf: Implement perf_arch_fetch_caller_regs

2013-07-12 Thread Jed Davis
at which perf_arch_fetch_caller_regs is expanded, instead of that function activation's call site, because we need SP and PC to be consistent for EHABI unwinding; hopefully nothing will be inconvenienced by the extra stack frame. Signed-off-by: Jed Davis --- arch/arm/include/asm/perf_event.h | 43

[PATCH] ARM: Fix r7/r11 confusion when CONFIG_THUMB2_KERNEL=y

2013-07-12 Thread Jed Davis
breakage (which would be invisible on non-Thumb kernels) is worrying. With this change, it is hoped, r7 is consistently referred to as r7, and fp always means r11; this costs a few extra ifdefs, but it should help prevent future issues. Signed-off-by: Jed Davis j...@mozilla.com --- arch/arm/include

[PATCH] ARM: perf: Implement perf_arch_fetch_caller_regs

2013-07-12 Thread Jed Davis
at which perf_arch_fetch_caller_regs is expanded, instead of that function activation's call site, because we need SP and PC to be consistent for EHABI unwinding; hopefully nothing will be inconvenienced by the extra stack frame. Signed-off-by: Jed Davis j...@mozilla.com --- arch/arm/include/asm

Re: [PATCH] perf: ARM: Record the user-mode PC in the call chain.

2013-06-19 Thread Jed Davis
On Tue, Jun 18, 2013 at 02:13:19PM +0100, Will Deacon wrote: > On Fri, Jun 14, 2013 at 12:21:11AM +0100, Jed Davis wrote: > > With this change, we no longer lose the innermost entry in the user-mode > > part of the call chain. See also the x86 port, which includes the ip. > &g

[PATCH] perf: arm64: Record the user-mode PC in the call chain.

2013-06-19 Thread Jed Davis
With this change, we no longer lose the innermost entry in the user-mode part of the call chain. See also the x86 port, which includes the ip, and the corresponding change in arch/arm. Signed-off-by: Jed Davis --- arch/arm64/kernel/perf_event.c |1 + 1 file changed, 1 insertion(+) diff

[PATCH] perf: arm64: Record the user-mode PC in the call chain.

2013-06-19 Thread Jed Davis
With this change, we no longer lose the innermost entry in the user-mode part of the call chain. See also the x86 port, which includes the ip, and the corresponding change in arch/arm. Signed-off-by: Jed Davis j...@mozilla.com --- arch/arm64/kernel/perf_event.c |1 + 1 file changed, 1

Re: [PATCH] perf: ARM: Record the user-mode PC in the call chain.

2013-06-19 Thread Jed Davis
On Tue, Jun 18, 2013 at 02:13:19PM +0100, Will Deacon wrote: On Fri, Jun 14, 2013 at 12:21:11AM +0100, Jed Davis wrote: With this change, we no longer lose the innermost entry in the user-mode part of the call chain. See also the x86 port, which includes the ip. It's possible

[PATCH] perf: ARM: Record the user-mode PC in the call chain.

2013-06-13 Thread Jed Davis
in the kernel when the sample was taken. Signed-off-by: Jed Davis --- arch/arm/kernel/perf_event.c |1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 8c3094d..d9f5cd4 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm

[PATCH] perf: ARM: Record the user-mode PC in the call chain.

2013-06-13 Thread Jed Davis
in the kernel when the sample was taken. Signed-off-by: Jed Davis j...@mozilla.com --- arch/arm/kernel/perf_event.c |1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 8c3094d..d9f5cd4 100644 --- a/arch/arm/kernel/perf_event.c