Skip to content

Crashes due to incorrect EPP handling #46

@NotWadeGrimridge

Description

@NotWadeGrimridge

I'm running c186c9a with the default config on Fedora 43, with tuned, tuned-ppd, and thermald disabled. My CPU: i7-8550U.

watt[4472]: [ERROR watt] failed to apply delta to CPU 0
watt[4472]: [ERROR watt] cause: this probably means that CPU 0 doesn't exist or doesn't support changing EPP
watt[4472]: [ERROR watt] cause: failed to write 'balance_performance' to '/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference'
watt[4472]: [ERROR watt] cause: device or resource busy (os error 16)
systemd[1]: watt.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: watt.service: Failed with result 'exit-code'.

This happens because cpu0's governor is set to performance. With intel_pstate in active mode, cpufreq governors work completely different. Only two are available. powersave becomes a dynamic governor, and performance locks EPP to 0 and writes are blocked. Relevant code in the kernel: intel_pstate.c#L768 (docs). The fix is simple: if EPP/EPB support is available, set the governor to powersave before touching the EPP/EPB sysfs knobs.

The daemon doesn't set the governor uniformly either:

$ grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor:powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor:powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu4/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu5/cpufreq/scaling_governor:powersave
/sys/devices/system/cpu/cpu6/cpufreq/scaling_governor:performance
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:performance

This leads to:

$ grep . /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference
/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference:performance
/sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference:balance_performance
/sys/devices/system/cpu/cpu2/cpufreq/energy_performance_preference:balance_performance
/sys/devices/system/cpu/cpu3/cpufreq/energy_performance_preference:performance
/sys/devices/system/cpu/cpu4/cpufreq/energy_performance_preference:performance
/sys/devices/system/cpu/cpu5/cpufreq/energy_performance_preference:balance_performance
/sys/devices/system/cpu/cpu6/cpufreq/energy_performance_preference:performance
/sys/devices/system/cpu/cpu7/cpufreq/energy_performance_preference:performance

And the daemon crashes when it hits the first write that fails. This inconsistency is probably caused by some other problem(?)

cc: @RGBCube

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions