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

perf top: Ignore kptr_restrict when not sampling the kernel

If all events have attr.exclude_kernel set, no need to look at
kptr_restrict.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-yegpzg5bf2im69g0tfizqaqz@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+5 -3
+5 -3
tools/perf/builtin-top.c
··· 735 735 if (!machine->kptr_restrict_warned && 736 736 symbol_conf.kptr_restrict && 737 737 al.cpumode == PERF_RECORD_MISC_KERNEL) { 738 - ui__warning( 738 + if (!perf_evlist__exclude_kernel(top->session->evlist)) { 739 + ui__warning( 739 740 "Kernel address maps (/proc/{kallsyms,modules}) are restricted.\n\n" 740 741 "Check /proc/sys/kernel/kptr_restrict.\n\n" 741 742 "Kernel%s samples will not be resolved.\n", 742 743 al.map && !RB_EMPTY_ROOT(&al.map->dso->symbols[MAP__FUNCTION]) ? 743 744 " modules" : ""); 744 - if (use_browser <= 0) 745 - sleep(5); 745 + if (use_browser <= 0) 746 + sleep(5); 747 + } 746 748 machine->kptr_restrict_warned = true; 747 749 } 748 750