summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2022-02-01 15:16:38 +0000
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2022-02-02 10:53:25 +0000
commite835d0d9b1c5f4f93b33e807a40d4dba08edaefe (patch)
treec7da6afd61617a1867b39c547a488f1e79c2aa36 /tools
parent7c9c034619ef9dbfbfe041fbf3973a1cf1ac7a22 (diff)
intel_gpu_top: Improve error message when insufficient privilege
Print out end user friendly help text when the running user has insufficient privilege for accessing system wide performance counters. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Issue: https://gitlab.freedesktop.org/drm/intel/-/issues/5018 Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/intel_gpu_top.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 81c724d1..0404a588 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -1761,6 +1761,15 @@ int main(int argc, char **argv)
if (ret) {
fprintf(stderr,
"Failed to initialize PMU! (%s)\n", strerror(errno));
+ if (errno == EACCES && geteuid())
+ fprintf(stderr,
+"\n"
+"When running as a normal user CAP_PERFMON is required to access performance\n"
+"monitoring. See \"man 7 capabilities\", \"man 8 setcap\", or contact your\n"
+"distribution vendor for assistance.\n"
+"\n"
+"More information can be found at 'Perf events and tool security' document:\n"
+"https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html\n");
ret = EXIT_FAILURE;
goto err;
}