powerD seem not working

Started by payback007, June 29, 2022, 11:37:27 PM

Previous topic - Next topic
Dear all,

I'm trying to enable powerD functionality, but it seems powerD is not working:

from BIOS: CPU frequency 800-2100 MHz possible
P-states: enabled
C-states: enabled
HWP-states: enabled

Mainboard: Supermicro X11SSH-LN4F
CPU: Intel XEON E3-1240L v5

Is there anything I need to enable too?

sysctl dev.cpu.0 show following output:

dev.cpu.0.temperature: 45.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: 55
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
dev.cpu.0.cx_usage_counters: 313694 0 0
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 335us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/151 C3/3/256
dev.cpu.0.freq_levels: 2100/-1
dev.cpu.0.freq: 2914
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0 _CID=none
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU


result: there is only one CPU level. Is there anything wrong in configuration or do I have to enable something different?

I can confirm this even with 22.7. PowerD doesn't seem to work at all. On a system with a Intel Celeron N5105, the CPU clock stays all the time at 2 GHz while in another ...sense you can see frequencies as low as 800 MHz on the same hardware.

Quote from: torob2 on August 14, 2022, 04:14:44 PM
I can confirm this even with 22.7. PowerD doesn't seem to work at all.

You might want to check your bios (updates/settings), because PowerD does work:

dev.cpu.0.temperature: 57.0C
dev.cpu.0.coretemp.throttle_log: 0
dev.cpu.0.coretemp.tjmax: 96.0C
dev.cpu.0.coretemp.resolution: 1
dev.cpu.0.coretemp.delta: 38
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.0.cx_usage_counters: 36741498 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 96us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/50
dev.cpu.0.freq_levels: 2000/0 1900/0 1800/0 1700/0 1600/0 1500/0 1400/0 1300/0 1200/0 1100/0 1000/0 900/0 800/0
dev.cpu.0.freq: 800
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0 _CID=none
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

Well, that's not what's happening here with an Intel Celeron N5105 system:

dev.cpu.0.temperature: 53.0C
dev.cpu.0.coretemp.throttle_log: 0
dev.cpu.0.coretemp.tjmax: 105.0C
dev.cpu.0.coretemp.resolution: 1
dev.cpu.0.coretemp.delta: 52
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
dev.cpu.0.cx_usage_counters: 10643 0 0
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 134us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/253 C3/3/1048
dev.cpu.0.freq_levels: 1996/-1
dev.cpu.0.freq: 2096
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0 _CID=none
dev.cpu.0.%location: handle=\_SB_.PR00
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU


It has nothing to do with the BIOS settings because the same settings are used for the other ...sense system which is able to throttle the CPU below 2 GHz. I would have expected an opposing result because the other system is based on FreeBSD 12.3 while OPNsense 22.7 is using FreeBSD 13.1 and the Intel Celeron N5105 (Jasper Lake) is still quite new given its release in 2021.

What's set to in System > Settings > Miscellaneous > Thermal Sensors and Power Savings ?
They might need a review.

Thermal Sensors are set to Intel, of course. PowerD is enabled and set to Hiadaptive. The same settings as in the other ...sense. CPU clock goes up (max 2.9 GHz) if needed but never below 2 GHz whenever I checked.

What happens when you change from hiadaptive to adaptive?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

I seem to have the same on an Intel 8565U. Adaptive / Hi-Adaptive makes no difference. Running 22.7.1.

dev.cpu.0.temperature: 35.0C
dev.cpu.0.coretemp.throttle_log: 1
dev.cpu.0.coretemp.tjmax: 100.0C
dev.cpu.0.coretemp.resolution: 1
dev.cpu.0.coretemp.delta: 65
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
dev.cpu.0.cx_usage_counters: 139656250 0 0
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 94us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/151 C3/3/1034
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 795
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0 _CID=none
dev.cpu.0.%location: handle=\_SB_.PR00
dev.cpu.0.%driver: cpu



Sorry I can't diagnose at the moment. All my Intel freebsd machines are switched off, only amd in use at present. At a glance however it seems the cpu or bios is not reporting scaling frequencies available.

Quote from: cookiemonster on August 15, 2022, 10:46:50 PM
At a glance however it seems the cpu or bios is not reporting scaling frequencies available.

PowerD can only switch frequencies if your CPU reports them, like:

dev.cpu.0.freq_levels: 2000/0 1900/0 1800/0 1700/0 1600/0 1500/0 1400/0 1300/0 1200/0 1100/0 1000/0 900/0 800/0

If you see something like this you probably have a Intel Speed Shift CPU:

dev.cpu.0.freq_levels: 2000/-1

PowerD can't "switch" between a single entry, so don't blaim PowerD, nothing wrong with that poor little daemon...

Tweaking your base speed (or disable it all together and try to use a "legacy" driver _with_ PowerD), play around with:

man hwpstate_intel




August 15, 2022, 11:32:04 PM #10 Last Edit: August 16, 2022, 12:20:39 AM by Taunt9930
That could be the issue for me - a bit of research suggests the i7-8565 is an Intel Speedshift CPU. I didn't realise this was different/exclusive to the normal Processor / C-State scaling.

That being the case, what are my options with OPNSense? You've hinted at a different driver, but as a newbie to the platform I'm not clear.

I found this that suggest Speedshift should just work? https://forum.opnsense.org/index.php?topic=26590.0

EDIT:

OK, so freeBSD 13.0 introduced a Speedshiftdriver. I have validated that is what my system is using, and why powerd does not work:

dmesg | grep hwpstate_inte
hwpstate_intel0: <Intel Speed Shift> on cpu0
hwpstate_intel1: <Intel Speed Shift> on cpu1
hwpstate_intel2: <Intel Speed Shift> on cpu2
hwpstate_intel3: <Intel Speed Shift> on cpu3
hwpstate_intel4: <Intel Speed Shift> on cpu4
hwpstate_intel5: <Intel Speed Shift> on cpu5
hwpstate_intel6: <Intel Speed Shift> on cpu6
hwpstate_intel7: <Intel Speed Shift> on cpu7


I've also seen that this indicates that the new man:hwpstate_intel driver is in use.

sysctl dev.cpufreq.0.freq_driver
dev.cpufreq.0.freq_driver: hwpstate_intel0


On such systems, the oid `dev.cpu.%d.freq_levels` will show only the maximum CPU frequency, and will indicate a power consumption level of `-1`.

sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 795


Thus, the reason you see xxxx/-1 when querying. What I need to work out now is why the maximum shown is 2000, not what the chip is able to do. And also why it *seems* to be stuck at the lowest level of 795.

Any further guidance appreciated - hopefully some of the above helps the others, as I see similar outputs.


Thanks.

Quote from: Taunt9930 on August 15, 2022, 11:32:04 PM

I found this that suggest Speedstep should just work? https://forum.opnsense.org/index.php?topic=26590.0


Mind the little details: SpeedStep & SpeedShift, the latter is the shiny new thing supported by hwpstate_intel. I don't have a recent Intel CPU in reach, but you can try to completly disable hwpstate (and hope the "legacy" cpufreq drivers kick in that should be supported by PowerD)

From the man page:

Tunable: (0=enabled, 1=disabled)
hint.hwpstate_intel.0.disabled

Or tweak hwpstate from it's default "performance" (0) to "efficient" (100) so it lowers its base clock

dev.hwpstate_intel.0.epp 100

SpeedShift should be controlled by the CPU itself instead of PowerD in that case

Quote from: netnut on August 16, 2022, 12:16:42 AM
Quote from: Taunt9930 on August 15, 2022, 11:32:04 PM

I found this that suggest Speedstep should just work? https://forum.opnsense.org/index.php?topic=26590.0


Mind the little details: SpeedStep & SpeedShift, the latter is the shiny new thing supported by hwpstate_intel. I don't have a recent Intel CPU in reach, but you can try to completly disable hwpstate (and hope the "legacy" cpufreq drivers kick in that should be supported by PowerD)

From the man page:

Tunable: (0=enabled, 1=disabled)
hint.hwpstate_intel.0.disabled

Or tweak hwpstate from it's default "performance" (0) to "efficient" (100) so it lowers its base clock

dev.hwpstate_intel.0.epp 100

SpeedShift should be controlled by the CPU itself instead of PowerD in that case

Thanks netnut, appreciate the steer! Whilst you were replying I already modified my post above, several times (LoL) - I was getting confused with speedstep/speedshift. My CPU is indeed SpeedShift enabled and I think I've got a bit more work to do to understand what (if anything) is going on - it actually seems to be stuck in the lower state, and reports a top frequency that is too low.

August 16, 2022, 12:42:04 AM #13 Last Edit: August 16, 2022, 06:39:21 PM by Taunt9930
OK, so in my case, it looks like the reporting is broken, but the driver works.

As per my post above, this response:

dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 795


Would suggest that the maximum frequency scalable by the Speedshift driver is 2000MHz. However (and this took ages), putting the firewall under some load using a speedtest (PPPoE connection!) and various other things, and repeatedly querying the processor speed using the shell, suggests it is working based on the outputs:

dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 795
root@LushBrain:~ # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 894
root@LushBrain:~ # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 795
root@LushBrain:~ # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 894
root@LushBrain:~ # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 894
root@LushBrain:~ # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 894
root@LushBrain:~ # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 2508
root@LushBrain:~ # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 894
root@LushBrain:~ # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 795
root@LushBrain:~ # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpu.0.freq_levels: 2000/-1
dev.cpu.0.freq: 4082


So, if you have a SpeedSHIFT CPU, disable PowerD (it WILL NOT work with hwpstates driver) and it (SpeedSHIFT) should 'just work'. As Netnut has noted above, you can also tweak hwpstate from it's default "performance" (0) to "efficient" (100).

Hopefully that helps at least one of you guys - @torob2, that is almost certainly the case for you and @payback007 it also looks like you have a speedshift CPU, too.

Quote from: torob2 on August 15, 2022, 11:24:24 AM
Well, that's not what's happening here with an Intel Celeron N5105 system:

dev.cpu.0.temperature: 53.0C
dev.cpu.0.coretemp.throttle_log: 0
dev.cpu.0.coretemp.tjmax: 105.0C
dev.cpu.0.coretemp.resolution: 1
dev.cpu.0.coretemp.delta: 52
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
dev.cpu.0.cx_usage_counters: 10643 0 0
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 134us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/253 C3/3/1048
dev.cpu.0.freq_levels: 1996/-1
dev.cpu.0.freq: 2096
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0 _CID=none
dev.cpu.0.%location: handle=\_SB_.PR00
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU


It has nothing to do with the BIOS settings because the same settings are used for the other ...sense system which is able to throttle the CPU below 2 GHz. I would have expected an opposing result because the other system is based on FreeBSD 12.3 while OPNsense 22.7 is using FreeBSD 13.1 and the Intel Celeron N5105 (Jasper Lake) is still quite new given its release in 2021.

I'm seeing the same behavior unfortunately. Same processor.