]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf unwind-libdw: Wire up e_flags for CSKY
authorIan Rogers <irogers@google.com>
Fri, 23 Jan 2026 22:22:09 +0000 (14:22 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 26 Jan 2026 21:31:27 +0000 (18:31 -0300)
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>
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Guo Ren <guoren@kernel.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergei Trofimovich <slyich@gmail.com>
Cc: Shimin Guo <shimin.guo@skydio.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Swapnil Sapkal <swapnil.sapkal@amd.com>
Cc: Tianyou Li <tianyou.li@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/unwind-libdw.c
tools/perf/util/unwind-libdw.h

index 3fdcfa06bf228b734dbec5895e6f7d95223e2e78..05e8e68bd49c446a63090578ab2d1bfe09a370cb 100644 (file)
@@ -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
        };
 
index 3dec0ab8bd50ecfdf2b3b34fde7580d3dffd1b63..6423bf5a2492ddb9464561a2f61e54e3cd14042a 100644 (file)
@@ -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[];