[tip: perf/core] perf symbols: Stop using map->groups, we can use kmaps instead

From: tip-bot2 for Arnaldo Carvalho de Melo
Date: Fri Nov 15 2019 - 02:40:59 EST


The following commit has been merged into the perf/core branch of tip:

Commit-ID: f2baa060cd766f4e585339423891e0063179d702
Gitweb: https://git.kernel.org/tip/f2baa060cd766f4e585339423891e0063179d702
Author: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
AuthorDate: Mon, 04 Nov 2019 16:09:48 -03:00
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitterDate: Tue, 12 Nov 2019 08:20:53 -03:00

perf symbols: Stop using map->groups, we can use kmaps instead

To test that that function is being called I just added a probe on that
place, enabled it via 'perf trace' asking for at most 16 levels of
backtraces, system wide, and then ran 'perf top' on another xterm,
voilÃ:

# perf probe -x ~/bin/perf dso__process_kernel_symbol
Added new event:
probe_perf:dso__process_kernel_symbol (on dso__process_kernel_symbol in /home/acme/bin/perf)

You can now use it in all perf tools, such as:

perf record -e probe_perf:dso__process_kernel_symbol -aR sleep 1

# perf trace -e probe_perf:dso__process_kernel_symbol/max-stack=16/ --max-events=2
# perf trace -e probe_perf:dso__process_kernel_symbol/max-stack=16/ --max-events=2
0.000 :17345/17345 probe_perf:dso__process_kernel_symbol(__probe_ip: 5680224)
dso__process_kernel_symbol (/home/acme/bin/perf)
dso__load_vmlinux (/home/acme/bin/perf)
dso__load_vmlinux_path (/home/acme/bin/perf)
dso__load (/home/acme/bin/perf)
map__load (/home/acme/bin/perf)
thread__find_map (/home/acme/bin/perf)
machine__resolve (/home/acme/bin/perf)
deliver_event (/home/acme/bin/perf)
__ordered_events__flush.part.0 (/home/acme/bin/perf)
process_thread (/home/acme/bin/perf)
start_thread (/usr/lib64/libpthread-2.29.so)
0.064 :17345/17345 probe_perf:dso__process_kernel_symbol(__probe_ip: 5680224)
dso__process_kernel_symbol (/home/acme/bin/perf)
dso__load_vmlinux (/home/acme/bin/perf)
dso__load_vmlinux_path (/home/acme/bin/perf)
dso__load (/home/acme/bin/perf)
map__load (/home/acme/bin/perf)
thread__find_map (/home/acme/bin/perf)
machine__resolve (/home/acme/bin/perf)
deliver_event (/home/acme/bin/perf)
__ordered_events__flush.part.0 (/home/acme/bin/perf)
process_thread (/home/acme/bin/perf)
start_thread (/usr/lib64/libpthread-2.29.so)
#
# perf stat -e probe_perf:dso__process_kernel_symbol
^C
Performance counter stats for 'system wide':

107,308 probe_perf:dso__process_kernel_symbol

8.215399813 seconds time elapsed
#

Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Link: https://lkml.kernel.org/n/tip-5fy66x5hr5ct9pmw84jkiwvm@xxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/symbol-elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 66f4be1..16776d5 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -934,7 +934,7 @@ static int dso__process_kernel_symbol(struct dso *dso, struct map *map,
* we still are sure to have a reference to this DSO via
* *curr_map->dso.
*/
- dsos__add(&map->groups->machine->dsos, curr_dso);
+ dsos__add(&kmaps->machine->dsos, curr_dso);
/* kmaps already got it */
map__put(curr_map);
dso__set_loaded(curr_dso);