mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
perf tools: Check maps for bpf programs
As reported by Jiri Olsa in:
"[BUG] perf: intel_pt won't display kernel function"
https://lore.kernel.org/lkml/20190403143738.GB32001@krava
Recent changes to support PERF_RECORD_KSYMBOL and PERF_RECORD_BPF_EVENT
broke --kallsyms option. This is because it broke test __map__is_kmodule.
This patch fixes this by adding check for bpf program, so that these maps
are not mistaken as kernel modules.
Signed-off-by: Song Liu <[email protected]>
Reported-by: Jiri Olsa <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Martin KaFai Lau <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Yonghong Song <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Fixes: 76193a9452 ("perf, bpf: Introduce PERF_RECORD_KSYMBOL")
Signed-off-by: Jiri Olsa <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
aa52660231
commit
a93e0b2365
2 changed files with 19 additions and 1 deletions
|
|
@ -261,6 +261,22 @@ bool __map__is_extra_kernel_map(const struct map *map)
|
|||
return kmap && kmap->name[0];
|
||||
}
|
||||
|
||||
bool __map__is_bpf_prog(const struct map *map)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
if (map->dso->binary_type == DSO_BINARY_TYPE__BPF_PROG_INFO)
|
||||
return true;
|
||||
|
||||
/*
|
||||
* If PERF_RECORD_BPF_EVENT is not included, the dso will not have
|
||||
* type of DSO_BINARY_TYPE__BPF_PROG_INFO. In such cases, we can
|
||||
* guess the type based on name.
|
||||
*/
|
||||
name = map->dso->short_name;
|
||||
return name && (strstr(name, "bpf_prog_") == name);
|
||||
}
|
||||
|
||||
bool map__has_symbols(const struct map *map)
|
||||
{
|
||||
return dso__has_symbols(map->dso);
|
||||
|
|
|
|||
|
|
@ -159,10 +159,12 @@ int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name,
|
|||
|
||||
bool __map__is_kernel(const struct map *map);
|
||||
bool __map__is_extra_kernel_map(const struct map *map);
|
||||
bool __map__is_bpf_prog(const struct map *map);
|
||||
|
||||
static inline bool __map__is_kmodule(const struct map *map)
|
||||
{
|
||||
return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map);
|
||||
return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map) &&
|
||||
!__map__is_bpf_prog(map);
|
||||
}
|
||||
|
||||
bool map__has_symbols(const struct map *map);
|
||||
|
|
|
|||
Loading…
Reference in a new issue