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: dso: Add symbols in .text.* subsections to text symbol map in kenrel modules Date: Tue, 23 Feb 2021 16:37:52 +0900 [thread overview] Message-ID: <161406587251.969784.5469149622544499077.stgit@devnote2> (raw) In-Reply-To: <20210223000508.cab3cddaa3a3790525f49247@kernel.org> The kernel modules have .text.* subsections such as .text.unlikely. Since dso__process_kernel_symbol() only identify the symbols in the ".text" section as the text symbols and inserts it in the default dso in the map, the symbols in such subsections can not be found by map__find_symbol(). This adds the symbols in those subsections to the default dso in the map so that map__find_symbol() can find them. This solves the perf-probe issue on probing online module. Without this fix, probing on a symbol in .text.unlikely fails. ---- # perf probe -m nf_conntrack nf_l4proto_log_invalid Probe point 'nf_l4proto_log_invalid' not found. Error: Failed to add events. ---- With this fix, it works because map__find_symbol() can find the symbol correctly. ---- # perf probe -m nf_conntrack nf_l4proto_log_invalid Added new event: probe:nf_l4proto_log_invalid (on nf_l4proto_log_invalid in nf_conntrack) You can now use it in all perf tools, such as: perf record -e probe:nf_l4proto_log_invalid -aR sleep 1 ---- Reported-by: Evgenii Shatokhin <eshatokhin@virtuozzo.com> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> --- tools/perf/util/symbol-elf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 6dff843fd883..0c1113236913 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -985,7 +985,9 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map, if (strcmp(section_name, (curr_dso->short_name + dso->short_name_len)) == 0) return 0; - if (strcmp(section_name, ".text") == 0) { + /* .text and .text.* are included in the text dso */ + if (strncmp(section_name, ".text", 5) == 0 && + (section_name[5] == '\0' || section_name[5] == '.')) { /* * The initial kernel mapping is based on * kallsyms and identity maps. Overwrite it to
next prev parent reply other threads:[~2021-02-23 7:38 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 ` [PATCH] perf-probe: Failback to symbol-base probe for probes on module Masami Hiramatsu 2021-02-23 7:36 ` Masami Hiramatsu 2021-02-23 7:09 ` 'perf probe' and symbols from .text.<something> Masami Hiramatsu 2021-02-23 7:37 ` Masami Hiramatsu [this message] 2021-02-23 15:02 ` [PATCH] perf-probe: dso: Add symbols in .text.* subsections to text symbol map in kenrel modules 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=161406587251.969784.5469149622544499077.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 \ --subject='Re: [PATCH] perf-probe: dso: Add symbols in .text.* subsections to text symbol map in kenrel modules' \ /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
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).