erpalma / throttled

Workaround for Intel throttling issues in Linux.
MIT License
2.68k stars 166 forks source link

If you offline a CPU throttled won't start #367

Open travisdowns opened 1 week ago

travisdowns commented 1 week ago

I have CPU 6 offline (it's a HT sibling of 0 and I didn't want anything running there), using something like:

echo 0 | sudo tee /sys/devices/system/cpu/cpu6/online

then throttled would fail to start with an error like:

Traceback (most recent call last):
  File "/home/tdowns/dev/throttled/./throttled.py", line 1037, in <module>
    main()
  File "/home/tdowns/dev/throttled/./throttled.py", line 972, in main
    platform_info = get_cpu_platform_info()
  File "/home/tdowns/dev/throttled/./throttled.py", line 327, in get_cpu_platform_info
    features_msr_value = readmsr('MSR_PLATFORM_INFO', cpu=0)
  File "/home/tdowns/dev/throttled/./throttled.py", line 283, in readmsr
    raise e
  File "/home/tdowns/dev/throttled/./throttled.py", line 265, in readmsr
    f = os.open(addr, os.O_RDONLY)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/cpu/6/msr'

Not even sure this is worth fixing but I guess the right fix would be to check for which CPUs are online if the msr dir doesn't exist.