public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Improve error message when insufficient privilege
@ 2022-02-01 15:19 Tvrtko Ursulin
  2022-02-01 16:10 ` Dixit, Ashutosh
  0 siblings, 1 reply; 3+ messages in thread
From: Tvrtko Ursulin @ 2022-02-01 15:19 UTC (permalink / raw)
  To: igt-dev; +Cc: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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
---
 tools/intel_gpu_top.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 81c724d1fe1c..0404a5881b40 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;
 	}
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Improve error message when insufficient privilege
  2022-02-01 15:19 [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Improve error message when insufficient privilege Tvrtko Ursulin
@ 2022-02-01 16:10 ` Dixit, Ashutosh
  2022-02-02 10:54   ` Tvrtko Ursulin
  0 siblings, 1 reply; 3+ messages in thread
From: Dixit, Ashutosh @ 2022-02-01 16:10 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev, Intel-gfx

On Tue, 01 Feb 2022 07:19:46 -0800, Tvrtko Ursulin wrote:
>
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Print out end user friendly help text when the running user has
> insufficient privilege for accessing system wide performance counters.

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Issue: https://gitlab.freedesktop.org/drm/intel/-/issues/5018
> ---
>  tools/intel_gpu_top.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> index 81c724d1fe1c..0404a5881b40 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;
>	}
> --
> 2.32.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Improve error message when insufficient privilege
  2022-02-01 16:10 ` Dixit, Ashutosh
@ 2022-02-02 10:54   ` Tvrtko Ursulin
  0 siblings, 0 replies; 3+ messages in thread
From: Tvrtko Ursulin @ 2022-02-02 10:54 UTC (permalink / raw)
  To: Dixit, Ashutosh; +Cc: igt-dev, Intel-gfx


On 01/02/2022 16:10, Dixit, Ashutosh wrote:
> On Tue, 01 Feb 2022 07:19:46 -0800, Tvrtko Ursulin wrote:
>>
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Print out end user friendly help text when the running user has
>> insufficient privilege for accessing system wide performance counters.
> 
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

Pushed, thank you!

Regards,

Tvrtko

>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Issue: https://gitlab.freedesktop.org/drm/intel/-/issues/5018
>> ---
>>   tools/intel_gpu_top.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>> index 81c724d1fe1c..0404a5881b40 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;
>> 	}
>> --
>> 2.32.0
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-02 10:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-01 15:19 [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Improve error message when insufficient privilege Tvrtko Ursulin
2022-02-01 16:10 ` Dixit, Ashutosh
2022-02-02 10:54   ` Tvrtko Ursulin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox