Skip to contentSkip to conversation

intel_gpu_top: Improve error message when insufficient privilege

PATCH In review Tvrtko Ursulin 3 participants 4 messages Feb 1, 2022 – Feb 2, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel_gpu_top: Improve error message when insufficient privilege

From: Tvrtko Ursulin <[email protected]>

Print out end user friendly help text when the running user has insufficient privilege for accessing system wide performance counters.

Issue: https://gitlab.freedesktop.org/drm/intel/-/issues/5018

---
 tools/intel_gpu_top.c | 9 +++++++++
 1 file changed, 9 insertions(+)
tools/intel_gpu_top.c +9 -0
index 81c724d1fe1c..0404a5881b40 100644
@@ -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;
 	}
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Print out end user friendly help text when the running user has insufficient privilege for accessing system wide performance counters.

Quoted 29 lines

Issue: https://gitlab.freedesktop.org/drm/intel/-/issues/5018

---
 tools/intel_gpu_top.c | 9 +++++++++
 1 file changed, 9 insertions(+)
tools/intel_gpu_top.c +9 -1
index 81c724d1fe1c..0404a5881b40 100644
@@ -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;
 	}
--

2.32.0

#2 lore raw
Quoted 8 lines · Ashutosh
Quoted 5 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Print out end user friendly help text when the running user has insufficient privilege for accessing system wide performance counters.

Pushed, thank you!

Regards,

Tvrtko

Quoted 29 lines
Quoted 29 lines

Issue: https://gitlab.freedesktop.org/drm/intel/-/issues/5018

---
  tools/intel_gpu_top.c | 9 +++++++++
  1 file changed, 9 insertions(+)
tools/intel_gpu_top.c +9 -1
index 81c724d1fe1c..0404a5881b40 100644
@@ -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;
 	}
--

2.32.0

#3 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for intel_gpu_top: Improve error message when insufficient privilege

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: intel_gpu_top: Improve error message when insufficient privilege
URL : https://patchwork.freedesktop.org/series/99576/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11173 -> IGTPW_6592
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_6592 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_6592, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/index.html

Participating hosts (43 -> 44)
------------------------------

Additional (2): fi-icl-u2 fi-pnv-d510
Missing (1): fi-bdw-samus

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_6592:

### IGT changes ###

#### Possible regressions ####

* igt@i915_pm_rpm@module-reload:
- fi-cfl-8109u: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11173/fi-cfl-8109u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-cfl-8109u/igt@[email protected]

Known issues
------------

Here are the changes found in IGTPW_6592 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@fork-gfx0:
- fi-icl-u2: NOTRUN -> [SKIP][3] ([fdo#109315]) +17 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-icl-u2/igt@amdgpu/[email protected]

* igt@gem_exec_suspend@basic-s3:
- fi-skl-6600u: NOTRUN -> [FAIL][4] ([i915#4547])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-skl-6600u/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-icl-u2: NOTRUN -> [SKIP][5] ([i915#2190])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-icl-u2/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- fi-icl-u2: NOTRUN -> [SKIP][6] ([i915#4613]) +3 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-icl-u2/igt@[email protected]

* igt@i915_selftest@live@memory_region:
- fi-cfl-8109u: [PASS][7] -> [DMESG-WARN][8] ([i915#203]) +11 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11173/fi-cfl-8109u/igt@i915_selftest@live@memory_region.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-cfl-8109u/igt@i915_selftest@live@memory_region.html

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-icl-u2: NOTRUN -> [SKIP][9] ([fdo#111827]) +8 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-icl-u2/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-icl-u2: NOTRUN -> [SKIP][10] ([fdo#109278]) +2 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-icl-u2/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- fi-icl-u2: NOTRUN -> [SKIP][11] ([fdo#109285])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-icl-u2/igt@[email protected]

* igt@prime_vgem@basic-userptr:
- fi-pnv-d510: NOTRUN -> [SKIP][12] ([fdo#109271]) +57 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-pnv-d510/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][13] ([i915#3301])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-icl-u2/igt@[email protected]

* igt@runner@aborted:
- fi-skl-6600u: NOTRUN -> [FAIL][14] ([i915#4312])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/fi-skl-6600u/igt@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#203]: https://gitlab.freedesktop.org/drm/intel/issues/203
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_6337 -> IGTPW_6592

CI-20190529: 20190529
CI_DRM_11173: 519df8ed94419812cc3999abc4a023d0e4df2cd0 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_6592: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/index.html
IGT_6337: 7c9c034619ef9dbfbfe041fbf3973a1cf1ac7a22 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6592/index.html