[PATCHv2 2/4] perf evsel: Print warning for excluding kernel mode instruction tracing

From: Sai Prakash Ranjan
Date: Mon Mar 01 2021 - 21:27:30 EST


Add a warning message to check CONFIG_EXCLUDE_KERNEL_HW_ITRACE kernel
config which excludes kernel mode instruction tracing to help perf tool
users identify the perf event open failure when they attempt kernel mode
tracing with this config enabled.

Tested-by: Denis Nikitin <denik@xxxxxxxxxxxx>
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@xxxxxxxxxxxxxx>
---
tools/perf/util/evsel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 1bf76864c4f2..3f584128a590 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2672,7 +2672,8 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
">= 1: Disallow CPU event access\n"
">= 2: Disallow kernel profiling\n"
"To make the adjusted perf_event_paranoid setting permanent preserve it\n"
- "in /etc/sysctl.conf (e.g. kernel.perf_event_paranoid = <setting>)",
+ "in /etc/sysctl.conf (e.g. kernel.perf_event_paranoid = <setting>)\n\n"
+ "Also check CONFIG_EXCLUDE_KERNEL_PMU_TRACE if kernel mode tracing is allowed.",
perf_event_paranoid());
case ENOENT:
return scnprintf(msg, size, "The %s event is not supported.", evsel__name(evsel));
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation