Re: [PATCH 1/3] x86: record relocation offset

Ingo Molnar
2010-01-01T09:28:00Z

* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:

> Em Thu, Dec 31, 2009 at 11:00:00AM +0800, Xiao Guangrong escreveu:
> > Arnaldo Carvalho de Melo wrote:
>
> > > Conclusion: at 'perf record' time store the address of a well know
> > > symbol (_text) into the perf.data header. Later, at perf report time, if
> > > using a vmlinux file, calculate the relocation by subtracting the same
> > > well known symbol from the one stored in the header.
>
> > > So no need for ioctl or boot stuff.
>
> > I'm little confused, how to get the load symbol address?
> > It's not a good way, if you get it from '/proc/kallsyms', we can't assume kernel
> > has this file.
>
> Well, then its just a matter of exposing _text as
> /sys/kernel/sections/.text, as we already have for modules:
>
> [acme@ana linux-2.6-tip]$ cat /sys/module/ipv6/sections/.text
> 0xfa0c2000
>
> Which matches
>
> nf_conntrack_ipv6 17548 2 - Live 0xfa147000
> ipv6 239420 32 ip6t_REJECT,nf_conntrack_ipv6, Live 0xfa0c2000
> [acme@ana linux-2.6-tip]$

Yeah, that's a good idea and pretty complementary to the existing scheme for
modules.

> But even as a quick transational assist, we can look at kallsyms at 'perf
> record' time.

Yes, we should do that as a fallback mechanism.

(Initially this 'fallback' will be the primary method, until the
sections/.text extension gets merged upstream.)

Thanks,

Ingo