mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
perf inject: Inject build ids for entire call chain
The DSO build id is injected when the dso is first encountered but the
checking for first encountered only looks at the sample->ip not the
entire callchain.
Use the callchain logic to ensure all build ids are inserted.
Fixes: 454c407ec1
("perf: add perf-inject builtin")
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Casey Chen <cachen@purestorage.com>
Cc: Colin Ian King <colin.i.king@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Link: https://lore.kernel.org/r/20240812224119.744968-1-irogers@google.com
[ Split from a larger patch that introduced the API and use it ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
1a9d080d19
commit
3d557dd3f5
|
@ -743,6 +743,29 @@ static int dso__inject_build_id(struct dso *dso, const struct perf_tool *tool,
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct mark_dso_hit_args {
|
||||
const struct perf_tool *tool;
|
||||
struct machine *machine;
|
||||
u8 cpumode;
|
||||
};
|
||||
|
||||
static int mark_dso_hit_callback(struct callchain_cursor_node *node, void *data)
|
||||
{
|
||||
struct mark_dso_hit_args *args = data;
|
||||
struct map *map = node->ms.map;
|
||||
|
||||
if (map) {
|
||||
struct dso *dso = map__dso(map);
|
||||
|
||||
if (dso && !dso__hit(dso)) {
|
||||
dso__set_hit(dso);
|
||||
dso__inject_build_id(dso, args->tool, args->machine,
|
||||
args->cpumode, map__flags(map));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *event,
|
||||
struct perf_sample *sample,
|
||||
struct evsel *evsel __maybe_unused,
|
||||
|
@ -750,6 +773,11 @@ int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *e
|
|||
{
|
||||
struct addr_location al;
|
||||
struct thread *thread;
|
||||
struct mark_dso_hit_args args = {
|
||||
.tool = tool,
|
||||
.machine = machine,
|
||||
.cpumode = sample->cpumode,
|
||||
};
|
||||
|
||||
addr_location__init(&al);
|
||||
thread = machine__findnew_thread(machine, sample->pid, sample->tid);
|
||||
|
@ -769,6 +797,9 @@ int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *e
|
|||
}
|
||||
}
|
||||
|
||||
sample__for_each_callchain_node(thread, evsel, sample, PERF_MAX_STACK_DEPTH,
|
||||
mark_dso_hit_callback, &args);
|
||||
|
||||
thread__put(thread);
|
||||
repipe:
|
||||
perf_event__repipe(tool, event, sample, machine);
|
||||
|
|
Loading…
Reference in New Issue
Block a user