public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Andi Kleen <ak@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] perf record: collect user registers set jointly with dwarf stacks
Date: Wed, 17 Apr 2019 11:35:42 -0300	[thread overview]
Message-ID: <20190417143542.GA5246@kernel.org> (raw)
In-Reply-To: <20190417073952.GF17024@krava>

Em Wed, Apr 17, 2019 at 09:39:52AM +0200, Jiri Olsa escreveu:
> On Mon, Apr 15, 2019 at 06:36:13PM +0300, Alexey Budankov wrote:
> > 
> > When dwarf stacks are collected jointly with user specified register
> > set using --user-regs option like below the full register context is
> > still captured on a sample:
> > 
> >   $ perf record -g --call-graph dwarf,1024 --user-regs=IP,SP,BP -- matrix.gcc.g.O3
> > 
> >   188143843893585 0x6b48 [0x4f8]: PERF_RECORD_SAMPLE(IP, 0x4002): 23828/23828: 0x401236 period: 1363819 addr: 0x7ffedbdd51ac
> >   ... FP chain: nr:0
> >   ... user regs: mask 0xff0fff ABI 64-bit
> >   .... AX    0x53b
> >   .... BX    0x7ffedbdd3cc0
> >   .... CX    0xffffffff
> >   .... DX    0x33d3a
> >   .... SI    0x7f09b74c38d0
> >   .... DI    0x0
> >   .... BP    0x401260
> >   .... SP    0x7ffedbdd3cc0
> >   .... IP    0x401236
> >   .... FLAGS 0x20a
> >   .... CS    0x33
> >   .... SS    0x2b
> >   .... R8    0x7f09b74c3800
> >   .... R9    0x7f09b74c2da0
> >   .... R10   0xfffffffffffff3ce
> >   .... R11   0x246
> >   .... R12   0x401070
> >   .... R13   0x7ffedbdd5db0
> >   .... R14   0x0
> >   .... R15   0x0
> >   ... ustack: size 1024, offset 0xe0
> >    . data_src: 0x5080021
> >    ... thread: stack_test2.g.O:23828
> >    ...... dso: /root/abudanko/stacks/stack_test2.g.O3
> > 
> > After applying the change suggested in the patch the sample data contain
> > only user specified register values:
> > 
> >   $ perf record -g --call-graph dwarf,1024 --user-regs=IP,SP,BP -- matrix.gcc.g.03
> > 
> >   188368474305373 0x5e40 [0x470]: PERF_RECORD_SAMPLE(IP, 0x4002): 23839/23839: 0x401236 period: 1260507 addr: 0x7ffd3d85e96c
> >   ... FP chain: nr:0
> >   ... user regs: mask 0x1c0 ABI 64-bit
> >   .... BP    0x401260
> >   .... SP    0x7ffd3d85cc20
> >   .... IP    0x401236
> >   ... ustack: size 1024, offset 0x58
> >    . data_src: 0x5080021
> >    ... thread: stack_test2.g.O:23839
> >    ...... dso: /root/abudanko/stacks/stack_test2.g.O3
> > 
> > Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

So, there are registers that are needed to do the DWARF unwinding,
right? But at the same time, if the user says only some are needed, he
better know what they're doing and ask for at least the registers needed
for the unwinding process to be successfull, right?

- Arnaldo
 
> thanks,
> jirka
> 
> > ---
> >  tools/perf/util/evsel.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> > index 84cfb9fe2fc6..29a223b4c699 100644
> > --- a/tools/perf/util/evsel.c
> > +++ b/tools/perf/util/evsel.c
> > @@ -702,7 +702,8 @@ static void __perf_evsel__config_callchain(struct perf_evsel *evsel,
> >  		if (!function) {
> >  			perf_evsel__set_sample_bit(evsel, REGS_USER);
> >  			perf_evsel__set_sample_bit(evsel, STACK_USER);
> > -			attr->sample_regs_user |= PERF_REGS_MASK;
> > +			if (!opts->sample_user_regs)
> > +				attr->sample_regs_user |= PERF_REGS_MASK;
> >  			attr->sample_stack_user = param->dump_size;
> >  			attr->exclude_callchain_user = 1;
> >  		} else {
> > -- 
> > 2.20.1
> > 

-- 

- Arnaldo

  reply	other threads:[~2019-04-17 14:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 15:36 [PATCH v1] perf record: collect user registers set jointly with dwarf stacks Alexey Budankov
2019-04-17  7:39 ` Jiri Olsa
2019-04-17 14:35   ` Arnaldo Carvalho de Melo [this message]
2019-04-17 14:40     ` Jiri Olsa
2019-04-17 15:48       ` Arnaldo Carvalho de Melo
2019-04-17 17:45         ` Alexey Budankov
2019-04-17 18:47           ` Arnaldo Carvalho de Melo
2019-04-18  9:01             ` Alexey Budankov

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=20190417143542.GA5246@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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