perf thread: Add optional e_flags output argument to thread__e_machine

The e_flags are needed to accurately compute complete perf register
information for CSKY.

Add the ability to read and have this value associated with a thread.

This change doesn't wire up the use of the e_flags except in disasm
where use already exists but just wasn't set up yet.

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>
This commit is contained in:
Ian Rogers
2026-01-23 14:22:07 -08:00
committed by Arnaldo Carvalho de Melo
parent 7d0ebeb6c0
commit 4e66527f88
12 changed files with 122 additions and 48 deletions

View File

@@ -60,6 +60,10 @@ DECLARE_RC_STRUCT(thread) {
struct srccode_state srccode_state;
bool filter;
int filter_entry_depth;
/**
* @e_flags: The ELF EF_* associated with the thread. Valid if e_machine != EM_NONE.
*/
uint16_t e_flags;
/**
* @e_machine: The ELF EM_* associated with the thread. EM_NONE if not
* computed.
@@ -307,13 +311,23 @@ static inline void thread__set_filter_entry_depth(struct thread *thread, int dep
RC_CHK_ACCESS(thread)->filter_entry_depth = depth;
}
uint16_t thread__e_machine(struct thread *thread, struct machine *machine);
uint16_t thread__e_machine(struct thread *thread, struct machine *machine, uint32_t *e_flags);
static inline void thread__set_e_machine(struct thread *thread, uint16_t e_machine)
{
RC_CHK_ACCESS(thread)->e_machine = e_machine;
}
static inline uint32_t thread__e_flags(const struct thread *thread)
{
return RC_CHK_ACCESS(thread)->e_flags;
}
static inline void thread__set_e_flags(struct thread *thread, uint32_t e_flags)
{
RC_CHK_ACCESS(thread)->e_flags = e_flags;
}
static inline bool thread__lbr_stitch_enable(const struct thread *thread)
{