Skip to content

Commit 9fe410a

Browse files
James-A-Clarkacmel
authored andcommitted
perf symbols: Remove map from list before updating addresses
Make the order of operations remove, update, add. Updating addresses before the map is removed causes the ordering check to fail when the map is removed. This can be reproduced when running Perf on an Arm system with a static kernel and Perf uses kcore rather than other sources: $ perf record -- ls $ perf report util/maps.c:96: check_invariants: Assertion `map__end(prev) <= map__start(map) || map__start(prev) == map__start(map)' failed Fixes: 659ad34 ("perf maps: Switch from rbtree to lazily sorted array for addresses") Signed-off-by: James Clark <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent d790ead commit 9fe410a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/perf/util/symbol.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,13 +1378,15 @@ static int dso__load_kcore(struct dso *dso, struct map *map,
13781378
if (RC_CHK_EQUAL(new_map, replacement_map)) {
13791379
struct map *map_ref;
13801380

1381-
map__set_start(map, map__start(new_map));
1382-
map__set_end(map, map__end(new_map));
1383-
map__set_pgoff(map, map__pgoff(new_map));
1384-
map__set_mapping_type(map, map__mapping_type(new_map));
13851381
/* Ensure maps are correctly ordered */
13861382
map_ref = map__get(map);
13871383
maps__remove(kmaps, map_ref);
1384+
1385+
map__set_start(map_ref, map__start(new_map));
1386+
map__set_end(map_ref, map__end(new_map));
1387+
map__set_pgoff(map_ref, map__pgoff(new_map));
1388+
map__set_mapping_type(map_ref, map__mapping_type(new_map));
1389+
13881390
err = maps__insert(kmaps, map_ref);
13891391
map__put(map_ref);
13901392
map__put(new_map);

0 commit comments

Comments
 (0)