Re: [PATCH perf/core 3/3] perf-probe: Fix to probe on gcc generated functions in modules

From: Masami Hiramatsu
Date: Thu Jan 05 2017 - 09:16:51 EST


On Thu, 5 Jan 2017 20:20:19 +0900
Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:

> On Wed, 4 Jan 2017 11:48:56 -0300
> Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
>
> > Em Wed, Jan 04, 2017 at 12:31:39PM +0900, Masami Hiramatsu escreveu:
> > > Fix to probe on gcc generated functions on modules. Since
> > > probing on a module is based on its symbol name, it should
> > > be adjusted on actual symbols.
> > >
> > > E.g. without this fix, perf probe shows probe definition
> > > on non-exist symbol as below.
> > > -----
> > > $ perf probe -m build-x86_64/net/netfilter/nf_nat.ko -F in_range*
> > > in_range.isra.12
> > > $ perf probe -m build-x86_64/net/netfilter/nf_nat.ko -D in_range
> > > p:probe/in_range nf_nat:in_range+0
> > > -----
> > > With this fix, perf probe correctly shows a probe on
> > > gcc-generated symbol.
> > > -----
> > > $ perf probe -m build-x86_64/net/netfilter/nf_nat.ko -D in_range
> > > p:probe/in_range nf_nat:in_range.isra.12+0
> > > -----
> >
> > Tested this one on a x86-64 fedora25 system, applied all three.
> >
> > As always, please take a look at the patch when sent to Ingo, I usually
> > put some committer notes there, in this case I put the test steps I
> > performed, using e1000e.ko and e1000_flash_cycle_ich8lan.constprop.22
> >
> > BTW, it would be cool if...
> >
> > Oops, I retract that, while I was testing what I was went to ask you to
> > implement, I saw that this last patch broke this use case:
> >
> > [root@jouet ~]# perf probe -m e1000e e1000_xmit_frame
> > Failed to get ELF symbols for e1000e
> > Probe point 'e1000_xmit_frame' not found.
> > Error: Failed to add events.
> > [root@jouet ~]#
>
> Oops, I missed that case.
> However, when I trided to fix that on fedora25,
>
> $ perf probe -m i915 -vD assert_plane
> probe-definition(0): assert_plane
> symbol:assert_plane file:(null) line:0 offset:0 return:0 lazy:(null)
> 0 arguments
> No kprobe blacklist support, ignored
> Failed to get build-id from i915.
> Cache open error: -1
> Open Debuginfo file: /lib/modules/4.8.15-300.fc25.x86_64/kernel/drivers/gpu/drm/i915/i915.ko.xz
> Try to find probe point from debuginfo.
> Matched function: assert_plane [6fb806]
> found inline addr: 0x886a0
> Probe point found: assert_plane+0
> Found 1 probe_trace_events.
> text offset: 10030
> Failed to get ELF symbols for /lib/modules/4.8.15-300.fc25.x86_64/kernel/drivers/gpu/drm/i915/i915.ko.xz
> Post processing failed or all events are skipped. (-22)
> Probe point 'assert_plane' not found.
> Error: Failed to add events. Reason: No such file or directory (Code: -2)
>
> As far as I can see, elfutils's libdw supports compressed file, but
> libelf API (perf's API) seems not supporting it. This results in
> succeeding opening debuginfo, but failing ELF symbols.

Sorry, this is my fault, perf's map already supported that.
Anyway, I can get ELF headers from debuginfo. However, I'm still
trying to fix an text section offset issue in modules.

Thanks,

--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>