From: David Miller on
From: Frederic Weisbecker <fweisbec(a)gmail.com>
Date: Sun, 28 Mar 2010 06:34:49 +0200

> I get kernel crashes each time I use perf with callchains
> on sparc 64.
>
> It triggers with a simple:
>
> perf record -a -f -g sleep 1
>
> I'm attaching two different crashlogs, as it seem to happen
> randomly, and also my config.

Is your 'perf' a 64-bit or 32-bit binary. How about the
'sleep' binary?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Frederic Weisbecker on
On Sun, Mar 28, 2010 at 07:02:35PM -0700, David Miller wrote:
> From: Frederic Weisbecker <fweisbec(a)gmail.com>
> Date: Sun, 28 Mar 2010 06:34:49 +0200
>
> > I get kernel crashes each time I use perf with callchains
> > on sparc 64.
> >
> > It triggers with a simple:
> >
> > perf record -a -f -g sleep 1
> >
> > I'm attaching two different crashlogs, as it seem to happen
> > randomly, and also my config.
>
> Is your 'perf' a 64-bit or 32-bit binary. How about the
> 'sleep' binary?


Both are 32 bits binaries.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: David Miller on
From: Frederic Weisbecker <fweisbec(a)gmail.com>
Date: Sun, 28 Mar 2010 06:34:49 +0200

> It triggers with a simple:
>
> perf record -a -f -g sleep 1

I can reproduce, thanks for the report, I fix this now.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: David Miller on
From: Frederic Weisbecker <fweisbec(a)gmail.com>
Date: Sun, 28 Mar 2010 06:34:49 +0200

> I get kernel crashes each time I use perf with callchains
> on sparc 64.
>
> It triggers with a simple:
>
> perf record -a -f -g sleep 1

This should fix it, thanks again.

sparc64: Properly truncate pt_regs framepointer in perf callback.

For 32-bit processes, we save the full 64-bits of the regs in pt_regs.

But unlike when the userspace actually does load and store
instructions, the top 32-bits don't get automatically truncated by the
cpu in kernel mode (because the kernel doesn't execute with PSTATE_AM
address masking enabled).

So we have to do it by hand.

Reported-by: Frederic Weisbecker <fweisbec(a)gmail.com>
Signed-off-by: David S. Miller <davem(a)davemloft.net>
---
arch/sparc/kernel/perf_event.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 9f2b2ba..610112e 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1337,7 +1337,7 @@ static void perf_callchain_user_32(struct pt_regs *regs,
callchain_store(entry, PERF_CONTEXT_USER);
callchain_store(entry, regs->tpc);

- ufp = regs->u_regs[UREG_I6];
+ ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
do {
struct sparc_stackf32 *usf, sf;
unsigned long pc;
--
1.7.0.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Frederic Weisbecker on
On Mon, Mar 29, 2010 at 01:09:31PM -0700, David Miller wrote:
> From: Frederic Weisbecker <fweisbec(a)gmail.com>
> Date: Sun, 28 Mar 2010 06:34:49 +0200
>
> > I get kernel crashes each time I use perf with callchains
> > on sparc 64.
> >
> > It triggers with a simple:
> >
> > perf record -a -f -g sleep 1
>
> This should fix it, thanks again.


I merged your tree on latest -git and it works well.

Thanks!

Sorry, I have another bug report.

While building perf tools, or the kernel, or whatever, I often
get the following error in the middle:

gcc: Internal error: Segmentation fault (program as)

And this in the logs:

[ 1429.477049] as[2658]: segfault at 4054dfa8 ip 0000000000020690 (rpc 00000000700adcf4) sp 00000000ffcbf008
error 30001 in as[10000+40000]

My gcc / as and everything in userspace is 32 bits but the kernel is a 64.

My config is the same as before.

Again, tell me everything you need to help debugging this.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/