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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 6c443954
...@@ -735,6 +735,7 @@ static void perf_event__process_sample(struct perf_tool *tool, ...@@ -735,6 +735,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
if (!machine->kptr_restrict_warned && if (!machine->kptr_restrict_warned &&
symbol_conf.kptr_restrict && symbol_conf.kptr_restrict &&
al.cpumode == PERF_RECORD_MISC_KERNEL) { al.cpumode == PERF_RECORD_MISC_KERNEL) {
if (!perf_evlist__exclude_kernel(top->session->evlist)) {
ui__warning( ui__warning(
"Kernel address maps (/proc/{kallsyms,modules}) are restricted.\n\n" "Kernel address maps (/proc/{kallsyms,modules}) are restricted.\n\n"
"Check /proc/sys/kernel/kptr_restrict.\n\n" "Check /proc/sys/kernel/kptr_restrict.\n\n"
...@@ -743,6 +744,7 @@ static void perf_event__process_sample(struct perf_tool *tool, ...@@ -743,6 +744,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
" modules" : ""); " modules" : "");
if (use_browser <= 0) if (use_browser <= 0)
sleep(5); sleep(5);
}
machine->kptr_restrict_warned = true; machine->kptr_restrict_warned = true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment