From: Frederic Weisbecker <fweisbec@gmail.com>
To: Stephane Eranian <eranian@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Paul Mackerras <paulus@samba.org>,
Cyrill Gorcunov <gorcunov@openvz.org>,
Tom Zanussi <tzanussi@gmail.com>,
Masami Hiramatsu <mhiramat@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Robert Richter <robert.richter@amd.com>,
David Miller <davem@davemloft.net>
Subject: Re: [RFC PATCH 2/9] perf: Add ability to dump user regs
Date: Sat, 16 Oct 2010 00:58:02 +0200 [thread overview]
Message-ID: <20101015225722.GA5354@nowhere> (raw)
In-Reply-To: <AANLkTimVPNntcSexdRnkvd+4VdGf2HU+rM7Zhyu=i7CS@mail.gmail.com>
On Fri, Oct 15, 2010 at 10:39:43AM +0200, Stephane Eranian wrote:
> Frederic,
>
> On Thu, Oct 14, 2010 at 1:20 PM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > On Thu, Oct 14, 2010 at 01:06:30PM +0200, Stephane Eranian wrote:
> >> Hi,
> >>
> >>
> >>
> >> On Wed, Oct 13, 2010 at 9:20 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> >> > On Wed, 2010-10-13 at 07:06 +0200, Frederic Weisbecker wrote:
> >> >> Add new PERF_SAMPLE_UREGS to perf sample type. This will dump the
> >> >> user space context as it was before the user entered the kernel for
> >> >> whatever reason.
> >> >>
> >> >> This is going to be useful to bring Dwarf CFI based stack unwinding
> >> >> on top of samples.
> >> >
> >> > This doesn't address any of the issues that were raised previously.
> >> >
> >> > There's a reason we don't have PERF_SAMPLE_*REGS like things.
> >> >
> >> We definitively need to find a solution to this problem. It is important
> >> to export this kind of information to users when using PEBS, for instance
> >
> >
> >
> > Would you need to export only a part of the regs for cases like PEBS?
> >
> Yes, PEBS does not capture the entire state.
>
> Here is what you get on Intel Core:
> u64 flags, ip;
> u64 ax, bx, cx, dx;
> u64 si, di, bp, sp;
> u64 r8, r9, r10, r11;
> u64 r12, r13, r14, r15;
Ok, that seems to cover most of the state. I guess few people care
about cs, ds, es, fs, gs, most of the time.
>
> In 32-bit, the rXX are zero and would not need to be
> exposed.
>
> >
> >
> >>
> >> What is exported depends on what is monitored and not just the ABI
> >> of the kernel. On a 64-bit kernel, you may capture samples from
> >> i386 or x86_64. Somehow the record needs to be self describing.
> >>
> >> What about something like:
> >> struct {
> >> int type; /* 32-bit, 64-bit */
> >> int nr; /* number of regs */
> >> struct {
> >> int reg_name; /* taken from an enum with all possible regs */
> >> u64 reg_value;
> >> } [0]
> >> };
> >
> >
> >
> > Yeah but in this case we can probably avoid to embed all the regnames
> > in every dumps. This can be retrieved from what we asked in the attrs,
> > which could be a u64 bitmap that tells which regs we want? (that only
> > if we want a per reg granularity).
> >
> Yes, that's another possibility and it may be better because if you want
> only one register,e.g,, EAX, then you can ask for it. That would limit the
> memory consumption in the sampling buffer.
But then I wonder who needs EAX only? If you need eax, then you almost
certainly need most the other general registers.
May be we can group them by "family"? Like one group for general registers
(r0 - r15), one for segment registers (cs - gs) and one for eflags.
We can perhaps isolate single groups for stack pointer, frame pointer and
instruction pointer.
But I can't imagine every possible uses of the regs dump, may be we should
just have one flag per register to enforce a maximum flexibility
and don't bother further.
Hm?
> You need a bitmask to name the registers you want. If the register is not
> accessible in the sampling mode you're requesting, then you should get
> an error.
Yep.
> I would not necessarily use the attr.sample_type because we might run out
> of bits on architecture with lots of registers. Another reason is that
> the register
> names are arch-specific, unlike what's in attr.sample_type.
Yeah we really need a new field for that, u64 so that we have enough bits
for every possible regs set (at least I hope...).
next prev parent reply other threads:[~2010-10-16 0:02 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-13 5:06 [RFC] perf: Dwarf cfi based user callchains Frederic Weisbecker
2010-10-13 5:06 ` [RFC PATCH 1/9] uaccess: Make copy_from_user_nmi() globally available Frederic Weisbecker
2010-10-13 7:15 ` Peter Zijlstra
2010-10-13 14:47 ` Frederic Weisbecker
2010-10-13 20:43 ` Peter Zijlstra
2010-10-13 5:06 ` [RFC PATCH 2/9] perf: Add ability to dump user regs Frederic Weisbecker
2010-10-13 7:20 ` Peter Zijlstra
2010-10-13 14:56 ` Frederic Weisbecker
2010-10-13 14:58 ` Frederic Weisbecker
2010-10-14 11:06 ` Stephane Eranian
2010-10-14 11:20 ` Frederic Weisbecker
2010-10-15 8:39 ` Stephane Eranian
2010-10-15 22:58 ` Frederic Weisbecker [this message]
2010-10-17 10:07 ` Peter Zijlstra
2010-10-18 10:01 ` Stephane Eranian
2010-10-18 22:35 ` Frederic Weisbecker
2010-10-20 9:24 ` Stephane Eranian
2010-10-20 16:13 ` Frederic Weisbecker
2010-10-20 16:19 ` Peter Zijlstra
2010-10-13 5:06 ` [RFC PATCH 3/9] perf: Add ability to dump part of the user stack Frederic Weisbecker
2010-10-13 7:22 ` Peter Zijlstra
2010-10-13 15:01 ` Frederic Weisbecker
2010-10-13 5:06 ` [RFC PATCH 4/9] perf: Don't record frame pointer based user stacktraces if we dump stack and regs Frederic Weisbecker
2010-10-13 7:23 ` Peter Zijlstra
2010-10-13 15:02 ` Frederic Weisbecker
2010-10-16 0:19 ` Frederic Weisbecker
2010-10-13 5:06 ` [RFC PATCH 5/9] perf: Support for dwarf mode callchain on perf record Frederic Weisbecker
2010-10-13 5:06 ` [RFC PATCH 6/9] perf: Build with dwarf cfi Frederic Weisbecker
2010-10-13 5:06 ` [RFC PATCH 7/9] perf: Support for error passed over pointers Frederic Weisbecker
2010-10-13 5:07 ` [RFC PATCH 8/9] perf: Add libunwind dependency for dwarf cfi unwinding Frederic Weisbecker
2010-10-13 5:07 ` [RFC PATCH 9/9] perf: Support for dwarf cfi unwinding on post processing Frederic Weisbecker
2010-10-13 15:13 ` [RFC] perf: Dwarf cfi based user callchains Frank Ch. Eigler
2010-10-20 15:35 ` Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101015225722.GA5354@nowhere \
--to=fweisbec@gmail.com \
--cc=acme@redhat.com \
--cc=davem@davemloft.net \
--cc=eranian@google.com \
--cc=gorcunov@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.com \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).