From: Jiri Olsa <jolsa@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: acme@redhat.com, a.p.zijlstra@chello.nl, mingo@elte.hu,
paulus@samba.org, cjashfor@linux.vnet.ibm.com,
fweisbec@gmail.com, gorcunov@openvz.org, tzanussi@gmail.com,
mhiramat@redhat.com, robert.richter@amd.com, fche@redhat.com,
linux-kernel@vger.kernel.org, masami.hiramatsu.pt@hitachi.com,
drepper@gmail.com, asharma@fb.com,
benjamin.redelings@nescent.org
Subject: Re: [PATCH 02/19] perf: Add ability to attach user level registers dump to sample
Date: Wed, 13 Jun 2012 15:23:54 +0200 [thread overview]
Message-ID: <20120613132354.GC2538@m.brq.redhat.com> (raw)
In-Reply-To: <CABPqkBRdVMzocJu_SJbU81wg6Ef=KgbXw-18tb+bZEon79fVDA@mail.gmail.com>
On Wed, Jun 13, 2012 at 03:18:54PM +0200, Stephane Eranian wrote:
> On Wed, Jun 13, 2012 at 3:12 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> > On Wed, Jun 13, 2012 at 01:16:44PM +0200, Stephane Eranian wrote:
> >> On Mon, Jun 11, 2012 at 3:19 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> >> > Introducing sample_regs_user bitmask into perf_event_attr
> >> > struct to define the user level registers we want to attach
> >> > to the sample. The dump itself is triggered once the
> >> > sample_regs_user is not empty.
> >> >
> >> > Only user level registers are dump at the moment. Meaning the
> >> > register values of the user space context as it was before the
> >> > user entered the kernel for whatever reason (syscall, irq,
> >> > exception, or a PMI happening in userspace).
> >> >
> >> > The layout of the sample_regs_user bitmap is described in
> >> > asm/perf_regs.h for archs that support register dump.
> >> >
> >> > This is going to be useful to bring Dwarf CFI based stack
> >> > unwinding on top of samples.
> >> >
> >> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> >> > Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> >> > ---
> >> > include/linux/perf_event.h | 10 ++++++-
> >> > kernel/events/core.c | 61 ++++++++++++++++++++++++++++++++++++++++++++
> >> > 2 files changed, 70 insertions(+), 1 deletions(-)
> >> >
> >> > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> >> > index 1ce887a..d66cbeb 100644
> >> > --- a/include/linux/perf_event.h
> >> > +++ b/include/linux/perf_event.h
> >> > @@ -271,7 +271,13 @@ struct perf_event_attr {
> >> > __u64 bp_len;
> >> > __u64 config2; /* extension of config1 */
> >> > };
> >> > - __u64 branch_sample_type; /* enum branch_sample_type */
> >> > + __u64 branch_sample_type; /* enum perf_branch_sample_type */
> >> > +
> >> > + /*
> >> > + * Defines set of user regs to dump on samples.
> >> > + * See asm/perf_regs.h for details.
> >> > + */
> >> > + __u64 sample_regs_user;
> >> > };
> >> That's not enough. You also need to define PERF_SAMPLE_USER_REGS
> >> for sample_type. Although the sample_regs_users might look like it's enough
> >> to capture regs, there is a problem when it comes to parsing the record. You
> >> need an ordering guarantee that is explicitly spelled out in the API (the header
> >> file). In your current patch, I have no way of knowing that sample_regs_users
> >> are saved after BRANCH_STACK (should you have that enabled). Remember
> >> that you can turn on/off sampled infos at will in sample_type. Yet to find the
> >> infos when parsing, you need to know the order.
> >
> > Well, the sample_regs_user != 0 substitute the PERF_SAMPLE_USER_REGS bit.
> > The behaviour is the same as if there was that bit defined..
> >
> No it's not the same. Looking at sample_regs_user != 0, do you know in which
> order the regs array is going to appear RELATIVE to the other captured
> information?
>
> Take sample_type = IP|CPU|PERIOD, sample_regs_users = EAX
>
> Now, I get the raw record, want to parse it. Which comes first the user_regs
> or the IP, CPU, PERIOD?
>
> Worst, I add more entries to PERF_SAMPLE_*, are they laid out before or
> after the regs?
after.. but only because I know that.. yep, I think you're right,
we should track it in the sample_type enum.. I'll add those 2 bits
jirka
next prev parent reply other threads:[~2012-06-13 13:24 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-11 13:19 [RFCv5 00/19] perf: Add backtrace post dwarf unwind Jiri Olsa
2012-06-11 13:19 ` [PATCH 01/19] perf: Unified API to record selective sets of arch registers Jiri Olsa
2012-06-11 13:19 ` [PATCH 02/19] perf: Add ability to attach user level registers dump to sample Jiri Olsa
2012-06-13 11:16 ` Stephane Eranian
2012-06-13 13:12 ` Jiri Olsa
2012-06-13 13:18 ` Stephane Eranian
2012-06-13 13:23 ` Jiri Olsa [this message]
2012-06-13 13:25 ` Stephane Eranian
2012-06-13 13:40 ` Peter Zijlstra
2012-06-13 13:41 ` Stephane Eranian
2012-06-13 13:51 ` Stephane Eranian
2012-06-14 8:36 ` Peter Zijlstra
2012-06-14 10:45 ` Stephane Eranian
2012-06-14 10:50 ` Peter Zijlstra
2012-06-14 10:56 ` Peter Zijlstra
2012-06-13 13:37 ` Peter Zijlstra
2012-06-13 13:29 ` Stephane Eranian
2012-06-11 13:19 ` [PATCH 03/19] perf, x86: Add copy_from_user_nmi_nochk for best effort copy Jiri Olsa
2012-06-11 13:19 ` [PATCH 04/19] perf: Factor __output_copy to be usable with specific copy function Jiri Olsa
2012-06-11 13:20 ` [PATCH 05/19] perf: Add perf_output_skip function to skip bytes in sample Jiri Olsa
2012-06-11 13:20 ` [PATCH 06/19] perf: Add ability to attach user stack dump to sample Jiri Olsa
2012-06-11 13:20 ` [PATCH 07/19] perf: Add attribute to filter out callchains Jiri Olsa
2012-06-11 13:20 ` [PATCH 08/19] perf, tool: Remove unsused evsel parameter from machine__resolve_callchain Jiri Olsa
2012-06-20 16:59 ` [tip:perf/core] perf tools: Remove unused " tip-bot for Jiri Olsa
2012-06-11 13:20 ` [PATCH 09/19] perf, tool: Factor DSO symtab types to generic binary types Jiri Olsa
2012-06-11 13:20 ` [PATCH 10/19] perf, tool: Add interface to read DSO image data Jiri Olsa
2012-06-11 13:20 ` [PATCH 11/19] perf, tool: Add '.note' check into search for NOTE section Jiri Olsa
2012-06-11 13:20 ` [PATCH 12/19] perf, tool: Back [vdso] DSO with real data Jiri Olsa
2012-06-29 18:49 ` Arnaldo Carvalho de Melo
2012-06-11 13:20 ` [PATCH 13/19] perf, tool: Add interface to arch registers sets Jiri Olsa
2012-06-11 13:20 ` [PATCH 14/19] perf, tool: Add libunwind dependency for dwarf cfi unwinding Jiri Olsa
2012-06-11 13:20 ` [PATCH 15/19] perf, tool: Support user regs and stack in sample parsing Jiri Olsa
2012-06-11 13:20 ` [PATCH 16/19] perf, tool: Support for dwarf cfi unwinding on post processing Jiri Olsa
2012-06-11 13:20 ` [PATCH 17/19] perf, tool: Support for dwarf mode callchain on perf record Jiri Olsa
2012-06-11 13:20 ` [PATCH 18/19] perf, tool: Add dso data caching Jiri Olsa
2012-06-11 13:20 ` [PATCH 19/19] perf, tool: Add dso data caching tests Jiri Olsa
2012-06-11 21:44 ` [RFCv5 00/19] perf: Add backtrace post dwarf unwind Benjamin Redelings
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=20120613132354.GC2538@m.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=asharma@fb.com \
--cc=benjamin.redelings@nescent.org \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=drepper@gmail.com \
--cc=eranian@google.com \
--cc=fche@redhat.com \
--cc=fweisbec@gmail.com \
--cc=gorcunov@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=robert.richter@amd.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.