Fedora 31 does not set scaling_governor for Haswell CPU

Hello,

After a reboot the scaling_governor (/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor) is not existing/not set for my Haswell setup. Clock speeds behave like ondemand/powersave.

Is this usually the case for Intel CPUs managed by intel_pstate?

The non-existing scaling_governor lets tools like gamemode fail as it tries to read the gov before it is entering gamemode and is thus unable to return -> the system is stuck in performance gov even after gamemode has shut down. Tested with gamemode 1.5.1.

cpupower:

$ cpupower frequency-info
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: Cannot determine or is not supported.
hardware limits: 800 MHz - 3.70 GHz
available cpufreq governors: performance powersave
Unable to determine current policy
current CPU frequency: Unable to call hardware
current CPU frequency: 1.96 GHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes

scaling_governor

$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
cat: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor: Invalid argument

# ?
find /sys -name scaling_governor

Searching in sys results only in the available policies:

/sys/devices/system/cpu/cpufreq/policy6/scaling_governor
/sys/devices/system/cpu/cpufreq/policy4/scaling_governor
/sys/devices/system/cpu/cpufreq/policy2/scaling_governor
/sys/devices/system/cpu/cpufreq/policy0/scaling_governor
/sys/devices/system/cpu/cpufreq/policy7/scaling_governor
/sys/devices/system/cpu/cpufreq/policy5/scaling_governor
/sys/devices/system/cpu/cpufreq/policy3/scaling_governor
/sys/devices/system/cpu/cpufreq/policy1/scaling_governor

To summarize my testing so far:

  • The scaling_governor is not set by default for the tested Haswell system.
    • For an tested AMD system it is set by default to ondemand.
  • Setting the scaling_governor with cpupower manually will make the scaling_governor interfaces available and enable gamemode to work as expected.
1 Like

  Use "cat" at non-symlinked addresses that "find" has found :) It'll show the current governor.  I'm doubt if an cpu can run without a policy at all.
  The intel_pstate driver has only two choices:  "performance" and "powersave"
  Inside of dir where "scaling_governor" is found:  there should be the files with a self-descriptive names.

ls  /sys/devices/system/cpu/cpufreq/policy0/
    affected_cpus       cpuinfo_max_freq
    cpuinfo_min_freq    cpuinfo_transition_latency
    related_cpus        scaling_available_governors
    scaling_cur_freq    scaling_driver
    scaling_governor    scaling_max_freq
    scaling_min_freq    scaling_setspeed

cat  /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors
    performance    powersave

# Achtung!  E-hungry (potentially)!
sudo sh -c 'echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
cat  /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
    performance

It is showing the available govs, the used driver as well as a link to the current scaling_gov. The current scaling_gov link is not valid until the gov is manually set on the tested Haswell system.

$ ls /sys/devices/system/cpu/cpufreq/policy0
affected_cpus cpuinfo_transition_latency scaling_cur_freq scaling_max_freq
cpuinfo_max_freq related_cpus scaling_driver scaling_min_freq
cpuinfo_min_freq scaling_available_governors scaling_governor scaling_setspeed

$ cat /sys/devices/system/cpu/cpufreq/policy0/*
0
3700000
800000
0
0
performance powersave
3257804
intel_pstate
cat: /sys/devices/system/cpu/cpufreq/policy0/scaling_governor: Invalid argument
3700000
800000

1 Like

Answer to your edit: You are summarizing the problem quite well. The initial scaling_governor has to be set manually for Sandy Bridge and higher. Tools like gamemode are saving the previous scaling_governor, then setting the performance and try to return afterwards. If the scaling_governor was not set beforehand it will not return and stay on performance for the current boot.

Keeping in mind: The initial intel_pstate gov, which is not visible as a scaling_governor, will handle the system as if setting it to powersave - from my monitoring of the clock speeds. So this problem is only affecting tools which rely on a set scaling_governor - which should be powersave on boot in my opinion.

1 Like

  IDK, but just for kicks:  Performing sudo sh -c 'cat ...' returns "Invalid argument" too?  In both t. emulator and tty?

Yes. Tested on emulator and tty on a fresh booted system.

$ sudo sh -c ‚Äėcat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor‚Äô
cat: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor: Invalid argument
cat: /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor: Invalid argument

$ gamemoderun … // setting gov to performance, quitting the game, gov is not returned correctly

$ sudo sh -c ‚Äėcat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor‚Äô
performance
performance
performance
performance
performance
performance
performance
performance

1 Like

  Solution of similar error (but write-related one), mentioning that driver is a thing that returns the error.  Not sure if this is relevant.

  intel_pstate, Operation Modes (Kernel's docs).
  intel_pstate, User-space interface in sysfs (Kernel's docs).

# what this shows after boot?
# can be 'active', 'passive', or 'off'
cat /sys/devices/system/cpu/intel_pstate/status

It shows active. Your linked information provides the background of this issue. See the active mode chapter: https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html#active-mode

I’ll add the information to the gamemode issue I’ve created. As of today the gamemode, which is installed by default on F31, will set scaling_governor to performance and not restore after the application has been closed.

Issue: https://github.com/FeralInteractive/gamemode/issues/205

1 Like