All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] perf tool: load data variable symbols
@ 2011-02-10 14:15 Lin Ming
  2011-02-10 16:25 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Lin Ming @ 2011-02-10 14:15 UTC (permalink / raw)
  To: acme, Peter Zijlstra, mingo, Stephane Eranian, fweisbec; +Cc: linux-kernel

Hi, all

Currently, perf tool only load function symbols when parsing perf.data.

But it is also helpful if variable symbols can be loaded.

For example, Intel load latency monitoring facility records data linear
address of the load operation. It's useful if the data linear address is
resolved into symbol, just like functions.

enum map_type {
        MAP__FUNCTION = 0,
        MAP__VARIABLE,
};

We already have MAP__VARIABLE defined, although it's not used now.

For both kernel and userspace applications, we can load the variable
symbols from .data and .bss section.

What do you think?

Thanks,
Lin Ming



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] perf tool: load data variable symbols
  2011-02-10 14:15 [RFC] perf tool: load data variable symbols Lin Ming
@ 2011-02-10 16:25 ` Arnaldo Carvalho de Melo
  2011-02-10 19:17   ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-02-10 16:25 UTC (permalink / raw)
  To: Lin Ming; +Cc: Peter Zijlstra, mingo, Stephane Eranian, fweisbec, linux-kernel

Em Thu, Feb 10, 2011 at 10:15:33PM +0800, Lin Ming escreveu:
> Hi, all
> 
> Currently, perf tool only load function symbols when parsing perf.data.
> 
> But it is also helpful if variable symbols can be loaded.
> 
> For example, Intel load latency monitoring facility records data linear
> address of the load operation. It's useful if the data linear address is
> resolved into symbol, just like functions.
> 
> enum map_type {
>         MAP__FUNCTION = 0,
>         MAP__VARIABLE,
> };
> 
> We already have MAP__VARIABLE defined, although it's not used now.
> 
> For both kernel and userspace applications, we can load the variable
> symbols from .data and .bss section.
> 
> What do you think?

It suposedly already works, as you noticed there are no users in the
tree, IIRC I wrote that because somebody at IBM asked for it for some
tool and since then I haven't heard about such tool.

It will load global variable locations from the symtab, like:

[acme@felicio linux]$ readelf -s ~/bin/perf  | grep OBJECT | grep nr_
  216: 000000000076b9b0  8 OBJECT  LOCAL  DEFAULT   29 nr_tasks
  222: 00000000007eba48  8 OBJECT  LOCAL  DEFAULT   29 nr_run_events
  223: 00000000007eba50  8 OBJECT  LOCAL  DEFAULT   29 nr_sleep_events
  224: 00000000007eba58  8 OBJECT  LOCAL  DEFAULT   29 nr_wakeup_events
  225: 00000000007eba60  8 OBJECT  LOCAL  DEFAULT   29 nr_sleep_corrections
  226: 00000000007eba68  8 OBJECT  LOCAL  DEFAULT   29 nr_run_events_optimized
  233: 00000000007ebaa0  8 OBJECT  LOCAL  DEFAULT   29 nr_runs
  238: 00000000007ebac0  8 OBJECT  LOCAL  DEFAULT   29 nr_timestamps
  239: 00000000007ebac8  8 OBJECT  LOCAL  DEFAULT   29 nr_unordered_timestamps
  240: 00000000007ebad0  8 OBJECT  LOCAL  DEFAULT   29 nr_state_machine_bugs
  241: 00000000007ebad8  8 OBJECT  LOCAL  DEFAULT   29 nr_context_switch_bugs
  242: 00000000007ebae0  8 OBJECT  LOCAL  DEFAULT   29 nr_events
  243: 00000000007ebae8  8 OBJECT  LOCAL  DEFAULT   29 nr_lost_chunks
  244: 00000000007ebaf0  8 OBJECT  LOCAL  DEFAULT   29 nr_lost_events
  624: 0000000000817d28  8 OBJECT  LOCAL  DEFAULT   29 nr_unordered
  700: 000000000081a200  8 OBJECT  LOCAL  DEFAULT   29 nr_allocs
  701: 000000000081a208  8 OBJECT  LOCAL  DEFAULT   29 nr_cross_allocs
 1145: 0000000000831180  4 OBJECT  LOCAL  DEFAULT   29 vmlinux_path__nr_entries
[acme@felicio linux]$ 

But for things to start to get interesting we need to extend what we have in
'perf probe', i.e. the DWARF location expressions, to do reverse lookup based
on data address from sample, register file snapshots, and those DWARF location
expressions.

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] perf tool: load data variable symbols
  2011-02-10 16:25 ` Arnaldo Carvalho de Melo
@ 2011-02-10 19:17   ` Peter Zijlstra
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2011-02-10 19:17 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Lin Ming, mingo, Stephane Eranian, fweisbec, linux-kernel

On Thu, 2011-02-10 at 14:25 -0200, Arnaldo Carvalho de Melo wrote:
> Em Thu, Feb 10, 2011 at 10:15:33PM +0800, Lin Ming escreveu:
> > Hi, all
> > 
> > Currently, perf tool only load function symbols when parsing perf.data.
> > 
> > But it is also helpful if variable symbols can be loaded.
> > 
> > For example, Intel load latency monitoring facility records data linear
> > address of the load operation. It's useful if the data linear address is
> > resolved into symbol, just like functions.
> > 
> > enum map_type {
> >         MAP__FUNCTION = 0,
> >         MAP__VARIABLE,
> > };
> > 
> > We already have MAP__VARIABLE defined, although it's not used now.
> > 
> > For both kernel and userspace applications, we can load the variable
> > symbols from .data and .bss section.
> > 
> > What do you think?
> 
> It suposedly already works, as you noticed there are no users in the
> tree, IIRC I wrote that because somebody at IBM asked for it for some
> tool and since then I haven't heard about such tool.
> 
> It will load global variable locations from the symtab, like:
> 
> [acme@felicio linux]$ readelf -s ~/bin/perf  | grep OBJECT | grep nr_
>   216: 000000000076b9b0  8 OBJECT  LOCAL  DEFAULT   29 nr_tasks
>   222: 00000000007eba48  8 OBJECT  LOCAL  DEFAULT   29 nr_run_events
>   223: 00000000007eba50  8 OBJECT  LOCAL  DEFAULT   29 nr_sleep_events
>   224: 00000000007eba58  8 OBJECT  LOCAL  DEFAULT   29 nr_wakeup_events
>   225: 00000000007eba60  8 OBJECT  LOCAL  DEFAULT   29 nr_sleep_corrections
>   226: 00000000007eba68  8 OBJECT  LOCAL  DEFAULT   29 nr_run_events_optimized
>   233: 00000000007ebaa0  8 OBJECT  LOCAL  DEFAULT   29 nr_runs
>   238: 00000000007ebac0  8 OBJECT  LOCAL  DEFAULT   29 nr_timestamps
>   239: 00000000007ebac8  8 OBJECT  LOCAL  DEFAULT   29 nr_unordered_timestamps
>   240: 00000000007ebad0  8 OBJECT  LOCAL  DEFAULT   29 nr_state_machine_bugs
>   241: 00000000007ebad8  8 OBJECT  LOCAL  DEFAULT   29 nr_context_switch_bugs
>   242: 00000000007ebae0  8 OBJECT  LOCAL  DEFAULT   29 nr_events
>   243: 00000000007ebae8  8 OBJECT  LOCAL  DEFAULT   29 nr_lost_chunks
>   244: 00000000007ebaf0  8 OBJECT  LOCAL  DEFAULT   29 nr_lost_events
>   624: 0000000000817d28  8 OBJECT  LOCAL  DEFAULT   29 nr_unordered
>   700: 000000000081a200  8 OBJECT  LOCAL  DEFAULT   29 nr_allocs
>   701: 000000000081a208  8 OBJECT  LOCAL  DEFAULT   29 nr_cross_allocs
>  1145: 0000000000831180  4 OBJECT  LOCAL  DEFAULT   29 vmlinux_path__nr_entries
> [acme@felicio linux]$ 
> 
> But for things to start to get interesting we need to extend what we have in
> 'perf probe', i.e. the DWARF location expressions, to do reverse lookup based
> on data address from sample, register file snapshots, and those DWARF location
> expressions.

Another way is to reverse map the reported IP (PEBS + fixup) to a data
access using the dwarf info. That would also work for dynamically
allocated data structures.

(clearly you'd loose variable things like which entry in an array, but
you should still be able to identify the structure members)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-10 19:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 14:15 [RFC] perf tool: load data variable symbols Lin Ming
2011-02-10 16:25 ` Arnaldo Carvalho de Melo
2011-02-10 19:17   ` Peter Zijlstra

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.