[v4,0/4] tools perf: Add branch speculation info

Message ID cover.1675333809.git.sandipan.das@amd.com
Headers
Series tools perf: Add branch speculation info |

Message

Sandipan Das Feb. 2, 2023, 12:26 p.m. UTC
  AMD Last Branch Record Extension Version 2 (LbrExtV2) provides branch
speculation information and the perf UAPI is extended to provide this in
a generic way. Make perf tool show this additional information.

The UAPI changes can be found in commit 93315e46b000 ("perf/core: Add
speculation info to branch entries").

Requesting help from folks having access to big-endian systems to test
changes in the sample parsing test as I was only able to test these in
a ppc64 simulator.

Previous versions can be found at:
v3: https://lore.kernel.org/all/cover.1675057032.git.sandipan.das@amd.com/
v2: https://lore.kernel.org/all/cover.1664356751.git.sandipan.das@amd.com/
v1: https://lore.kernel.org/all/cover.1660217326.git.sandipan.das@amd.com/

Changes in v4:
- Update tests that were failing due to changes in perf output and
  sample parsing (thanks to Arnaldo for reporting).

Changes in v3:
- Drop tools-side UAPI changes as they have already been added by other
  commits.
- Rebase on top of latest perf/core.

Changes in v2:
- Drop msr-index.h related changes for now.
- Rebase on top of latest perf/core.
- Fix UAPI breakage introduced by the ARM64 BRBE changes to perf branch
  entry.

Sandipan Das (4):
  perf script: Show branch speculation info
  perf session: Show branch speculation info in raw dump
  perf test sample-parsing: Update expected branch flags
  perf test brstack: Update regex to include spec field

 tools/perf/builtin-script.c            |  5 +++--
 tools/perf/tests/sample-parsing.c      |  2 +-
 tools/perf/tests/shell/test_brstack.sh | 18 +++++++++---------
 tools/perf/util/branch.c               | 15 +++++++++++++++
 tools/perf/util/branch.h               |  2 ++
 tools/perf/util/evsel.c                | 15 ++++++++++++---
 tools/perf/util/session.c              |  5 +++--
 7 files changed, 45 insertions(+), 17 deletions(-)
  

Comments

Arnaldo Carvalho de Melo Feb. 2, 2023, 1:04 p.m. UTC | #1
Em Thu, Feb 02, 2023 at 05:56:13PM +0530, Sandipan Das escreveu:
> AMD Last Branch Record Extension Version 2 (LbrExtV2) provides branch
> speculation information and the perf UAPI is extended to provide this in
> a generic way. Make perf tool show this additional information.
> 
> The UAPI changes can be found in commit 93315e46b000 ("perf/core: Add
> speculation info to branch entries").
> 
> Requesting help from folks having access to big-endian systems to test
> changes in the sample parsing test as I was only able to test these in
> a ppc64 simulator.

I'll try folding some of these patches as 'perf test' must pass after
each of them, so that we keep the codebase bisectable.

Right now, after appling the first patch on this v4 series:

⬢[acme@toolbox perf]$ perf test 27
 27: Sample parsing                                                  : FAILED!
⬢[acme@toolbox perf]$

- Arnaldo
 
> Previous versions can be found at:
> v3: https://lore.kernel.org/all/cover.1675057032.git.sandipan.das@amd.com/
> v2: https://lore.kernel.org/all/cover.1664356751.git.sandipan.das@amd.com/
> v1: https://lore.kernel.org/all/cover.1660217326.git.sandipan.das@amd.com/
> 
> Changes in v4:
> - Update tests that were failing due to changes in perf output and
>   sample parsing (thanks to Arnaldo for reporting).
> 
> Changes in v3:
> - Drop tools-side UAPI changes as they have already been added by other
>   commits.
> - Rebase on top of latest perf/core.
> 
> Changes in v2:
> - Drop msr-index.h related changes for now.
> - Rebase on top of latest perf/core.
> - Fix UAPI breakage introduced by the ARM64 BRBE changes to perf branch
>   entry.
> 
> Sandipan Das (4):
>   perf script: Show branch speculation info
>   perf session: Show branch speculation info in raw dump
>   perf test sample-parsing: Update expected branch flags
>   perf test brstack: Update regex to include spec field
> 
>  tools/perf/builtin-script.c            |  5 +++--
>  tools/perf/tests/sample-parsing.c      |  2 +-
>  tools/perf/tests/shell/test_brstack.sh | 18 +++++++++---------
>  tools/perf/util/branch.c               | 15 +++++++++++++++
>  tools/perf/util/branch.h               |  2 ++
>  tools/perf/util/evsel.c                | 15 ++++++++++++---
>  tools/perf/util/session.c              |  5 +++--
>  7 files changed, 45 insertions(+), 17 deletions(-)
> 
> -- 
> 2.34.1
>
  
Arnaldo Carvalho de Melo Feb. 2, 2023, 1:10 p.m. UTC | #2
Em Thu, Feb 02, 2023 at 10:04:12AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Feb 02, 2023 at 05:56:13PM +0530, Sandipan Das escreveu:
> > AMD Last Branch Record Extension Version 2 (LbrExtV2) provides branch
> > speculation information and the perf UAPI is extended to provide this in
> > a generic way. Make perf tool show this additional information.
> > 
> > The UAPI changes can be found in commit 93315e46b000 ("perf/core: Add
> > speculation info to branch entries").
> > 
> > Requesting help from folks having access to big-endian systems to test
> > changes in the sample parsing test as I was only able to test these in
> > a ppc64 simulator.
> 
> I'll try folding some of these patches as 'perf test' must pass after
> each of them, so that we keep the codebase bisectable.
> 
> Right now, after appling the first patch on this v4 series:
> 
> ⬢[acme@toolbox perf]$ perf test 27
>  27: Sample parsing                                                  : FAILED!
> ⬢[acme@toolbox perf]$

So this is what I did:

$ git rebase -i HEAD~4
pick 266d6702711d299c perf script: Show branch speculation info
squash d2fa279aba8d2863 perf test sample-parsing: Update expected branch flags
pick b335ad966cadcbfa perf session: Show branch speculation info in raw dump
squash 272ce62f64e60fc7 perf test brstack: Update regex to include spec field

And then combined the commit messages. Please have bisectability in
mind, running 'perf test', and if it fails, add the fix to to 'perf
test' on the patch that introduced the problem.

Thanks,

- Arnaldo
  
Sandipan Das Feb. 2, 2023, 1:14 p.m. UTC | #3
On 2/2/2023 6:40 PM, Arnaldo Carvalho de Melo wrote:
> Em Thu, Feb 02, 2023 at 10:04:12AM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Thu, Feb 02, 2023 at 05:56:13PM +0530, Sandipan Das escreveu:
>>> AMD Last Branch Record Extension Version 2 (LbrExtV2) provides branch
>>> speculation information and the perf UAPI is extended to provide this in
>>> a generic way. Make perf tool show this additional information.
>>>
>>> The UAPI changes can be found in commit 93315e46b000 ("perf/core: Add
>>> speculation info to branch entries").
>>>
>>> Requesting help from folks having access to big-endian systems to test
>>> changes in the sample parsing test as I was only able to test these in
>>> a ppc64 simulator.
>>
>> I'll try folding some of these patches as 'perf test' must pass after
>> each of them, so that we keep the codebase bisectable.
>>
>> Right now, after appling the first patch on this v4 series:
>>
>> ⬢[acme@toolbox perf]$ perf test 27
>>  27: Sample parsing                                                  : FAILED!
>> ⬢[acme@toolbox perf]$
> 
> So this is what I did:
> 
> $ git rebase -i HEAD~4
> pick 266d6702711d299c perf script: Show branch speculation info
> squash d2fa279aba8d2863 perf test sample-parsing: Update expected branch flags
> pick b335ad966cadcbfa perf session: Show branch speculation info in raw dump
> squash 272ce62f64e60fc7 perf test brstack: Update regex to include spec field
> 
> And then combined the commit messages. Please have bisectability in
> mind, running 'perf test', and if it fails, add the fix to to 'perf
> test' on the patch that introduced the problem.
> 

Sure. Thanks for the cleanup.

- Sandipan