From: Masami Hiramatsu <mhiramat@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Evgenii Shatokhin <eshatokhin@virtuozzo.com>,
Kristen Carlson Accardi <kristen@linux.intel.com>,
live-patching@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org,
Konstantin Khorenko <khorenko@virtuozzo.com>
Subject: [PATCH] perf-probe: Failback to symbol-base probe for probes on module
Date: Tue, 23 Feb 2021 10:48:30 +0900 [thread overview]
Message-ID: <161404491047.941247.11308029534557469716.stgit@devnote2> (raw)
In-Reply-To: <20210223000508.cab3cddaa3a3790525f49247@kernel.org>
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@kernel.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) {
next prev parent reply other threads:[~2021-02-23 1:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 17:09 'perf probe' and symbols from .text.<something> Evgenii Shatokhin
2021-02-18 19:35 ` Josh Poimboeuf
2021-02-22 15:05 ` Masami Hiramatsu
2021-02-22 15:12 ` Masami Hiramatsu
2021-02-22 17:51 ` Josh Poimboeuf
2021-02-23 1:23 ` Masami Hiramatsu
2021-02-23 7:36 ` Masami Hiramatsu
2021-02-23 19:45 ` Josh Poimboeuf
2021-02-24 8:00 ` Masami Hiramatsu
2021-02-23 1:48 ` Masami Hiramatsu [this message]
2021-02-23 7:36 ` [PATCH] perf-probe: Failback to symbol-base probe for probes on module Masami Hiramatsu
2021-02-23 7:09 ` 'perf probe' and symbols from .text.<something> Masami Hiramatsu
2021-02-23 7:37 ` [PATCH] perf-probe: dso: Add symbols in .text.* subsections to text symbol map in kenrel modules Masami Hiramatsu
2021-02-23 15:02 ` Evgenii Shatokhin
2021-02-23 20:11 ` Arnaldo Carvalho de Melo
2021-02-24 7:47 ` Evgenii Shatokhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=161404491047.941247.11308029534557469716.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=eshatokhin@virtuozzo.com \
--cc=jpoimboe@redhat.com \
--cc=khorenko@virtuozzo.com \
--cc=kristen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).