luisbocanegra / plasma-intel-gpu-monitor

KDE Plasma Widget that displays Intel GPU usage including wether or not video acceleration is being used.
https://www.pling.com/p/2128477
GNU General Public License v3.0
16 stars 1 forks source link

Modify kernel.perf_event_paranoid parameter #2

Closed AlfaSierra92 closed 8 months ago

AlfaSierra92 commented 8 months ago

In some distros such as Ubuntu, you have to set also the kernel.perf_event_paranoid parameter to 0 by the command sysctl or editing the sysctl.conf file; otherwise intel_gpu_tools cannot be executed with no sudo. Could you adding it to the readme file? Anyway, thanks for this work!

luisbocanegra commented 8 months ago

Even after enabling the systemd unit (or running sudo setcap cap_perfmon=+ep /usr/bin/intel_gpu_top)?

According to the docs setting CAP_PERFMON (privileged process) should be enough and more secure than setting /proc/sys/kernel/perf_event_paranoid to -1 or 0 (system wide), and at least on Arch the default value is 2.

Are there any errors when running intel_gpu_top from terminal without sudo?

AlfaSierra92 commented 8 months ago

Seems that on Ubuntu the default value is 4 so intel_gpu_top doesn't running without sudo

luisbocanegra commented 8 months ago

So looks like current Ubuntu (and maybe Debian too) have extra paranoia levels, 4 and possibly 3 for some old versions(?):

perf event paranoia level: -1 - not paranoid at all 0 - disallow raw tracepoint access for unpriv 1 - disallow cpu events for unpriv 2 - disallow kernel profiling for unpriv 3 - was either same as 2 or 4 in older kernels? https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal/tree/kernel/events/core.c 4 - disallow all unpriv perf event use

So if you set it to 2 it works, right? If so there's no need to go lower.

If that's the case I think it would be better to recommend setting it to 2 as most distros should support that value and is the default in the kernel.

AlfaSierra92 commented 8 months ago

Yes, settings it to 2 seems working fine

luisbocanegra commented 8 months ago

Thanks, I will add it to the README

luisbocanegra commented 8 months ago

BTW, which GPU(s) do you have in your system?

AlfaSierra92 commented 8 months ago

BTW, which GPU(s) do you have in your system?

Intel UHD620

luisbocanegra commented 8 months ago

Done in https://github.com/luisbocanegra/plasma-intel-gpu-monitor/commit/ea05c40c86279260c0128f0eb322a8da3c4ae6c8 thanks for the feedback