energy_uj is no longer readable
Describe the bug
As per this commit read access to /sys/class/powercap/intel-rapl*/*/energy_uj for non-privileged users is no longer allowed.
This appeared in kernel 5.4.77.
Since gamemoded should be started as a user service, it no longer has access to these system interfaces which means the iGPU governor feature is now broken.
To Reproduce Steps used to reproduce the behavior:
- Launch gamemod via
systemctl --user start gamemoded.service - Run
gamemode-simulate-gameorgamemoded -t - Monitor the output of
journalctl -f -n 0 - See error:
Failed to open file for read /sys/class/powercap/intel-rapl/intel-rapl:0/intel-rapl:0:0/energy_uj
Expected behavior Not seeing the error above and being able to use the iGPU governor feature.
System Info (please complete the following information):
- OS and version: debian sid/experimental with kernel 5.13.9
- GameMode Version: 1.6.1
Additional context
I use the script below started as a system (i.e., not user) systemd service, then add users who need GameMode to the games group.
#! /bin/bash
for NAME_PATH in $(find /sys/class/powercap/intel-rapl/intel-rapl\:0/intel-rapl\:0\:* -name name || true); do
NAME=$(cat "${NAME_PATH}")
if [[ "${NAME}" == "core" ]] || [[ "${NAME}" == "uncore" ]]; then
DIR_NAME=$(dirname "${NAME_PATH}")
chown root:games "${DIR_NAME}/energy_uj"
chmod g+r "${DIR_NAME}/energy_uj"
fi
done
It's a bit crude but it works. It seems this needs to be fixed with GameMode providing a script and systemd service like I do (or any better solution, or at least documentation of the issue and example of possible resolution), or the iGPU governor feature should be removed.
Still having this issue, after trying this workaround I stopped getting permission denied errors and now get invalid argument errors(using no config file or the example config file). Kernel 5.14.2-1-MANJARO.
I use the script below started as a system (i.e., not user) systemd service, then add users who need GameMode to the
gamesgroup.
Thanks for this, it's a nice albeit slightly hacky trick but it works on my system too (Ubuntu 20.04).