erpalma / throttled

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

struct.error: argument out of range #262

Closed ragusa87 closed 2 months ago

ragusa87 commented 3 years ago

Hello,

After installing and running the package, I got an instant crash. Can you fix it ? Thanks in advance !

➜ sudo /usr/lib/throttled/lenovo_fix.py --debug
[I] Detected CPU architecture: Intel KabylakeG
[I] Trying to unlock MSR allow_writes.
[I] Loading config file.
[D] cpu platform info: maximum non turbo ratio = 29
[D] cpu platform info: maximum efficiency ratio = 8
[D] cpu platform info: minimum operating ratio = 8
[D] cpu platform info: feature ppin cap = 0
[D] cpu platform info: feature programmable turbo ratio = 1
[D] cpu platform info: feature programmable tdp limit = 1
[D] cpu platform info: number of additional tdp profiles = 1
[D] cpu platform info: feature programmable temperature target = 1
[D] cpu platform info: feature low power mode = 0
[D] Undervolt plane CORE - write 0 mV (0x0) - read 0 mV (0x0) - match OK
[D] Undervolt plane GPU - write 0 mV (0x0) - read 0 mV (0x0) - match OK
[D] Undervolt plane CACHE - write 0 mV (0x0) - read 0 mV (0x0) - match OK
[D] Undervolt plane UNCORE - write 0 mV (0x0) - read 0 mV (0x0) - match OK
[D] Undervolt plane ANALOGIO - write 0 mV (0x0) - read 0 mV (0x0) - match OK
[D] HWP - write "0x80" - read "0x80" - match OK
[D] core 0 thermal status: thermal limit status = 0
[D] core 0 thermal status: thermal limit log = 0
[D] core 0 thermal status: prochot or forcepr status = 0
[D] core 0 thermal status: prochot or forcepr log = 1
[I] Starting main loop.
[D] core 0 thermal status: crit temp status = 0
[D] core 0 thermal status: crit temp log = 0
[D] core 0 thermal status: thermal threshold1 status = 0
[D] core 0 thermal status: thermal threshold1 log = 0
[D] core 0 thermal status: thermal threshold2 status = 0
[D] core 0 thermal status: thermal threshold2 log = 0
[D] core 0 thermal status: power limit status = 0
[D] core 0 thermal status: power limit log = 1
[D] core 0 thermal status: current limit status = 0
[D] core 0 thermal status: current limit log = 1
[D] core 0 thermal status: cross domain limit status = 0
[D] core 0 thermal status: cross domain limit log = 0
[D] core 0 thermal status: cpu temp = 28
[D] core 0 thermal status: temp resolution = 1
[D] core 0 thermal status: reading valid = 1
[D] core 1 thermal status: thermal limit status = 0
[D] core 1 thermal status: thermal limit log = 0
[D] core 1 thermal status: prochot or forcepr status = 0
[D] core 1 thermal status: prochot or forcepr log = 1
[D] core 1 thermal status: crit temp status = 0
[D] core 1 thermal status: crit temp log = 0
[D] core 1 thermal status: thermal threshold1 status = 0
[D] core 1 thermal status: thermal threshold1 log = 0
[D] core 1 thermal status: thermal threshold2 status = 0
[D] core 1 thermal status: thermal threshold2 log = 0
[D] core 1 thermal status: power limit status = 0
[D] core 1 thermal status: power limit log = 1
[D] core 1 thermal status: current limit status = 0
[D] core 1 thermal status: current limit log = 1
[D] core 1 thermal status: cross domain limit status = 0
[D] core 1 thermal status: cross domain limit log = 0
[D] core 1 thermal status: cpu temp = 29
[D] core 1 thermal status: temp resolution = 1
[D] core 1 thermal status: reading valid = 1
[D] core 2 thermal status: thermal limit status = 0
[D] core 2 thermal status: thermal limit log = 0
[D] core 2 thermal status: prochot or forcepr status = 0
[D] core 2 thermal status: prochot or forcepr log = 1
[D] core 2 thermal status: crit temp status = 0
[D] core 2 thermal status: crit temp log = 0
[D] core 2 thermal status: thermal threshold1 status = 0
[D] core 2 thermal status: thermal threshold1 log = 0
[D] core 2 thermal status: thermal threshold2 status = 0
[D] core 2 thermal status: thermal threshold2 log = 0
[D] core 2 thermal status: power limit status = 0
[D] core 2 thermal status: power limit log = 1
[D] core 2 thermal status: current limit status = 0
[D] core 2 thermal status: current limit log = 1
[D] core 2 thermal status: cross domain limit status = 0
[D] core 2 thermal status: cross domain limit log = 0
[D] core 2 thermal status: cpu temp = 31
[D] core 2 thermal status: temp resolution = 1
[D] core 2 thermal status: reading valid = 1
[D] core 3 thermal status: thermal limit status = 0
[D] core 3 thermal status: thermal limit log = 0
[D] core 3 thermal status: prochot or forcepr status = 0
[D] core 3 thermal status: prochot or forcepr log = 1
[D] core 3 thermal status: crit temp status = 0
[D] core 3 thermal status: crit temp log = 0
[D] core 3 thermal status: thermal threshold1 status = 0
[D] core 3 thermal status: thermal threshold1 log = 0
[D] core 3 thermal status: thermal threshold2 status = 0
[D] core 3 thermal status: thermal threshold2 log = 0
[D] core 3 thermal status: power limit status = 0
[D] core 3 thermal status: power limit log = 1
[D] core 3 thermal status: current limit status = 0
[D] core 3 thermal status: current limit log = 1
[D] core 3 thermal status: cross domain limit status = 0
[D] core 3 thermal status: cross domain limit log = 0
[D] core 3 thermal status: cpu temp = 25
[D] core 3 thermal status: temp resolution = 1
[D] core 3 thermal status: reading valid = 1
[D] core 4 thermal status: thermal limit status = 0
[D] core 4 thermal status: thermal limit log = 0
[D] core 4 thermal status: prochot or forcepr status = 0
[D] core 4 thermal status: prochot or forcepr log = 1
[D] core 4 thermal status: crit temp status = 0
[D] core 4 thermal status: crit temp log = 0
[D] core 4 thermal status: thermal threshold1 status = 0
[D] core 4 thermal status: thermal threshold1 log = 0
[D] core 4 thermal status: thermal threshold2 status = 0
[D] core 4 thermal status: thermal threshold2 log = 0
[D] core 4 thermal status: power limit status = 0
[D] core 4 thermal status: power limit log = 1
[D] core 4 thermal status: current limit status = 0
[D] core 4 thermal status: current limit log = 1
[D] core 4 thermal status: cross domain limit status = 0
[D] core 4 thermal status: cross domain limit log = 0
[D] core 4 thermal status: cpu temp = 28
[D] core 4 thermal status: temp resolution = 1
[D] core 4 thermal status: reading valid = 1
[D] core 5 thermal status: thermal limit status = 0
[D] core 5 thermal status: thermal limit log = 0
[D] core 5 thermal status: prochot or forcepr status = 0
[D] core 5 thermal status: prochot or forcepr log = 1
[D] core 5 thermal status: crit temp status = 0
[D] core 5 thermal status: crit temp log = 0
[D] core 5 thermal status: thermal threshold1 status = 0
[D] core 5 thermal status: thermal threshold1 log = 0
[D] core 5 thermal status: thermal threshold2 status = 0
[D] core 5 thermal status: thermal threshold2 log = 0
[D] core 5 thermal status: power limit status = 0
[D] core 5 thermal status: power limit log = 1
[D] core 5 thermal status: current limit status = 0
[D] core 5 thermal status: current limit log = 1
[D] core 5 thermal status: cross domain limit status = 0
[D] core 5 thermal status: cross domain limit log = 0
[D] core 5 thermal status: cpu temp = 29
[D] core 5 thermal status: temp resolution = 1
[D] core 5 thermal status: reading valid = 1
[D] core 6 thermal status: thermal limit status = 0
[D] core 6 thermal status: thermal limit log = 0
[D] core 6 thermal status: prochot or forcepr status = 0
[D] core 6 thermal status: prochot or forcepr log = 1
[D] core 6 thermal status: crit temp status = 0
[D] core 6 thermal status: crit temp log = 0
[D] core 6 thermal status: thermal threshold1 status = 0
[D] core 6 thermal status: thermal threshold1 log = 0
[D] core 6 thermal status: thermal threshold2 status = 0
[D] core 6 thermal status: thermal threshold2 log = 0
[D] core 6 thermal status: power limit status = 0
[D] core 6 thermal status: power limit log = 1
[D] core 6 thermal status: current limit status = 0
[D] core 6 thermal status: current limit log = 1
[D] core 6 thermal status: cross domain limit status = 0
[D] core 6 thermal status: cross domain limit log = 0
[D] core 6 thermal status: cpu temp = 31
[D] core 6 thermal status: temp resolution = 1
[D] core 6 thermal status: reading valid = 1
[D] core 7 thermal status: thermal limit status = 0
[D] core 7 thermal status: thermal limit log = 0
[D] core 7 thermal status: prochot or forcepr status = 0
[D] core 7 thermal status: prochot or forcepr log = 1
[D] core 7 thermal status: crit temp status = 0
[D] core 7 thermal status: crit temp log = 0
[D] core 7 thermal status: thermal threshold1 status = 0
[D] core 7 thermal status: thermal threshold1 log = 0
[D] core 7 thermal status: thermal threshold2 status = 0
[D] core 7 thermal status: thermal threshold2 log = 0
[D] core 7 thermal status: power limit status = 0
[D] core 7 thermal status: power limit log = 1
[D] core 7 thermal status: current limit status = 0
[D] core 7 thermal status: current limit log = 1
[D] core 7 thermal status: cross domain limit status = 0
[D] core 7 thermal status: cross domain limit log = 0
[D] core 7 thermal status: cpu temp = 25
[D] core 7 thermal status: temp resolution = 1
[D] core 7 thermal status: reading valid = 1
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/throttled/lenovo_fix.py", line 704, in power_thread
    writemsr('MSR_TEMPERATURE_TARGET', write_value)
  File "/usr/lib/throttled/lenovo_fix.py", line 221, in writemsr
    os.write(f, struct.pack('Q', val))
struct.error: argument out of range

Python

➜ python --version
Python 3.9.6

Kernel

➜ uname -a  
Linux hostname 5.10.53-1-MANJARO #1 SMP PREEMPT Mon Jul 26 07:18:28 UTC 2021 x86_64 GNU/Linux

Package

pacman -Q throttled
throttled 0.9.2-1

Settings

[GENERAL]
# Enable or disable the script execution
Enabled: True
# SYSFS path for checking if the system is running on AC power
Sysfs_Power_Path: /sys/class/power_supply/AC*/online
# Auto reload config on changes
Autoreload: True

## Settings to apply while connected to Battery power
[BATTERY]
# Update the registers every this many seconds
Update_Rate_s: 30
# Max package power for time window #1
PL1_Tdp_W: 29
# Time window #1 duration
PL1_Duration_s: 28
# Max package power for time window #2
PL2_Tdp_W: 44
# Time window #2 duration
PL2_Duration_S: 0.002
# Max allowed temperature before throttling
Trip_Temp_C: 85
# Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL)
cTDP: 0
# Disable BDPROCHOT (EXPERIMENTAL)
Disable_BDPROCHOT: False

## Settings to apply while connected to AC power
[AC]
# Update the registers every this many seconds
Update_Rate_s: 5
# Max package power for time window #1
PL1_Tdp_W: 44
# Time window #1 duration
PL1_Duration_s: 28
# Max package power for time window #2
PL2_Tdp_W: 44
# Time window #2 duration
PL2_Duration_S: 0.002
# Max allowed temperature before throttling
Trip_Temp_C: 95
# Set HWP energy performance hints to 'performance' on high load (EXPERIMENTAL)
HWP_Mode: False
# Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL)
cTDP: 0
# Disable BDPROCHOT (EXPERIMENTAL)
Disable_BDPROCHOT: False

# All voltage values are expressed in mV and *MUST* be negative (i.e. undervolt)! 
[UNDERVOLT.BATTERY]
# CPU core voltage offset (mV)
CORE: 0
# Integrated GPU voltage offset (mV)
GPU: 0
# CPU cache voltage offset (mV)
CACHE: 0
# System Agent voltage offset (mV)
UNCORE: 0
# Analog I/O voltage offset (mV)
ANALOGIO: 0

# All voltage values are expressed in mV and *MUST* be negative (i.e. undervolt)!
[UNDERVOLT.AC]
# CPU core voltage offset (mV)
CORE: 0
# Integrated GPU voltage offset (mV)
GPU: 0
# CPU cache voltage offset (mV)
CACHE: 0
# System Agent voltage offset (mV)
UNCORE: 0
# Analog I/O voltage offset (mV)
ANALOGIO: 0

# [ICCMAX.AC]
# # CPU core max current (A)
# CORE: 
# # Integrated GPU max current (A)
# GPU: 
# # CPU cache max current (A)
# CACHE: 

# [ICCMAX.BATTERY]
# # CPU core max current (A)
# CORE: 
# # Integrated GPU max current (A)
# GPU: 
# # CPU cache max current (A)
# CACHE: 

Sensors

➜ sensors
iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:        +54.0°C  

pch_skylake-virtual-0
Adapter: Virtual device
temp1:        +66.0°C  

BAT0-acpi-0
Adapter: ACPI interface
in0:          12.79 V  
curr1:         0.00 A  

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +47.0°C  (high = +74.0°C, crit = +80.0°C)
Core 0:        +46.0°C  (high = +74.0°C, crit = +80.0°C)
Core 1:        +46.0°C  (high = +74.0°C, crit = +80.0°C)
Core 2:        +47.0°C  (high = +74.0°C, crit = +80.0°C)
Core 3:        +46.0°C  (high = +74.0°C, crit = +80.0°C)

nvme-pci-0400
Adapter: PCI adapter
Composite:    +42.9°C  (low  = -273.1°C, high = +82.8°C)
                       (crit = +84.8°C)
Sensor 1:     +42.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +46.9°C  (low  = -273.1°C, high = +65261.8°C)

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +12.0°C  (crit = +120.0°C)