[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260124001611.1332019-3-irogers@google.com>
Date: Fri, 23 Jan 2026 16:16:10 -0800
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
James Clark <james.clark@...aro.org>, Shimin Guo <shimin.guo@...dio.com>,
Andi Kleen <ak@...ux.intel.com>, Leo Yan <leo.yan@....com>, Yujie Liu <yujie.liu@...el.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: [PATCH v1 2/3] perf callchain: Switch callchain_param_setup from an
arch to an e_machine
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@...gle.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
Powered by blists - more mailing lists