From: Leo Yan <leo.yan@arm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
"Liang, Kan" <kan.liang@linux.intel.com>,
John Garry <john.g.garry@oracle.com>,
Will Deacon <will@kernel.org>,
James Clark <james.clark@linaro.org>,
Mike Leach <mike.leach@linaro.org>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Graham Woodward <graham.woodward@arm.com>
Cc: Leo Yan <leo.yan@arm.com>
Subject: [PATCH v1 00/11] perf script: Refactor branch flags for Arm SPE
Date: Wed, 5 Feb 2025 12:15:44 +0000 [thread overview]
Message-ID: <20250205121555.180606-1-leo.yan@arm.com> (raw)
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.
Patches 06 - 09 enables branch flags in Arm SPE. This allows to print
out sample flags for samples.
Patch 10 supports branch stack for Arm SPE. Patch 11 is an enhancement
for PBT feature.
Before:
perf record -e arm_spe_0/load_filter=1,store_filter=1,branch_filter=1/ \
-- ~/perf-c2c-usage-files/false_sharing.exe 1
perf script --itrace=i1ibl -F,+flags,+addr,+brstack
false_sharing.e 414489 [005] 775348.899294: 1 branch: jmp ffffc0fad9ef3d68 ffffc0fad98b2c68 search_cmp_ftr_reg+0x8 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899294: 1 instructions: jmp ffffc0fad9ef3d68 ffffc0fad98b2c68 search_cmp_ftr_reg+0x8 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899294: 1 branch: jmp ffffc0fad98b3708 ffffc0fad98b3704 get_arm64_ftr_reg+0x30 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899294: 1 instructions: jmp ffffc0fad98b3708 ffffc0fad98b3704 get_arm64_ftr_reg+0x30 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899297: 1 branch: br miss ffff8266da60 ffff8266dafc __sprintf_chk@plt+0xc (/usr/lib/aarch64-linux-gnu/libnuma.so.1.0.0)
false_sharing.e 414489 [005] 775348.899297: 1 instructions: br miss ffff8266da60 ffff8266dafc __sprintf_chk@plt+0xc (/usr/lib/aarch64-linux-gnu/libnuma.so.1.0.0)
false_sharing.e 414489 [005] 775348.899297: 1 branch: br miss ffff826a44ec ffff826a44e8 strcmp+0xa8 (/usr/lib/aarch64-linux-gnu/ld-2.31.so)
false_sharing.e 414489 [005] 775348.899297: 1 instructions: br miss ffff826a44ec ffff826a44e8 strcmp+0xa8 (/usr/lib/aarch64-linux-gnu/ld-2.31.so)
false_sharing.e 414489 [005] 775348.899298: 1 instructions: 0 ffffc0fadaad6124 mas_walk+0x274 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899300: 1 instructions: 0 ffffc0fad9b3d98c next_uptodate_folio+0x2a4 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899301: 1 instructions: 0 ffffc0fad98c3dcc __sync_icache_dcache+0x5c ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899301: 1 branch: jmp ffffc0fad9ba7f24 ffffc0fad9ba99c0 folio_add_file_rmap_ptes+0x48 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899301: 1 instructions: jmp ffffc0fad9ba7f24 ffffc0fad9ba99c0 folio_add_file_rmap_ptes+0x48 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899306: 1 instructions: 0 ffffc0fad9b3f184 filemap_map_pages+0x178 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899307: 1 branch: jmp ffffc0fad9b3d7b0 ffffc0fad9b3d7ac next_uptodate_folio+0xc4 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899307: 1 instructions: jmp ffffc0fad9b3d7b0 ffffc0fad9b3d7ac next_uptodate_folio+0xc4 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899307: 1 instructions: 0 ffffc0fad9b3d98c next_uptodate_folio+0x2a4 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899308: 1 branch: jmp ffffc0fad9ef3da4 ffffc0fad9ef3d70 bsearch+0x58 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899308: 1 instructions: jmp ffffc0fad9ef3da4 ffffc0fad9ef3d70 bsearch+0x58 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899310: 1 branch: jmp ffffc0fad98a2158 ffffc0fad98a159c el0t_64_sync+0x198 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899310: 1 instructions: jmp ffffc0fad98a2158 ffffc0fad98a159c el0t_64_sync+0x198 ([kernel.kallsyms])
...
After:
perf script --itrace=i1ibl -F,+flags,+addr,+brstack
false_sharing.e 414489 [005] 775348.899294: 1 branch: return ffffc0fad9ef3d68 ffffc0fad98b2c68 search_cmp_ftr_reg+0x8 ([kernel.kallsyms]) 0xffffc0fad98b2c68 ([kernel.kallsyms])/0xffffc0fad9ef3d68 ([kernel.kallsyms])/P/-/-/5/RET/-
false_sharing.e 414489 [005] 775348.899294: 1 instructions: return ffffc0fad9ef3d68 ffffc0fad98b2c68 search_cmp_ftr_reg+0x8 ([kernel.kallsyms]) 0xffffc0fad98b2c68 ([kernel.kallsyms])/0xffffc0fad9ef3d68 ([kernel.kallsyms])/P/-/-/5/RET/-
false_sharing.e 414489 [005] 775348.899294: 1 branch: jcc/not_taken/ ffffc0fad98b3708 ffffc0fad98b3704 get_arm64_ftr_reg+0x30 ([kernel.kallsyms]) 0xffffc0fad98b3704 ([kernel.kallsyms])/0xffffc0fad98b3708 ([kernel.kallsyms])/PN/-/-/6/COND/-
false_sharing.e 414489 [005] 775348.899294: 1 instructions: jcc/not_taken/ ffffc0fad98b3708 ffffc0fad98b3704 get_arm64_ftr_reg+0x30 ([kernel.kallsyms]) 0xffffc0fad98b3704 ([kernel.kallsyms])/0xffffc0fad98b3708 ([kernel.kallsyms])/PN/-/-/6/COND/-
false_sharing.e 414489 [005] 775348.899297: 1 branch: return/miss/ ffff8266da60 ffff8266dafc __sprintf_chk@plt+0xc (/usr/lib/aarch64-linux-gnu/libnuma.so.1.0.0) 0xffff8266dafc (/usr/lib/aarch64-linux-gnu/libnuma.so.1.0.0)/0xffff8266da60 (/usr/lib/aarch64-linux-gnu/libnuma.so.1.0.0)/M/-/-/12/RET/-
false_sharing.e 414489 [005] 775348.899297: 1 instructions: return/miss/ ffff8266da60 ffff8266dafc __sprintf_chk@plt+0xc (/usr/lib/aarch64-linux-gnu/libnuma.so.1.0.0) 0xffff8266dafc (/usr/lib/aarch64-linux-gnu/libnuma.so.1.0.0)/0xffff8266da60 (/usr/lib/aarch64-linux-gnu/libnuma.so.1.0.0)/M/-/-/12/RET/-
false_sharing.e 414489 [005] 775348.899297: 1 branch: jcc/miss,not_taken/ ffff826a44ec ffff826a44e8 strcmp+0xa8 (/usr/lib/aarch64-linux-gnu/ld-2.31.so) 0xffff826a44e8 (/usr/lib/aarch64-linux-gnu/ld-2.31.so)/0xffff826a44ec (/usr/lib/aarch64-linux-gnu/ld-2.31.so)/MN/-/-/23/COND/-
false_sharing.e 414489 [005] 775348.899297: 1 instructions: jcc/miss,not_taken/ ffff826a44ec ffff826a44e8 strcmp+0xa8 (/usr/lib/aarch64-linux-gnu/ld-2.31.so) 0xffff826a44e8 (/usr/lib/aarch64-linux-gnu/ld-2.31.so)/0xffff826a44ec (/usr/lib/aarch64-linux-gnu/ld-2.31.so)/MN/-/-/23/COND/-
false_sharing.e 414489 [005] 775348.899298: 1 instructions: 0 ffffc0fadaad6124 mas_walk+0x274 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899300: 1 instructions: 0 ffffc0fad9b3d98c next_uptodate_folio+0x2a4 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899301: 1 instructions: 0 ffffc0fad98c3dcc __sync_icache_dcache+0x5c ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899301: 1 branch: jmp ffffc0fad9ba7f24 ffffc0fad9ba99c0 folio_add_file_rmap_ptes+0x48 ([kernel.kallsyms]) 0xffffc0fad9ba99c0 ([kernel.kallsyms])/0xffffc0fad9ba7f24 ([kernel.kallsyms])/P/-/-/8//-
false_sharing.e 414489 [005] 775348.899301: 1 instructions: jmp ffffc0fad9ba7f24 ffffc0fad9ba99c0 folio_add_file_rmap_ptes+0x48 ([kernel.kallsyms]) 0xffffc0fad9ba99c0 ([kernel.kallsyms])/0xffffc0fad9ba7f24 ([kernel.kallsyms])/P/-/-/8//-
false_sharing.e 414489 [005] 775348.899306: 1 instructions: 0 ffffc0fad9b3f184 filemap_map_pages+0x178 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899307: 1 branch: jcc/not_taken/ ffffc0fad9b3d7b0 ffffc0fad9b3d7ac next_uptodate_folio+0xc4 ([kernel.kallsyms]) 0xffffc0fad9b3d7ac ([kernel.kallsyms])/0xffffc0fad9b3d7b0 ([kernel.kallsyms])/PN/-/-/15/COND/-
false_sharing.e 414489 [005] 775348.899307: 1 instructions: jcc/not_taken/ ffffc0fad9b3d7b0 ffffc0fad9b3d7ac next_uptodate_folio+0xc4 ([kernel.kallsyms]) 0xffffc0fad9b3d7ac ([kernel.kallsyms])/0xffffc0fad9b3d7b0 ([kernel.kallsyms])/PN/-/-/15/COND/-
false_sharing.e 414489 [005] 775348.899307: 1 instructions: 0 ffffc0fad9b3d98c next_uptodate_folio+0x2a4 ([kernel.kallsyms])
false_sharing.e 414489 [005] 775348.899308: 1 branch: jcc ffffc0fad9ef3da4 ffffc0fad9ef3d70 bsearch+0x58 ([kernel.kallsyms]) 0xffffc0fad9ef3d70 ([kernel.kallsyms])/0xffffc0fad9ef3da4 ([kernel.kallsyms])/P/-/-/20/COND/-
false_sharing.e 414489 [005] 775348.899308: 1 instructions: jcc ffffc0fad9ef3da4 ffffc0fad9ef3d70 bsearch+0x58 ([kernel.kallsyms]) 0xffffc0fad9ef3d70 ([kernel.kallsyms])/0xffffc0fad9ef3da4 ([kernel.kallsyms])/P/-/-/20/COND/-
false_sharing.e 414489 [005] 775348.899310: 1 branch: jmp ffffc0fad98a2158 ffffc0fad98a159c el0t_64_sync+0x198 ([kernel.kallsyms]) 0xffffc0fad98a159c ([kernel.kallsyms])/0xffffc0fad98a2158 ([kernel.kallsyms])/P/-/-/5//-
false_sharing.e 414489 [005] 775348.899310: 1 instructions: jmp ffffc0fad98a2158 ffffc0fad98a159c el0t_64_sync+0x198 ([kernel.kallsyms]) 0xffffc0fad98a159c ([kernel.kallsyms])/0xffffc0fad98a2158 ([kernel.kallsyms])/P/-/-/5//-
...
Leo Yan (11):
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: 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 | 135 ++++++++++++++++++
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, 307 insertions(+), 51 deletions(-)
--
2.34.1
next reply other threads:[~2025-02-05 12:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 12:15 Leo Yan [this message]
2025-02-05 12:15 ` [PATCH v1 01/11] perf script: Make printing flags reliable Leo Yan
2025-02-05 12:15 ` [PATCH v1 02/11] perf script: Refactor sample_flags_to_name() function Leo Yan
2025-02-05 12:15 ` [PATCH v1 03/11] perf script: Separate events from branch types Leo Yan
2025-02-05 12:15 ` [PATCH v1 04/11] perf script: Add not taken event for branches Leo Yan
2025-02-05 12:15 ` [PATCH v1 05/11] perf script: Add not taken event for branch stack Leo Yan
2025-02-05 12:15 ` [PATCH v1 06/11] perf arm-spe: Extend branch operations Leo Yan
2025-02-05 12:15 ` [PATCH v1 07/11] perf arm-spe: Decode transactional event Leo Yan
2025-02-05 12:15 ` [PATCH v1 08/11] perf arm-spe: Fill branch operations and events to record Leo Yan
2025-02-05 12:15 ` [PATCH v1 09/11] perf arm-spe: Set sample flags with supplement info Leo Yan
2025-02-05 12:15 ` [PATCH v1 10/11] perf arm-spe: Add branch stack Leo Yan
2025-02-05 12:15 ` [PATCH v1 11/11] perf arm-spe: Support previous branch target (PBT) address Leo Yan
2025-02-11 22:34 ` [PATCH v1 00/11] perf script: Refactor branch flags for Arm SPE Ian Rogers
2025-02-12 8:54 ` Leo Yan
2025-02-12 16:14 ` Ian Rogers
2025-02-13 5:29 ` Namhyung Kim
2025-02-14 11:32 ` Leo Yan
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=20250205121555.180606-1-leo.yan@arm.com \
--to=leo.yan@arm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=graham.woodward@arm.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mike.leach@linaro.org \
--cc=namhyung@kernel.org \
--cc=will@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