Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf maps: Mark ksymbol DSOs with kernel type

We add ksymbol map into machine->kmaps, so it needs to be created as
'struct kmap', which is dependent on its dso having kernel type.

Reported-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Tested-by: Kim Phillips <kim.phillips@amd.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200210200847.GA36715@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
4a4eb615 02213cec

+10 -2
+10 -2
tools/perf/util/machine.c
··· 727 727 struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr); 728 728 729 729 if (!map) { 730 - map = dso__new_map(event->ksymbol.name); 731 - if (!map) 730 + struct dso *dso = dso__new(event->ksymbol.name); 731 + 732 + if (dso) { 733 + dso->kernel = DSO_TYPE_KERNEL; 734 + map = map__new2(0, dso); 735 + } 736 + 737 + if (!dso || !map) { 738 + dso__put(dso); 732 739 return -ENOMEM; 740 + } 733 741 734 742 map->start = event->ksymbol.addr; 735 743 map->end = map->start + event->ksymbol.len;