[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <162282410293.452340.13347006295826431632.stgit@devnote2>
Date: Sat, 5 Jun 2021 01:28:23 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Masami Hiramatsu <mhiramat@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-perf-users@...r.kernel.org
Subject: [PATCH 1/3] perf/probe: Support probes on init functions for offline kernel
perf probe internally checks the probe target is in the text area
in post-process (after analyzing debuginfo). But it fails if the
probe target is in the "inittext".
This is a good limitation for the online kernel because such
functions have gone after booting. However, for using it for
boot-time tracing, user may want to put a probe on init functions.
This skips the post checking process if the target is offline kenrel
so that user can get the probe definition on the init functions.
Without this patch:
$ perf probe -k ./build-x86_64/vmlinux -D do_mount_root:10
Probe point 'do_mount_root:10' not found.
Error: Failed to add events.
With this patch:
$ perf probe -k ./build-x86_64/vmlinux -D do_mount_root:10
p:probe/do_mount_root_L10 mount_block_root+300
Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
---
tools/perf/util/probe-event.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 8fe179d671c3..a6e121afb651 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -682,8 +682,13 @@ static int post_process_probe_trace_point(struct probe_trace_point *tp,
u64 addr = tp->address - offs;
sym = map__find_symbol(map, addr);
- if (!sym)
- return -ENOENT;
+ if (!sym) {
+ /*
+ * If the address is in the inittext section, map can not
+ * find it. Ignore it if we are probing offline kernel.
+ */
+ return (symbol_conf.ignore_vmlinux_buildid) ? 0 : -ENOENT;
+ }
if (strcmp(sym->name, tp->symbol)) {
/* If we have no realname, use symbol for it */
Powered by blists - more mailing lists