Device hint for hwpstate_intel AC/BAT states?

I use this in sysctl.conf:

Code:
dev.hwpstate_intel.0.epp=0

Which works to force max-CPU clocks, but I'd like to be able to set a different epp mode on battery and switch automatically between that on BATT and AC epp=0. On Linux I do it through udev.

Any suggestions? I'm thinking a device hint could do this?
 
I am using custom simple script with devd(8) for this:
Code:
#!/bin/sh

# CPU perfomance, hwpstate_intel(8)
case $1 in
    economy)
        epp_value="100"
        backlight 20
        service power_profile 0x00
        ;;
    balance)
        epp_value="50"
        backlight 50
        service power_profile 0x01
        ;;
    perfomance)
        epp_value="0"
        ;;
esac

# Set CPU cores to epp level
ncpu=`sysctl -n hw.ncpu`
for cpu in `seq 0 $((${ncpu} - 1))`
do
    sysctl -q dev.hwpstate_intel.${cpu}.epp=${epp_value}
done

devd configuration:
Code:
     notify 100 {
             match "system"                  "ACPI";
             match "subsystem"               "ACAD";
             match "notify"                  "0x00";
             action "/home/user/thinkpad-powersave economy";
     };
    
     notify 100 {
             match "system"                  "ACPI";
             match "subsystem"               "ACAD";
             match "notify"                  "0x01";
             action "/home/user/thinkpad-powersave balance";
     };
 
Hey, I'm a bit confused about how this works. I thought the idea was that "Speed Shift" would let the hardware decide what frequency to run at. In the man page for hwpstate_intel:

dev.hwpstate_intel.%d.epp
Energy/Performance Preference. Valid values range from 0 to 100.
Setting this field conveys a hint to the hardware regarding a
preference towards performance (at value 0), energy efficiency
(at value 100), or somewhere in between.

So this seems like a suggestion, but when I suggest performance (epp=0), dev.cpu.0.freq seems like it's pegged at the max (the temperature is also a few degrees hotter than epp=100) and I don't see the frequency vary. Setting epp=100 gets the frequency moving, should I just leave it at the default 50? This is what I have at the moment:

λ sysctl dev.cpu.0
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
dev.cpu.0.cx_usage_counters: 1547673 1137070 228449
dev.cpu.0.cx_usage: 53.12% 39.03% 7.84% last 179us
dev.cpu.0.cx_lowest: C8
dev.cpu.0.cx_supported: C1/1/1 C2/2/127 C3/3/1048
dev.cpu.0.freq_levels: 2188/-1
dev.cpu.0.freq: 1326
dev.cpu.0.temperature: 41.0C
dev.cpu.0.coretemp.throttle_log: 0
dev.cpu.0.coretemp.tjmax: 100.0C
dev.cpu.0.coretemp.resolution: 1
dev.cpu.0.coretemp.delta: 59
dev.cpu.0.%iommu:
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=ACPI0007 _UID=0 _CID=none
dev.cpu.0.%location: handle=\_SB_.PR00
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU
 
Back
Top