linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Sandipan Das <sandipan.das@amd.com>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	x86@kernel.org, peterz@infradead.org, bp@alien8.de,
	namhyung@kernel.org, jolsa@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, dave.hansen@linux.intel.com,
	james.clark@arm.com, irogers@google.com, eranian@google.com,
	ananth.narayan@amd.com, ravi.bangoria@amd.com,
	santosh.shukla@amd.com
Subject: Re: [PATCH v3 1/2] perf script: Show branch speculation info
Date: Wed, 1 Feb 2023 22:13:03 -0300	[thread overview]
Message-ID: <Y9sOH5p6ffMi91wd@kernel.org> (raw)
In-Reply-To: <Y9gj5spCa8JcTY/X@kernel.org>

Em Mon, Jan 30, 2023 at 05:09:10PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Jan 30, 2023 at 04:04:58PM +0530, Sandipan Das escreveu:
> > On 1/30/2023 11:29 AM, Sandipan Das wrote:
> > > Show the branch speculation info if provided by the branch recording
> > > hardware feature. This can be useful for optimizing code further.
> > > 
> > > The speculation info is appended to the end of the list of fields so any
> > > existing tools that use "/" as a delimiter for access fields via an index
> > > remain unaffected. Also show "-" instead of "N/A" when speculation info
> > > is unavailable because "/" is used as the field separator.
> > > 
> > > E.g.
> > > 
> > >   $ perf record -j any,u,save_type ./test_branch
> > >   $ perf script --fields brstacksym
> > > 
> > > Before:
> > > 
> > >   [...]
> > >   check_match+0x60/strcmp+0x0/P/-/-/0/CALL
> > >   do_lookup_x+0x3c5/check_match+0x0/P/-/-/0/CALL
> > >   [...]
> > > 
> > > After:
> > > 
> > >   [...]
> > >   check_match+0x60/strcmp+0x0/P/-/-/0/CALL/NON_SPEC_CORRECT_PATH
> > >   do_lookup_x+0x3c5/check_match+0x0/P/-/-/0/CALL/NON_SPEC_CORRECT_PATH
> > >   [...]
> > > 
> > > Signed-off-by: Sandipan Das <sandipan.das@amd.com>
> > > ---
> > >  tools/perf/builtin-script.c |  5 +++--
> > >  tools/perf/util/branch.c    | 15 +++++++++++++++
> > >  tools/perf/util/branch.h    |  2 ++
> > >  tools/perf/util/evsel.c     | 15 ++++++++++++---
> > >  4 files changed, 32 insertions(+), 5 deletions(-)
> > > 
> > 
> > Sorry but I realized later that this change breaks the builtin branch test.
> > The additional change below fixes that.
> 
> Please wait a bit for people to be able to review the other patches and
> then submit a v2 series.

So I applied it manually, no need to send v2.

- Arnaldo
 
> - Arnaldo
>  
> > diff --git a/tools/perf/tests/shell/test_brstack.sh b/tools/perf/tests/shell/test_brstack.sh
> > index 59195eb80052..1c49d8293003 100755
> > --- a/tools/perf/tests/shell/test_brstack.sh
> > +++ b/tools/perf/tests/shell/test_brstack.sh
> > @@ -30,14 +30,14 @@ test_user_branches() {
> >         #       brstack_foo+0x14/brstack_bar+0x40/P/-/-/0/CALL
> > 
> >         set -x
> > -       grep -E -m1 "^brstack_bench\+[^ ]*/brstack_foo\+[^ ]*/IND_CALL$"        $TMPDIR/perf.script
> > -       grep -E -m1 "^brstack_foo\+[^ ]*/brstack_bar\+[^ ]*/CALL$"      $TMPDIR/perf.script
> > -       grep -E -m1 "^brstack_bench\+[^ ]*/brstack_foo\+[^ ]*/CALL$"    $TMPDIR/perf.script
> > -       grep -E -m1 "^brstack_bench\+[^ ]*/brstack_bar\+[^ ]*/CALL$"    $TMPDIR/perf.script
> > -       grep -E -m1 "^brstack_bar\+[^ ]*/brstack_foo\+[^ ]*/RET$"               $TMPDIR/perf.script
> > -       grep -E -m1 "^brstack_foo\+[^ ]*/brstack_bench\+[^ ]*/RET$"     $TMPDIR/perf.script
> > -       grep -E -m1 "^brstack_bench\+[^ ]*/brstack_bench\+[^ ]*/COND$"  $TMPDIR/perf.script
> > -       grep -E -m1 "^brstack\+[^ ]*/brstack\+[^ ]*/UNCOND$"            $TMPDIR/perf.script
> > +       grep -E -m1 "^brstack_bench\+[^ ]*/brstack_foo\+[^ ]*/IND_CALL/.*$"     $TMPDIR/perf.script
> > +       grep -E -m1 "^brstack_foo\+[^ ]*/brstack_bar\+[^ ]*/CALL/.*$"   $TMPDIR/perf.script
> > +       grep -E -m1 "^brstack_bench\+[^ ]*/brstack_foo\+[^ ]*/CALL/.*$" $TMPDIR/perf.script
> > +       grep -E -m1 "^brstack_bench\+[^ ]*/brstack_bar\+[^ ]*/CALL/.*$" $TMPDIR/perf.script
> > +       grep -E -m1 "^brstack_bar\+[^ ]*/brstack_foo\+[^ ]*/RET/.*$"            $TMPDIR/perf.script
> > +       grep -E -m1 "^brstack_foo\+[^ ]*/brstack_bench\+[^ ]*/RET/.*$"  $TMPDIR/perf.script
> > +       grep -E -m1 "^brstack_bench\+[^ ]*/brstack_bench\+[^ ]*/COND/.*$"       $TMPDIR/perf.script
> > +       grep -E -m1 "^brstack\+[^ ]*/brstack\+[^ ]*/UNCOND/.*$"         $TMPDIR/perf.script
> >         set +x
> > 
> >         # some branch types are still not being tested:
> > @@ -57,7 +57,7 @@ test_filter() {
> > 
> >         # fail if we find any branch type that doesn't match any of the expected ones
> >         # also consider UNKNOWN branch types (-)
> > -       if grep -E -vm1 "^[^ ]*/($expect|-|( *))$" $TMPDIR/perf.script; then
> > +       if grep -E -vm1 "^[^ ]*/($expect|-|( *))/.*$" $TMPDIR/perf.script; then
> >                 return 1
> >         fi
> >  }
> > 
> > 
> > - Sandipan
> 
> -- 
> 
> - Arnaldo

-- 

- Arnaldo

  reply	other threads:[~2023-02-02  1:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  5:59 [PATCH v3 0/2] tools perf: Add branch speculation info Sandipan Das
2023-01-30  5:59 ` [PATCH v3 1/2] perf script: Show " Sandipan Das
2023-01-30 10:34   ` Sandipan Das
2023-01-30 20:09     ` Arnaldo Carvalho de Melo
2023-02-02  1:13       ` Arnaldo Carvalho de Melo [this message]
2023-02-02  2:34         ` Arnaldo Carvalho de Melo
2023-02-02  2:37           ` Arnaldo Carvalho de Melo
2023-01-30  5:59 ` [PATCH v3 2/2] perf session: Show branch speculation info in raw dump Sandipan Das
2023-02-02  1:05 ` [PATCH v3 0/2] tools perf: Add branch speculation info Arnaldo Carvalho de Melo

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=Y9sOH5p6ffMi91wd@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ananth.narayan@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=sandipan.das@amd.com \
    --cc=santosh.shukla@amd.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).