[PATCH v3 00/12] perf script: Refactor branch flags for Arm SPE

Leo Yan posted 12 patches 10 months ago
There is a newer version of this series
tools/perf/builtin-script.c                   |  30 ++--
.../util/arm-spe-decoder/arm-spe-decoder.c    |  23 ++-
.../util/arm-spe-decoder/arm-spe-decoder.h    |  11 +-
.../arm-spe-decoder/arm-spe-pkt-decoder.c     |  14 +-
.../arm-spe-decoder/arm-spe-pkt-decoder.h     |  12 +-
tools/perf/util/arm-spe.c                     | 143 +++++++++++++++++-
tools/perf/util/branch.h                      |   3 +-
tools/perf/util/event.h                       |  12 +-
tools/perf/util/trace-event-scripting.c       | 116 ++++++++++----
tools/perf/util/trace-event.h                 |   2 +
10 files changed, 314 insertions(+), 52 deletions(-)
[PATCH v3 00/12] perf script: Refactor branch flags for Arm SPE
Posted by Leo Yan 10 months ago
This patch series refactors branch flags for support Arm SPE.  The patch
set is divided into two parts, the first part is for refactoring common
code and the second part is for enabling Arm SPE.

For refactoring branch flags, the sample flaghs are classified as branch
types and events.  A program branch type can be conditional branch,
function call, return or expection taken.  A branch event happens when
taking a branch.  This series combines branch types and the associated
events to present a sample flag.

The second part is to enable Arm SPE's sample flags for expressing
branch types and events, and support branch stack.

Patches 01 - 03 are to refactor branch types and branch events.
Patches 04, 05 extend to support not-taken event.

Patch 06 is to fix a bug for parsing ldst operations.  Without this fix,
the seqential changes will cause breaking for memory samples.

Patches 07 - 10 enables branch flags in Arm SPE.  This allows to print
out sample flags for samples.

Patch 11 supports branch stack for Arm SPE.  Patch 12 is an enhancement
for PBT feature.

Changes from v2:
- Added a new patch 06 for fixing the ldst operation bug (James).
- Added James' review tags (except the new added patch 06).
- Removed a wrong output result in the last patch's commit log.

Changes from v1:
- For patch 05, changed to append the 'not_taken' bit in the branch_flags.
  This can avoid altering bit layout and cause breakage.
- Added Ian's review tags.


Leo Yan (12):
  perf script: Make printing flags reliable
  perf script: Refactor sample_flags_to_name() function
  perf script: Separate events from branch types
  perf script: Add not taken event for branches
  perf script: Add not taken event for branch stack
  perf arm-spe: Fix load-store operation checking
  perf arm-spe: Extend branch operations
  perf arm-spe: Decode transactional event
  perf arm-spe: Fill branch operations and events to record
  perf arm-spe: Set sample flags with supplement info
  perf arm-spe: Add branch stack
  perf arm-spe: Support previous branch target (PBT) address

 tools/perf/builtin-script.c                   |  30 ++--
 .../util/arm-spe-decoder/arm-spe-decoder.c    |  23 ++-
 .../util/arm-spe-decoder/arm-spe-decoder.h    |  11 +-
 .../arm-spe-decoder/arm-spe-pkt-decoder.c     |  14 +-
 .../arm-spe-decoder/arm-spe-pkt-decoder.h     |  12 +-
 tools/perf/util/arm-spe.c                     | 143 +++++++++++++++++-
 tools/perf/util/branch.h                      |   3 +-
 tools/perf/util/event.h                       |  12 +-
 tools/perf/util/trace-event-scripting.c       | 116 ++++++++++----
 tools/perf/util/trace-event.h                 |   2 +
 10 files changed, 314 insertions(+), 52 deletions(-)

-- 
2.34.1
Re: [PATCH v3 00/12] perf script: Refactor branch flags for Arm SPE
Posted by Leo Yan 9 months, 2 weeks ago
Hi Arnaldo, Namhyung,

On Mon, Feb 17, 2025 at 07:58:56PM +0000, Leo Yan wrote:
> This patch series refactors branch flags for support Arm SPE.  The patch
> set is divided into two parts, the first part is for refactoring common
> code and the second part is for enabling Arm SPE.

James has given review tags (including the new added patch 06).  Could
you kindly pick up this series?

Sorry for pushing a bit, as we have dependency on it.

Thanks,
Leo
Re: [PATCH v3 00/12] perf script: Refactor branch flags for Arm SPE
Posted by Namhyung Kim 9 months, 2 weeks ago
On Mon, Mar 03, 2025 at 09:38:53AM +0000, Leo Yan wrote:
> Hi Arnaldo, Namhyung,
> 
> On Mon, Feb 17, 2025 at 07:58:56PM +0000, Leo Yan wrote:
> > This patch series refactors branch flags for support Arm SPE.  The patch
> > set is divided into two parts, the first part is for refactoring common
> > code and the second part is for enabling Arm SPE.
> 
> James has given review tags (including the new added patch 06).  Could
> you kindly pick up this series?
> 
> Sorry for pushing a bit, as we have dependency on it.

No problem, I'll add it to the tmp branch and run some tests.

Thanks,
Namhyung
Re: [PATCH v3 00/12] perf script: Refactor branch flags for Arm SPE
Posted by Leo Yan 9 months, 2 weeks ago
On Mon, Mar 03, 2025 at 01:00:19PM -0800, Namhyung Kim wrote:
> On Mon, Mar 03, 2025 at 09:38:53AM +0000, Leo Yan wrote:
> > Hi Arnaldo, Namhyung,
> > 
> > On Mon, Feb 17, 2025 at 07:58:56PM +0000, Leo Yan wrote:
> > > This patch series refactors branch flags for support Arm SPE.  The patch
> > > set is divided into two parts, the first part is for refactoring common
> > > code and the second part is for enabling Arm SPE.
> > 
> > James has given review tags (including the new added patch 06).  Could
> > you kindly pick up this series?
> > 
> > Sorry for pushing a bit, as we have dependency on it.
> 
> No problem, I'll add it to the tmp branch and run some tests.

Thanks a lot, Namhyung!

I saw you have picked patch series v3 in the tmp.perf-tools-next branch.
On the other hand, to follow up on Adrian's comment, I have sent out
v4 to remove an unnecessary change in patch 01, and the rest of the
patches are exactly the same as v3.

Please consider picking the latest change (either the whole v4 series or
just the updated patch 01 would be fine).

Thanks,
Leo
Re: [PATCH v3 00/12] perf script: Refactor branch flags for Arm SPE
Posted by Namhyung Kim 9 months, 2 weeks ago
On Tue, Mar 04, 2025 at 11:33:50AM +0000, Leo Yan wrote:
> On Mon, Mar 03, 2025 at 01:00:19PM -0800, Namhyung Kim wrote:
> > On Mon, Mar 03, 2025 at 09:38:53AM +0000, Leo Yan wrote:
> > > Hi Arnaldo, Namhyung,
> > > 
> > > On Mon, Feb 17, 2025 at 07:58:56PM +0000, Leo Yan wrote:
> > > > This patch series refactors branch flags for support Arm SPE.  The patch
> > > > set is divided into two parts, the first part is for refactoring common
> > > > code and the second part is for enabling Arm SPE.
> > > 
> > > James has given review tags (including the new added patch 06).  Could
> > > you kindly pick up this series?
> > > 
> > > Sorry for pushing a bit, as we have dependency on it.
> > 
> > No problem, I'll add it to the tmp branch and run some tests.
> 
> Thanks a lot, Namhyung!
> 
> I saw you have picked patch series v3 in the tmp.perf-tools-next branch.
> On the other hand, to follow up on Adrian's comment, I have sent out
> v4 to remove an unnecessary change in patch 01, and the rest of the
> patches are exactly the same as v3.
> 
> Please consider picking the latest change (either the whole v4 series or
> just the updated patch 01 would be fine).

Sure, I'll add v4 to the tmp branch soon.

Thanks,
Namhyung
Re: [PATCH v3 00/12] perf script: Refactor branch flags for Arm SPE
Posted by Leo Yan 9 months, 2 weeks ago
On Tue, Mar 04, 2025 at 10:43:31AM -0800, Namhyung Kim wrote:

[...]

> > Please consider picking the latest change (either the whole v4 series or
> > just the updated patch 01 would be fine).
> 
> Sure, I'll add v4 to the tmp branch soon.

Thanks, Namhyung!  Also thanks Adrian's review for v4!

Leo