mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	Guo Ren <guoren@kernel.org>,  Tianyou Li <tianyou.li@intel.com>,
	Athira Rajeev <atrajeev@linux.ibm.com>,
	 Stephen Brennan <stephen.s.brennan@oracle.com>,
	Aditya Bodkhe <aditya.b1@linux.ibm.com>,
	 Chun-Tse Shao <ctshao@google.com>,
	Swapnil Sapkal <swapnil.sapkal@amd.com>,
	 Howard Chu <howardchu95@gmail.com>,
	Sergei Trofimovich <slyich@gmail.com>,
	 Shimin Guo <shimin.guo@skydio.com>,
	linux-perf-users@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-csky@vger.kernel.org
Subject: [PATCH v1 4/4] perf unwind-libdw: Wire up e_flags for CSKY
Date: Fri, 23 Jan 2026 14:22:09 -0800	[thread overview]
Message-ID: <20260123222209.1181249-5-irogers@google.com> (raw)
In-Reply-To: <20260123222209.1181249-1-irogers@google.com>

Wire up the e_flags now it can be read for a thread. The e_flags
encode the CSKY ABI level and this can impact which perf registers
need setting up for unwinding.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/unwind-libdw.c | 9 +++++----
 tools/perf/util/unwind-libdw.h | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index 3fdcfa06bf22..05e8e68bd49c 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -213,7 +213,6 @@ static bool memory_read(Dwfl *dwfl __maybe_unused, Dwarf_Addr addr, Dwarf_Word *
 {
 	struct dwfl_ui_thread_info *dwfl_ui_ti = arg;
 	struct unwind_info *ui = dwfl_ui_ti->ui;
-	uint16_t e_machine = thread__e_machine(ui->thread, ui->machine, /*e_flags=*/NULL);
 	struct stack_dump *stack = &ui->sample->user_stack;
 	u64 start, end;
 	int offset;
@@ -223,7 +222,7 @@ static bool memory_read(Dwfl *dwfl __maybe_unused, Dwarf_Addr addr, Dwarf_Word *
 		return false;
 
 	ret = perf_reg_value(&start, ui->sample->user_regs,
-			     perf_arch_reg_sp(e_machine));
+			     perf_arch_reg_sp(ui->e_machine));
 	if (ret)
 		return false;
 
@@ -260,7 +259,7 @@ static bool libdw_set_initial_registers(Dwfl_Thread *thread, void *arg)
 	int max_dwarf_reg = 0;
 	bool ret;
 	uint16_t e_machine = ui->e_machine;
-	int e_flags = 0;
+	int e_flags = ui->e_flags;
 	uint64_t ip_perf_reg = perf_arch_reg_ip(e_machine);
 	Dwarf_Word val = 0;
 
@@ -348,7 +347,8 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
 {
 	struct maps *maps = thread__maps(thread);
 	struct machine *machine = maps__machine(maps);
-	uint16_t e_machine = thread__e_machine(thread, machine, /*e_flags=*/NULL);
+	uint32_t e_flags = 0;
+	uint16_t e_machine = thread__e_machine(thread, machine, &e_flags);
 	struct dwfl_ui_thread_info *dwfl_ui_ti;
 	static struct unwind_info *ui;
 	Dwfl *dwfl;
@@ -370,6 +370,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
 		.arg		= arg,
 		.max_stack	= max_stack,
 		.e_machine	= e_machine,
+		.e_flags	= e_flags,
 		.best_effort    = best_effort
 	};
 
diff --git a/tools/perf/util/unwind-libdw.h b/tools/perf/util/unwind-libdw.h
index 3dec0ab8bd50..6423bf5a2492 100644
--- a/tools/perf/util/unwind-libdw.h
+++ b/tools/perf/util/unwind-libdw.h
@@ -20,6 +20,7 @@ struct unwind_info {
 	void			*arg;
 	int			max_stack;
 	int			idx;
+	uint32_t		e_flags;
 	uint16_t		e_machine;
 	bool			best_effort;
 	struct unwind_entry	entries[];
-- 
2.52.0.457.g6b5491de43-goog


  parent reply	other threads:[~2026-01-23 22:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23 22:22 [PATCH v1 0/4] perf e_flags support " Ian Rogers
2026-01-23 22:22 ` [PATCH v1 1/4] perf dso: Factor out e_machine reading for use in thread Ian Rogers
2026-01-23 22:22 ` [PATCH v1 2/4] perf thread: Add optional e_flags output argument to thread__e_machine Ian Rogers
2026-01-23 22:22 ` [PATCH v1 3/4] perf perf_regs: Accurately compute register names for CSKY Ian Rogers
2026-01-23 22:22 ` Ian Rogers [this message]
2026-01-26 20:51 ` [PATCH v1 0/4] perf e_flags support " Arnaldo Carvalho de Melo

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=20260123222209.1181249-5-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=aditya.b1@linux.ibm.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=atrajeev@linux.ibm.com \
    --cc=ctshao@google.com \
    --cc=guoren@kernel.org \
    --cc=howardchu95@gmail.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-csky@vger.kernel.org \
    --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=slyich@gmail.com \
    --cc=stephen.s.brennan@oracle.com \
    --cc=swapnil.sapkal@amd.com \
    --cc=tianyou.li@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

all inboxes | Powered by JetHome®