From: Namhyung Kim <namhyung@kernel.org>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
David Ahern <dsahern@gmail.com>,
linux-kernel@vger.kernel.org,
"Steven Rostedt \(Red Hat\)" <rostedt@goodmis.org>,
Oleg Nesterov <oleg@redhat.com>, Ingo Molnar <mingo@redhat.com>,
"David A. Long" <dave.long@linaro.org>,
yrl.pp-manager.tt@hitachi.com
Subject: Re: [PATCH -tip v2 4/8] perf-probe: Use _stext based address instead of the symbol name
Date: Mon, 03 Feb 2014 16:49:44 +0900 [thread overview]
Message-ID: <87d2j43aav.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <20140129091459.22141.29467.stgit@kbuild-fedora.yrl.intra.hitachi.co.jp> (Masami Hiramatsu's message of "Wed, 29 Jan 2014 09:14:59 +0000")
On Wed, 29 Jan 2014 09:14:59 +0000, Masami Hiramatsu wrote:
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index 4a9f43b..120954b 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -387,6 +387,44 @@ static int add_module_to_probe_trace_events(struct probe_trace_event *tevs,
> return ret;
> }
>
> +/* Post processing the probe events */
> +static int post_process_probe_trace_events(struct probe_trace_event *tevs,
> + int ntevs, const char *module,
> + bool uprobe)
> +{
> + struct symbol *sym;
> + struct map *map;
> + unsigned long stext = 0;
> + char *tmp;
> + int i;
> +
> + if (uprobe)
> + return add_exec_to_probe_trace_events(tevs, ntevs, module);
> +
> + /* Note that currently _stext based probe is not for drivers */
> + if (module)
> + return add_module_to_probe_trace_events(tevs, ntevs, module);
> +
> + sym = __find_kernel_function_by_name("_stext", &map);
Couldn't we just use kmap->ref_reloc_sym instead of the hard-coded
"_stext"? You might want to check the Adrian's recent kaslr fixes (now
in tip/perf/urgent).
Thanks,
Namhyung
> + if (!sym) {
> + pr_debug("Failed to find _stext. Use original symbol name.\n");
> + return 0;
> + }
> + stext = map->unmap_ip(map, sym->start);
> +
> + for (i = 0; i < ntevs; i++) {
> + if (tevs[i].point.address) {
> + tmp = strdup("_stext");
> + if (!tmp)
> + return -ENOMEM;
> + free(tevs[i].point.symbol);
> + tevs[i].point.symbol = tmp;
> + tevs[i].point.offset = tevs[i].point.address - stext;
> + }
> + }
> + return 0;
> +}
> +
next prev parent reply other threads:[~2014-02-03 7:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-29 9:14 [PATCH -tip v2 0/8] perf-probe: Updates for handling local functions correctly Masami Hiramatsu
2014-01-29 9:14 ` [PATCH -tip v2 1/8] [BUGFIX] perf-probe: Fix to do exit call for symbol maps Masami Hiramatsu
2014-02-03 7:41 ` Namhyung Kim
2014-02-03 8:19 ` Masami Hiramatsu
2014-01-29 9:14 ` [PATCH -tip v2 2/8] perf-probe: Remove incorrect symbol check for --list Masami Hiramatsu
2014-01-29 9:14 ` [PATCH -tip v2 3/8] perf-probe: Show in what binaries/modules probes are set Masami Hiramatsu
2014-01-29 9:14 ` [PATCH -tip v2 4/8] perf-probe: Use _stext based address instead of the symbol name Masami Hiramatsu
2014-02-03 7:49 ` Namhyung Kim [this message]
2014-02-03 8:32 ` Masami Hiramatsu
2014-02-04 9:49 ` Masami Hiramatsu
2014-02-04 10:05 ` Masami Hiramatsu
2014-01-29 9:15 ` [PATCH -tip v2 5/8] perf-probe: Retry to find given address from offline dwarf Masami Hiramatsu
2014-01-29 9:15 ` [PATCH -tip v2 6/8] perf-probe: Show appropriate symbol for _stext based kprobes Masami Hiramatsu
2014-01-29 9:15 ` [PATCH -tip v2 7/8] perf-probe: Show source-level or symbol-level info for uprobes Masami Hiramatsu
2014-01-29 9:15 ` [PATCH -tip v2 8/8] perf-probe: Allow to add events on the local functions Masami Hiramatsu
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=87d2j43aav.fsf@sejong.aot.lge.com \
--to=namhyung@kernel.org \
--cc=acme@ghostprotocols.net \
--cc=dave.long@linaro.org \
--cc=dsahern@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=yrl.pp-manager.tt@hitachi.com \
/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
Powered by JetHome