From: Peter Zijlstra on
On Wed, 2010-03-03 at 09:30 -0800, Stephane Eranian wrote:
> This assumes struct pt_regs is somehow exported to userland.
> Is that the case?

I seems to have understood they were, and asm/ptrace.h seems to agree
with that, it has !__KERNEL__ definitions for struct pt_regs.

> I would clearly spell out that the REGS are the interrupted REGS,
> not the overflow REGS. Maybe PERF_SAMPLE_IREGS.

They can be both, for PEBS they are the overflow trap (until PEBS does
fault) regs.

--
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: Stephane Eranian on
On Wed, Mar 3, 2010 at 9:39 AM, Peter Zijlstra <peterz(a)infradead.org> wrote:
> On Wed, 2010-03-03 at 09:30 -0800, Stephane Eranian wrote:
>> This assumes struct pt_regs is somehow exported to userland.
>> Is that the case?
>
> I seems to have understood they were, and asm/ptrace.h seems to agree
> with that, it has !__KERNEL__ definitions for struct pt_regs.
>
Seems to be the case, indeed.

>> I would clearly spell out that the REGS are the interrupted REGS,
>> not the overflow REGS. Maybe PERF_SAMPLE_IREGS.
>
> They can be both, for PEBS they are the overflow trap (until PEBS does
> fault) regs.

You're saying without PEBS= interrupted state, with PEBS=overflow state.
That precludes requesting both interrupted + overflow state when PEBS is
enabled. That may be interesting to look at differences, distances (in the IP).
--
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: Stephane Eranian <eranian(a)google.com>
Date: Wed, 3 Mar 2010 09:49:33 -0800

> On Wed, Mar 3, 2010 at 9:39 AM, Peter Zijlstra <peterz(a)infradead.org> wrote:
>> On Wed, 2010-03-03 at 09:30 -0800, Stephane Eranian wrote:
>>> This assumes struct pt_regs is somehow exported to userland.
>>> Is that the case?
>>
>> I seems to have understood they were, and asm/ptrace.h seems to agree
>> with that, it has !__KERNEL__ definitions for struct pt_regs.
>>
> Seems to be the case, indeed.

BTW, how are you going to cope with compat systems?

If I build 'perf' on a sparc64 kernel build, it's going to get the
64-bit pt_regs. So I can't then use that binary on a sparc box
running a 32-bit kernel.

And vice versa.

And more generally aren't we supposed to be able to eventually analyze
perf dumps on any platform not just the one 'perf' was built under?

We'll need to do something about the encoding of pt_regs, therefore.
--
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: Stephane Eranian on
On Wed, Mar 3, 2010 at 9:55 AM, David Miller <davem(a)davemloft.net> wrote:
> From: Stephane Eranian <eranian(a)google.com>
> Date: Wed, 3 Mar 2010 09:49:33 -0800
>
>> On Wed, Mar 3, 2010 at 9:39 AM, Peter Zijlstra <peterz(a)infradead.org> wrote:
>>> On Wed, 2010-03-03 at 09:30 -0800, Stephane Eranian wrote:
>>>> This assumes struct pt_regs is somehow exported to userland.
>>>> Is that the case?
>>>
>>> I seems to have understood they were, and asm/ptrace.h seems to agree
>>> with that, it has !__KERNEL__ definitions for struct pt_regs.
>>>
>> Seems to be the case, indeed.
>
> BTW, how are you going to cope with compat systems?
>
> If I build 'perf' on a sparc64 kernel build, it's going to get the
> 64-bit pt_regs.  So I can't then use that binary on a sparc box
> running a 32-bit kernel.
>
> And vice versa.
>
That was going to be my next question. The pt_regs you return
depends on the binary you are monitoring (32 vs. 64) if interrupt
occurred in userland. But what about if it happens in kernel mode?


> And more generally aren't we supposed to be able to eventually analyze
> perf dumps on any platform not just the one 'perf' was built under?
>
> We'll need to do something about the encoding of pt_regs, therefore.
>



--
Stephane Eranian  | EMEA Software Engineering
Google France | 38 avenue de l'Opéra | 75002 Paris
Tel : +33 (0) 1 42 68 53 00
This email may be confidential or privileged. If you received this
communication by mistake, please
don't forward it to anyone else, please erase all copies and
attachments, and please let me know that
it went to the wrong person. 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/
From: Peter Zijlstra on
On Wed, 2010-03-03 at 09:55 -0800, David Miller wrote:
> From: Stephane Eranian <eranian(a)google.com>
> Date: Wed, 3 Mar 2010 09:49:33 -0800
>
> > On Wed, Mar 3, 2010 at 9:39 AM, Peter Zijlstra <peterz(a)infradead.org> wrote:
> >> On Wed, 2010-03-03 at 09:30 -0800, Stephane Eranian wrote:
> >>> This assumes struct pt_regs is somehow exported to userland.
> >>> Is that the case?
> >>
> >> I seems to have understood they were, and asm/ptrace.h seems to agree
> >> with that, it has !__KERNEL__ definitions for struct pt_regs.
> >>
> > Seems to be the case, indeed.
>
> BTW, how are you going to cope with compat systems?
>
> If I build 'perf' on a sparc64 kernel build, it's going to get the
> 64-bit pt_regs. So I can't then use that binary on a sparc box
> running a 32-bit kernel.
>
> And vice versa.
>
> And more generally aren't we supposed to be able to eventually analyze
> perf dumps on any platform not just the one 'perf' was built under?
>
> We'll need to do something about the encoding of pt_regs, therefore.

Hrm, yes,.. what I can do for the moment is 'cheat' and make the raw
PEBS record available through PERF_SAMPLE_RAW (that also has CAP_ADMIN,
which I guess is a good idea for full reg sets), and then we can work
out how to expose pt_regs later.

If someone has a better suggestion than this, which is basically blurp
out host native pt_regs and cope, please tell ;-)

--
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/