From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Shimin Guo <shimin.guo@skydio.com>,
Andi Kleen <ak@linux.intel.com>, Leo Yan <leo.yan@arm.com>,
Yujie Liu <yujie.liu@intel.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH v1 2/3] perf callchain: Switch callchain_param_setup from an arch to an e_machine
Date: Fri, 23 Jan 2026 16:16:10 -0800 [thread overview]
Message-ID: <20260124001611.1332019-3-irogers@google.com> (raw)
In-Reply-To: <20260124001611.1332019-1-irogers@google.com>
Increase use of e_machine by replacing callchain_param_setup's arch
argument to be an e_machine typically read from the session.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/builtin-report.c | 6 ++----
tools/perf/builtin-script.c | 4 ++--
tools/perf/util/callchain.c | 5 +++--
tools/perf/util/callchain.h | 2 +-
4 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 2e936928e8c0..810ffd66b11c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -448,7 +448,7 @@ static int report__setup_sample_type(struct report *rep)
}
}
- callchain_param_setup(sample_type, perf_env__arch(perf_session__env(rep->session)));
+ callchain_param_setup(sample_type, perf_session__e_machine(session));
if (rep->stitch_lbr && (callchain_param.record_mode != CALLCHAIN_LBR)) {
ui__warning("Can't find LBR callchain. Switch off --stitch-lbr.\n"
@@ -1283,7 +1283,6 @@ static int process_attr(const struct perf_tool *tool __maybe_unused,
struct evlist **pevlist)
{
struct perf_session *session;
- struct perf_env *env;
u64 sample_type;
int err;
@@ -1297,8 +1296,7 @@ static int process_attr(const struct perf_tool *tool __maybe_unused,
*/
sample_type = evlist__combined_sample_type(*pevlist);
session = (*pevlist)->session;
- env = perf_session__env(session);
- callchain_param_setup(sample_type, perf_env__arch(env));
+ callchain_param_setup(sample_type, perf_session__e_machine(session));
return 0;
}
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index b4bf68b17948..c7c0d195b78b 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2841,7 +2841,7 @@ static int process_attr(const struct perf_tool *tool, union perf_event *event,
* on events sample_type.
*/
sample_type = evlist__combined_sample_type(evlist);
- callchain_param_setup(sample_type, perf_env__arch(perf_session__env(scr->session)));
+ callchain_param_setup(sample_type, perf_session__e_machine(evsel__session(evsel)));
/* Enable fields for callchain entries */
if (symbol_conf.use_callchain &&
@@ -3816,7 +3816,7 @@ static void script__setup_sample_type(struct perf_script *script)
struct perf_session *session = script->session;
u64 sample_type = evlist__combined_sample_type(session->evlist);
- callchain_param_setup(sample_type, perf_env__arch(session->machines.host.env));
+ callchain_param_setup(sample_type, perf_session__e_machine(session));
if (script->stitch_lbr && (callchain_param.record_mode != CALLCHAIN_LBR)) {
pr_warning("Can't find LBR callchain. Switch off --stitch-lbr.\n"
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 428e5350d7a2..53ae382432c8 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -31,6 +31,7 @@
#include "callchain.h"
#include "branch.h"
#include "symbol.h"
+#include "thread.h"
#include "util.h"
#include "../perf.h"
@@ -1679,7 +1680,7 @@ void callchain_cursor_reset(struct callchain_cursor *cursor)
map_symbol__exit(&node->ms);
}
-void callchain_param_setup(u64 sample_type, const char *arch)
+void callchain_param_setup(u64 sample_type, uint16_t e_machine)
{
if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {
if ((sample_type & PERF_SAMPLE_REGS_USER) &&
@@ -1701,7 +1702,7 @@ void callchain_param_setup(u64 sample_type, const char *arch)
* erroneous entries. Always skipping the LR and starting from the FP
* can result in missing entries.
*/
- if (callchain_param.record_mode == CALLCHAIN_FP && !strcmp(arch, "arm64"))
+ if (callchain_param.record_mode == CALLCHAIN_FP && e_machine == EM_AARCH64)
dwarf_callchain_users = true;
}
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 2a52af8c80ac..df54ddb8c0cb 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -303,7 +303,7 @@ int callchain_branch_counts(struct callchain_root *root,
u64 *branch_count, u64 *predicted_count,
u64 *abort_count, u64 *cycles_count);
-void callchain_param_setup(u64 sample_type, const char *arch);
+void callchain_param_setup(u64 sample_type, uint16_t e_machine);
bool callchain_cnode_matched(struct callchain_node *base_cnode,
struct callchain_node *pair_cnode);
--
2.52.0.457.g6b5491de43-goog
next prev parent reply other threads:[~2026-01-24 0:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-24 0:16 [PATCH v1 0/3] perf more ELF machine usage Ian Rogers
2026-01-24 0:16 ` [PATCH v1 1/3] perf script: Fix script_fetch_insn for more than just x86 Ian Rogers
2026-01-24 0:16 ` Ian Rogers [this message]
2026-01-24 0:16 ` [PATCH v1 3/3] perf thread-stack: Switch thread_stack__init to use e_machine Ian Rogers
2026-01-26 20:52 ` [PATCH v1 0/3] perf more ELF machine usage Arnaldo Carvalho de Melo
2026-01-26 20:53 ` Arnaldo Carvalho de Melo
2026-01-26 21:35 ` Arnaldo Carvalho de Melo
2026-01-26 22:07 ` Ian Rogers
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=20260124001611.1332019-3-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=shimin.guo@skydio.com \
--cc=yujie.liu@intel.com \
/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