diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2018-05-22 12:54:35 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-05-22 15:59:22 +0200 |
commit | 5759a6820aadd38b2c8c10e93919eae8e31a9f9a (patch) | |
tree | 2d010382a05e1489d503374211340a097b65ec0e /tools/perf/util/map.c | |
parent | perf machine: Fix map_groups__split_kallsyms() for entry trampoline symbols (diff) | |
download | linux-5759a6820aadd38b2c8c10e93919eae8e31a9f9a.tar.xz linux-5759a6820aadd38b2c8c10e93919eae8e31a9f9a.zip |
perf machine: Allow for extra kernel maps
Identify extra kernel maps by name so that they can be distinguished
from the kernel map and module maps.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Link: http://lkml.kernel.org/r/1526986485-6562-8-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r-- | tools/perf/util/map.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index c8fe836e4c3c..6ae97eda370b 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -252,6 +252,13 @@ bool __map__is_kernel(const struct map *map) return machine__kernel_map(map->groups->machine) == map; } +bool __map__is_extra_kernel_map(const struct map *map) +{ + struct kmap *kmap = __map__kmap((struct map *)map); + + return kmap && kmap->name[0]; +} + bool map__has_symbols(const struct map *map) { return dso__has_symbols(map->dso); @@ -846,15 +853,22 @@ struct map *map__next(struct map *map) return NULL; } -struct kmap *map__kmap(struct map *map) +struct kmap *__map__kmap(struct map *map) { - if (!map->dso || !map->dso->kernel) { - pr_err("Internal error: map__kmap with a non-kernel map\n"); + if (!map->dso || !map->dso->kernel) return NULL; - } return (struct kmap *)(map + 1); } +struct kmap *map__kmap(struct map *map) +{ + struct kmap *kmap = __map__kmap(map); + + if (!kmap) + pr_err("Internal error: map__kmap with a non-kernel map\n"); + return kmap; +} + struct map_groups *map__kmaps(struct map *map) { struct kmap *kmap = map__kmap(map); |