[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <161404491047.941247.11308029534557469716.stgit@devnote2>
Date: Tue, 23 Feb 2021 10:48:30 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Evgenii Shatokhin <eshatokhin@...tuozzo.com>,
Kristen Carlson Accardi <kristen@...ux.intel.com>,
live-patching@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Konstantin Khorenko <khorenko@...tuozzo.com>
Subject: [PATCH] perf-probe: Failback to symbol-base probe for probes on module
If an error occurs on post processing (this converts probe point to
_text relative address for identifying non-unique symbols) for the
probes on module, failback to symbol-base probe.
There are many non-unique name symbols (local static functions can
be in the different name spaces) in the kernel. If perf-probe uses
a symbol-based probe definition, it can be put on an unintended
symbol. To avoid such mistake, perf-probe tries to convert the
address to the _text relative address expression.
However, such symbol duplication is rare for only one module. Thus
even if the conversion fails, perf probe can failback to the symbol
based probe.
Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
---
tools/perf/util/probe-event.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index a9cff3a50ddf..af946f68e32e 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -779,16 +779,16 @@ post_process_module_probe_trace_events(struct probe_trace_event *tevs,
map = get_target_map(module, NULL, false);
if (!map || debuginfo__get_text_offset(dinfo, &text_offs, true) < 0) {
- pr_warning("Failed to get ELF symbols for %s\n", module);
- return -EINVAL;
+ pr_info("NOTE: Failed to get ELF symbols for %s. Use symbol based probe.\n", module);
+ return 0;
}
mod_name = find_module_name(module);
for (i = 0; i < ntevs; i++) {
- ret = post_process_probe_trace_point(&tevs[i].point,
- map, (unsigned long)text_offs);
- if (ret < 0)
- break;
+ if (post_process_probe_trace_point(&tevs[i].point,
+ map, (unsigned long)text_offs) < 0)
+ pr_info("NOTE: %s is not in the symbol map. Use symbol based probe.\n",
+ tevs[i].point.symbol);
tevs[i].point.module =
strdup(mod_name ? mod_name : module);
if (!tevs[i].point.module) {
Powered by blists - more mailing lists