vagnum08 / cpupower-gui

cpupower-gui is a graphical program that is used to change the scaling frequency limits of the cpu, similar to cpupower.
GNU General Public License v3.0
430 stars 31 forks source link

WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy #100

Closed bill88t closed 1 year ago

bill88t commented 1 year ago

Describe the bug Fails to retrieve cpu core properties on disabled cores.

cpupower-gui pr PerformanceMine
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
Applying profile:  PowersaveMine
Setting CPU: 0
    Minimum Frequency: 1400.0 MHz, Maximum Frequency: 1400.0 MHz
    Governor: Powersave, Online: True

Traceback (most recent call last):
  File "/usr/bin/cpupower-gui", line 351, in <module>
    args.func(args)
  File "/usr/bin/cpupower-gui", line 137, in set_profile
    apply_cpu_profile(conf.get_profile(prof))
  File "/usr/share/cpupower-gui/cpupower_gui/helper.py", line 52, in apply_cpu_profile
    print(MSG.format(cpu, fmin / 1e3, fmax / 1e3, gov.capitalize(), online))
AttributeError: 'NoneType' object has no attribute 'capitalize'

To Reproduce

  1. Disable some cores.
  2. Try to reenable them with a profile

Setup

Additional context Ryzen 3 3250U Python3.10 Activating a profile that enables the cpu's will enable one, so a temporary workaround is to spam it till all are online. cpu-info freq will also fail.

cat /etc/cpupower_gui.d/Powersave.profile 
name: "PowersaveMine"

# CPU  Fmin   Fmax  Governor      Online
0    1400   1400   powersave
1-3  1400   1400   powersave 0
cat /etc/cpupower_gui.d/Performance.profile 
name: "PerformanceMine"

# CPU  Fmin   Fmax  Governor      Online
0-3    1400   2600  powersave     1
bill88t commented 1 year ago

When cpu1 is disabled:

cat /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq 
cat: /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq: Device or resource busy
cat /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_max_freq 
cat: /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_max_freq: Device or resource busy

However sudo sh -c 'echo "1" > /sys/devices/system/cpu/cpu1/online' works just fine. Maybe it is wise to check if the core is enabled first.

I can probably fix this myself.

vagnum08 commented 1 year ago

I am aware of this. I found out a couple of weeks ago that this happens when I was trying to troubleshoot another bug.

I did some changes in helper.py if I recall correctly.

Feel free to have a go at fixing this and I will be happy to merge a pull request.

bill88t commented 1 year ago

All yours chief. Tested it against my system.

Reginald-Gillespie commented 4 months ago

The classic "it works on my system" lol. I had this issue just now when messing with disabling cores. 6 of my cores are hyperthreaded to each handle 2 threads (so I have 14 hardware cores but the computer sees 20), not sure if that might be related or not.

Here's the output:

wkoa {~} $ cpupower-gui off 1
Setting CPU1 offline...
OK
wkoa {~} $ cpupower-gui co
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
WARNING! Unknown CPU frequency, cause: [Errno 16] Device or resource busy
Applying configuration... 
Setting CPU: 0
    Minimum Frequency: 400.0 MHz, Maximum Frequency: 4700.0 MHz
    Governor: Powersave, Online: True

Traceback (most recent call last):
  File "/usr/bin/cpupower-gui", line 351, in <module>
    args.func(args)
  File "/usr/bin/cpupower-gui", line 72, in set_config
    ret = apply_configuration(conf)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/cpupower-gui/cpupower_gui/helper.py", line 67, in apply_configuration
    apply_cpu_profile(config.get_profile(profile))
  File "/usr/share/cpupower-gui/cpupower_gui/helper.py", line 52, in apply_cpu_profile
    print(MSG.format(cpu, fmin / 1e3, fmax / 1e3, gov.capitalize(), online))

Same thing with sudo, whether that helps or not idk.