[PATCH v3 0/3] perf maps: Improve the kcore maps merging

From: Leo Yan
Date: Mon May 20 2024 - 05:07:09 EST


This patch series follows up on the patch [1] to improve the sorting and
merging of kcore maps.

Since the kcore maps are not sorted, merging them into the kernel maps
causes mess, e.g. some kcore maps might be ignored. Patch 01 sorts the
kcore maps and ensures the subset region is placed ahead of the superset
region in the list.

Patch 02 uses maps__remove_maps() to remove the identical kernel map
(generated by reading symbols from '/proc/kallsyms') from the map list.
This can give us a neat list without interfered by old map data and is a
preparation for later relying puerly on kcore maps.

Patch 03 removes the kernel text section replacement. Alternatively,
it searches the kcore maps and finds the map for kernel text section,
then update the pointer 'machine->vmlinux_map'.

This patch series is based on the latest acme's perf-tool-next branch
and tested on Arm64 Hikey960 board.

[1] https://lore.kernel.org/linux-perf-users/438f8725-ef3f-462f-90e2-840cab478ee5@xxxxxxx/T/#m7c86a69d43103cd0cb446b0993e47c36df0f40f2


Leo Yan (3):
perf maps: Sort kcore maps
perf maps: Remove the kernel text map with maps__remove_maps()
perf maps: Remove the replacement of kernel map

tools/perf/util/maps.c | 4 +-
tools/perf/util/maps.h | 2 +-
tools/perf/util/symbol.c | 136 ++++++++++++++++++++-------------------
3 files changed, 74 insertions(+), 68 deletions(-)

--
2.34.1