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

Arnaldo Carvalho de Melo
2009-12-30T13:15:32Z

Em Wed, Dec 30, 2009 at 11:16:57AM +0800, Xiao Guangrong escreveu:
> Record relocation offset, perf tools will use it
> to adjust kernel symbol address
> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>

> arch/x86/boot/compressed/head_32.S | 2 ++
> arch/x86/boot/compressed/head_64.S | 3 +++
> arch/x86/include/asm/bootparam.h | 3 ++-
> arch/x86/kernel/asm-offsets_32.c | 1 +
> arch/x86/kernel/asm-offsets_64.c | 1 +
> arch/x86/kernel/cpu/perf_event.c | 4 ++++
<SNIP>
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -26,8 +26,10 @@
> #include <asm/nmi.h>
> +#include <asm/setup.h>
>
> static u64 perf_event_mask __read_mostly;
> +static s32 relocate_offset;
>
> @@ -2173,6 +2175,8 @@ void __init init_hw_perf_events(void)
> pr_info("Performance Events: ");
>
> + relocate_offset = boot_params.relocate_offset;
> switch (boot_cpu_data.x86_vendor) {
> case X86_VENDOR_INTEL:

I'm no expert on the intricacies of boot_params, but all the other hunks
seems sensible, but can't we provide a non-perf specific way of getting
the relocate_offset? I guess other tools would also love to have it.

What about systemtap, don't they solve this in some other way? Frank?

- Arnaldo