public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH perf/core 3/3] perf-probe: Fix to probe on gcc generated functions in modules
Date: Thu, 5 Jan 2017 15:47:43 -0300	[thread overview]
Message-ID: <20170105184743.GO27864@kernel.org> (raw)
In-Reply-To: <20170105153037.GN27864@kernel.org>

Em Thu, Jan 05, 2017 at 12:30:37PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Jan 05, 2017 at 08:20:19PM +0900, Masami Hiramatsu escreveu:
> > On Wed, 4 Jan 2017 11:48:56 -0300
> > Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > > [acme@jouet linux]$ grep e1000_xmit_frame /proc/kallsyms 
> > > ffffffffc046fc10 t e1000_xmit_frame	[e1000e]
> > > [acme@jouet linux]$ 

> > OK, it sounds reasonable to me too. BTW, how can I get the map for kallsyms?
> > May machine__findnew_module_map(host_machine, ,"[kernel.kallsyms]")
> > include module symbols too?

> Probably what you want is:
 
>  symbol = machine__find_kernel_function_by_name(machine, name, &map);
 
> Then, if symbol is not NULL, map->dso->name will have your module name,
> map->dso->long_name will have the .ko path, etc.

Take a look at 'perf kallsyms' a simple toy cmd that exercises the APIs
you need:

https://git.kernel.org/cgit/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=25c92235676d2655e3f31ffe02bd4355d838e5e9

Basically:

  struct machine *machine = machine__new_kallsyms();
  struct map *map;
  struct symbol *symbol = machine__find_kernel_function_by_name(machine, symbol_name, &map);

  Then you have symbol->{addr,end,name,etc} and map->dso->{long,short}_name

  $ perf kallsyms e1000_xmit_frame usb_stor_set_xfer_buf
  e1000_xmit_frame: [e1000e] /lib/modules/4.9.0+/kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko 0xffffffffc046fc10-0xffffffffc0470bb0 (0x19c80-0x1ac20)
  usb_stor_set_xfer_buf: [usb_storage] /lib/modules/4.9.0+/kernel/drivers/usb/storage/usb-storage.ko 0xffffffffc057aea0-0xffffffffc057af19 (0xf10-0xf89)

- Arnaldo

  reply	other threads:[~2017-01-05 18:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-04  3:27 [PATCH perf/core 0/3] perf-probe: Fix offline module and cross-arch support Masami Hiramatsu
2017-01-04  3:29 ` [PATCH perf/core 1/3] perf-probe: Fix --funcs to show correct symbols for offline module Masami Hiramatsu
2017-01-05  7:54   ` [tip:perf/urgent] perf probe: " tip-bot for Masami Hiramatsu
2017-01-04  3:30 ` [PATCH perf/core 2/3] perf-probe: Fix to probe on gcc generated symbols for offline kernel Masami Hiramatsu
2017-01-05  7:54   ` [tip:perf/urgent] perf probe: " tip-bot for Masami Hiramatsu
2017-01-04  3:31 ` [PATCH perf/core 3/3] perf-probe: Fix to probe on gcc generated functions in modules Masami Hiramatsu
2017-01-04 14:48   ` Arnaldo Carvalho de Melo
2017-01-05 11:20     ` Masami Hiramatsu
2017-01-05 14:16       ` Masami Hiramatsu
2017-01-05 15:30       ` Arnaldo Carvalho de Melo
2017-01-05 18:47         ` Arnaldo Carvalho de Melo [this message]
2017-01-06  2:16           ` Masami Hiramatsu
2017-01-06 16:22           ` Masami Hiramatsu
2017-01-06 18:17             ` Arnaldo Carvalho de Melo
2017-01-07  1:50               ` 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=20170105184743.GO27864@kernel.org \
    --to=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --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