Re: [PATCH v3 3/3] perf maps: Remove the replacement of kernel map

From: James Clark
Date: Tue May 28 2024 - 11:33:24 EST




On 20/05/2024 10:06, Leo Yan wrote:
> The kernel text map has been removed from the kernel maps by
> maps__remove_maps(), and the kcore maps are organized in order, allowing
> us to achieve neat kernel maps.
>
> As a result, it is not necessary to replace the old kernel text map.
> Instead, the commit finds the latest text map, assigns it to
> 'machine->vmlinux_map', and releases the old map.
>
> One concern is if a platform fails to find a kernel text map after
> updating maps list with kcore, in this case, it should not happen and
> reports the failure.
>

Hi Leo,

For some reason this commit causes the symbol to not be resolved for
one kernel sample in a recording I have. It's a bit weird because the
same address is resolved in other samples.

$ perf script

Before this commit:

perf-exec ffff80008030cfd4 perf_event_exec+0x22c ([kernel.kallsyms])
perf-exec ffff80008030cfd4 perf_event_exec+0x22c ([kernel.kallsyms])
perf-exec ffff80008030cfd4 perf_event_exec+0x22c ([kernel.kallsyms])
perf-exec ffff80008129a0f8 _raw_spin_unlock_irqrestore+0x48
([kernel.kallsyms])
ls ffff80008012f5ec lock_acquire+0x74 ([kernel.kallsyms])

After:

perf-exec ffff80008030cfd4 [unknown] ([kernel.kallsyms])
perf-exec ffff80008030cfd4 perf_event_exec+0x22c ([kernel.kallsyms])
perf-exec ffff80008030cfd4 perf_event_exec+0x22c ([kernel.kallsyms])
perf-exec ffff80008129a0f8 _raw_spin_unlock_irqrestore+0x48
([kernel.kallsyms])
ls ffff80008012f5ec lock_acquire+0x74 ([kernel.kallsyms])

James