From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Naohiro Aota <naota@elisp.net>,
Peter Zijlstra <peterz@infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>,
namhyung@kernel.org, Jiri Olsa <jolsa@redhat.com>,
Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH perf/core v2 4/5] perf symbols: Allow symbol alias when loading map for symbol name
Date: Fri, 6 Mar 2015 15:32:52 -0300 [thread overview]
Message-ID: <20150306183252.GE5187@kernel.org> (raw)
In-Reply-To: <20150306182630.GD5187@kernel.org>
Em Fri, Mar 06, 2015 at 03:26:30PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Mar 06, 2015 at 03:06:04PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Mar 06, 2015 at 04:31:27PM +0900, Masami Hiramatsu escreveu:
> > > From: Namhyung Kim <namhyung@kernel.org>
> > >
> > > When perf probe tries to add a probe in a binary using symbol name, it
> > > sometimes failed since some symbols were discard during loading dso.
> > > When it resolves an address to symbol, it'd be better to have just one
> > > symbol at given address. But for finding address from symbol, it'd be
> > > better to keep all names (including aliases).
> > >
> > > Add and propagate a new allow_alias argument to dso (and map) load
> > > functions so that it can keep those duplicate symbol aliases.
> >
> > Isn't this a global knob, i.e. one that a tool, such as 'perf probe'
> > flips at startup and leave it turned on while other tools don't need to
> > care about it?
> >
> > If so, we should use symbol_conf for that, no? I.e.
> > symbol_conf.allow_aliases?
> >
> > Looking at doing that now...
>
> Ugh, I was looking at when was that knob to flipped on in this patch, it
> is when one calls map__find_symbol_by_name(), when it assumes that the
> map is not loaded yet and thus asks for duplicates not to be eliminated.
>
> But what happens if the map was already loaded by, say,
> map__find_symbol(), i.e. to find by address? Then that 'true' in the
> __map__load() call from map__find_symbol_by_name will be a nop.
>
> So I think it is really better for this to be a
> symbol_conf.allow_aliases that tools set at startup, and perhaps even
> this could even be governed by symbol_conf.sort_by_name, but I'll leave
> alow_aliases for now, its more flexible.
For reference, below is what I have now in my tree, if you are OK with
it that is what I'll push to Ingo,
- Arnaldo
commit 3dae901ca3eddbd76bc20f47e0019c712ade7d14
Author: Namhyung Kim <namhyung@kernel.org>
Date: Fri Mar 6 16:31:27 2015 +0900
perf symbols: Allow symbol alias when loading map for symbol name
When perf probe tries to add a probe in a binary using symbol name, it
sometimes failed since some symbols were discard during loading dso.
When it resolves an address to symbol, it'd be better to have just one
symbol at given address. But for finding address from symbol, it'd be
better to keep all names (including aliases).
So allow tools to state that they want to allow aliases via
symbol_conf.allow_aliases.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Naohiro Aota <naota@elisp.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20150306073127.6904.3232.stgit@localhost.localdomain
[ Original patch passwd allow_alias to many functions, use symbol_conf.allow_aliases instead ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index c379ea0edfd5..9feba0e3343e 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -80,6 +80,7 @@ static int init_symbol_maps(bool user_only)
int ret;
symbol_conf.sort_by_name = true;
+ symbol_conf.allow_aliases = true;
ret = symbol__init(NULL);
if (ret < 0) {
pr_debug("Failed to init symbol map.\n");
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index ada16762fac2..62742e46c010 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1048,7 +1048,8 @@ new_symbol:
* For misannotated, zeroed, ASM function sizes.
*/
if (nr > 0) {
- symbols__fixup_duplicate(&dso->symbols[map->type]);
+ if (!symbol_conf.allow_aliases)
+ symbols__fixup_duplicate(&dso->symbols[map->type]);
symbols__fixup_end(&dso->symbols[map->type]);
if (kmap) {
/*
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 1650dcb3a67b..efdaaa544041 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -87,6 +87,7 @@ struct symbol_conf {
ignore_vmlinux_buildid,
show_kernel_path,
use_modules,
+ allow_aliases,
sort_by_name,
show_nr_samples,
show_total_period,
next prev parent reply other threads:[~2015-03-06 18:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 7:31 [PATCH perf/core v2 0/5] perf-probe: improve glibc support Masami Hiramatsu
2015-03-06 7:31 ` [PATCH perf/core v2 1/5] perf-probe: Fix to handle aliased symbols in glibc Masami Hiramatsu
2015-03-06 17:59 ` Arnaldo Carvalho de Melo
2015-03-06 18:02 ` Arnaldo Carvalho de Melo
2015-03-14 7:02 ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2015-03-06 7:31 ` [PATCH perf/core v2 2/5] perf-probe: Fix --line " Masami Hiramatsu
2015-03-14 7:02 ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2015-03-06 7:31 ` [PATCH perf/core v2 3/5] Revert "perf probe: Fix to fall back to find probe point in symbols" Masami Hiramatsu
2015-03-14 7:03 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2015-03-06 7:31 ` [PATCH perf/core v2 4/5] perf symbols: Allow symbol alias when loading map for symbol name Masami Hiramatsu
2015-03-06 18:06 ` Arnaldo Carvalho de Melo
2015-03-06 18:26 ` Arnaldo Carvalho de Melo
2015-03-06 18:32 ` Arnaldo Carvalho de Melo [this message]
2015-03-14 7:03 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-03-06 7:31 ` [PATCH perf/core v2 5/5] perf probe: Allow weak symbols to be probed Masami Hiramatsu
2015-03-14 7:03 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-03-06 18:45 ` [PATCH perf/core v2 0/5] perf-probe: improve glibc support Arnaldo Carvalho de Melo
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=20150306183252.GE5187@kernel.org \
--to=acme@kernel.org \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=naota@elisp.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.