Do I need to enable PowerD on modern Intel CPUs compatible with EIST

Started by logi, September 13, 2024, 10:07:40 PM

Previous topic - Next topic
According to this section of the FreeBSD handbook:

https://docs.freebsd.org/en/books/handbook/config/#hwpstate_intel

It has the following note regarding PowerD and EIST (Enhanced Intel SpeedStep Technology):

NOTE: Users accustomed to using powerd or sysutils/powerdxx will find these utilities have been superseded by the hwpstate_intel driver and no longer work as expected.

The two CPUs I am using: Core i7-10810U and Celeron J6412, are compatible with EIST according to this information from Intel:

https://www.intel.com/content/www/us/en/support/articles/000007073/processors.html

Therefore, can I turn off PowerD? And keep all the power efficiency already in place by just the use of:

- hw.acpi.cpu.cx_lowest = C3
- dev.hwpstate_intel.0.epp = 90


In Tunables? Thank you

Update, I run the powerd -v command and got the following results:

The device with a CPU: i7-10810U

root@opnsense:~ # powerd -v

powerd: unable to determine AC line status

CPU frequency is below user-defined minimum; changing frequency to 1600 MHz

load 0%, current freq 904 MHz ( 0), wanted freq 1600 MHz

load 3%, current freq 904 MHz ( 0), wanted freq 1600 MHz


The device with a CPU: J6412:

root@vp2420:~ # powerd -v

powerd: unable to determine AC line status

CPU frequency is below user-defined minimum; changing frequency to 1996 MHz

load 6%, current freq 797 MHz ( 0), wanted freq 1996 MHz

load 0%, current freq 797 MHz ( 0), wanted freq 1996 MHz


Definitely it seems PowerD is trying to do the wrong thing, I think it makes sense to disable it, thoughts? Thank you

NOTE: Both devices are almost idle and configured with EIST for maximum power efficiency

> Definitely it seems PowerD is trying to do the wrong thing, I think it makes sense to disable it, thoughts?

That's my understanding - when I looked at this some while ago, there was a FreeBSD thread that basically said PowerD should probably be removed.

But you're correct - powerd should be disabled with your current setup, and use Speed Shift rather than Speed Step (I think that's the right way around) - I think powerd even caused some crashes for me (which is when I found the referenced FreeBSD thread).

Or, if you want to use PowerD, set:

hint.hwpstate_intel.0.disabled=1

... to disable Speed Shift.

Personally, with an i7-9700 I set 100 for every core and don't see any performance problems:

dev.hwpstate_intel.7.epp: 100
dev.hwpstate_intel.6.epp: 100
dev.hwpstate_intel.5.epp: 100
dev.hwpstate_intel.4.epp: 100
dev.hwpstate_intel.3.epp: 100
dev.hwpstate_intel.2.epp: 100
dev.hwpstate_intel.1.epp: 100
dev.hwpstate_intel.0.epp: 100


... and it still scales as needed, up to 'turbo' as well:

dev.cpu.7.freq_levels: 3000/-1
dev.cpu.7.freq: 897
dev.cpu.6.freq_levels: 3000/-1
dev.cpu.6.freq: 897
dev.cpu.5.freq_levels: 3000/-1
dev.cpu.5.freq: 897
dev.cpu.4.freq_levels: 3000/-1
dev.cpu.4.freq: 897
dev.cpu.3.freq_levels: 3000/-1
dev.cpu.3.freq: 897
dev.cpu.2.freq_levels: 3000/-1
dev.cpu.2.freq: 897
dev.cpu.1.freq_levels: 3000/-1
dev.cpu.1.freq: 897
dev.cpu.0.freq_levels: 3000/-1
dev.cpu.0.freq: 897



dev.cpu.7.freq_levels: 3000/-1
dev.cpu.7.freq: 1110
dev.cpu.6.freq_levels: 3000/-1
dev.cpu.6.freq: 1197
dev.cpu.5.freq_levels: 3000/-1
dev.cpu.5.freq: 1197
dev.cpu.4.freq_levels: 3000/-1
dev.cpu.4.freq: 1197
dev.cpu.3.freq_levels: 3000/-1
dev.cpu.3.freq: 1197
dev.cpu.2.freq_levels: 3000/-1
dev.cpu.2.freq: 1197
dev.cpu.1.freq_levels: 3000/-1
dev.cpu.1.freq: 1197
dev.cpu.0.freq_levels: 3000/-1
dev.cpu.0.freq: 1197


... but I have C1 as the lowest:

hw.acpi.cpu.cx_lowest: C1

Final thoughts: There is also the below:

machdep.hwpstate_pkg_ctrl   

Which:

QuoteSelects between package-level control (the default) and per-core control. "1" selects package-level control and "0" selects core-level control.

... setting to 0, per core, seems to be the best/recommended option:

https://wiki.freebsd.org/TuningPowerConsumption

QuoteOn systems where hwpstate_intel0: <Intel Speed Shift> on cpu0 appears in /var/run/dmesg.boot, it is recommended to set machdep.hwpstate_pkg_ctrl=0

Simple answers is:

If you CPu supports Intel SpeedStep, then disable PowerD
If you want to use PowerD, than disable Intel SpeedStep


Correction:
SpeedStep is the "old" method - needs PowerD.
Speed Shift is the new method and its available since 6th Gen of Intel CPUs (I think) - doesn't need PowerD.

Regards,
S.
Networking is love. You may hate it, but in the end, you always come back to it.

OPNSense HW
APU2D2 - deceased
N5105 - i226-V | Patriot 2x8G 3200 DDR4 | L 790 512G - VM HA(SOON)
N100   - i226-V | Crucial 16G  4800 DDR5 | S 980 500G - PROD

Quote from: Seimus on September 17, 2024, 01:39:10 PM
Simple answers is yes.

If you CPu supports Intel SpeedStep, then disable PowerD
If you want to use PowerD, than disable Intel SpeedStep

Regards,
S.

Almost the 'simple' answer ... but ... 's/SpeedStep/Speed\ Shift/g' ;)

Quote from: iMx on September 17, 2024, 01:14:20 PM
> Final thoughts: There is also the below:

machdep.hwpstate_pkg_ctrl   

Which:

QuoteSelects between package-level control (the default) and per-core control. "1" selects package-level control and "0" selects core-level control.

... setting to 0, per core, seems to be the best/recommended option:

https://wiki.freebsd.org/TuningPowerConsumption

QuoteOn systems where hwpstate_intel0: <Intel Speed Shift> on cpu0 appears in /var/run/dmesg.boot, it is recommended to set machdep.hwpstate_pkg_ctrl=0

Therefore, I set machdep.hwpstate_pkg_ctrl=0 as a Tunable value? Same as I did with:

hw.acpi.cpu.cx_lowest = C3
dev.hwpstate_intel.0.epp = 100

After enabling it in Tunables I didn't notice any difference in power consumption.

I have this other thread (below) related, where I did some comparisons with Linux, and I think there are some opportunities to optimize power consumption with FreedBSD, if it was possible with Linux.

https://forum.opnsense.org/index.php?topic=42886.0

Thank you

i have an i5-5200u CPU, this cpu has only speedstep tecnology available.
Without turning ON powerD, the cpu didn't scale its frequency.

QuoteTherefore, I set machdep.hwpstate_pkg_ctrl=0 as a Tunable value? Same as I did with:
I think you have to reboot for this one, not sure/clear if you did?

dev.hwpstate_intel.0.epp


There is 1 per core, in my case 0 -> 7

QuoteAfter enabling it in Tunables I didn't notice any difference in power consumption.

To be sure, make sure you're setting for each core in your machine, then reboot and check after a restart - with PowerD disabled as well.

Then, check the core frequency - and see if it scales under load/UI access etc.

sysctl dev.cpu | grep freq


Quotewhere I did some comparisons with Linux, and I think there are some opportunities to optimize power consumption with FreedBSD, if it was possible with Linux.

FreeBSD != Linux - the latter, in my experience, undoubtedly has better power management.  Linux has more users that require power management, laptops etc.

At the 11-13 watts you state in the other post, I think you have to be content with that - I'm content with 35-40 ish, on baremetal hardware.  But I have all ASPM disabled in the BIOS for stability, 8 x 1G and 4 x 10G interfaces.

I had stability issues with lower than C1 C-states some while ago, maybe even on different hardware than I'm running now, I can't remember, so by default I now disable anything lower than C1 in the BIOS anyway.

But you can see what C states are being used, what percentage of the time:

sysctl dev.cpu |grep cx

Quote from: nbca2 on September 18, 2024, 08:16:35 AM
i have an i5-5200u CPU, this cpu has only speedstep tecnology available.
Without turning ON powerD, the cpu didn't scale its frequency.

Speed Step - you need to use Power D.

Speed Shift, you don't use Power D and rely on the CPU.

For Speed Shift, you need to see the below in dmesg/boot log:

hwpstate_intel0: <Intel Speed Shift> on cpu0

As you state, you need to use Speed Step and PowerD - as this is what the CPU supports:

https://www.intel.com/content/www/us/en/products/sku/85212/intel-core-i55200u-processor-3m-cache-up-to-2-70-ghz/specifications.html

Quote from: iMx on September 17, 2024, 04:51:15 PM
Quote from: Seimus on September 17, 2024, 01:39:10 PM
Simple answers is yes.

If you CPu supports Intel SpeedStep, then disable PowerD
If you want to use PowerD, than disable Intel SpeedStep

Regards,
S.

Almost the 'simple' answer ... but ... 's/SpeedStep/Speed\ Shift/g' ;)

You are right, I mixed those.

SpeedStep is the "old" method - needs PowerD.
Speed Shift is the new method and its available since 6th Gen of Intel CPUs (I think) - doesn't need PowerD.

Thanks for the correction!

Regards,
S.

Networking is love. You may hate it, but in the end, you always come back to it.

OPNSense HW
APU2D2 - deceased
N5105 - i226-V | Patriot 2x8G 3200 DDR4 | L 790 512G - VM HA(SOON)
N100   - i226-V | Crucial 16G  4800 DDR5 | S 980 500G - PROD

I am following this thread to try to enable Speed Shift on my N5105 CPU, as this seems to be the recommended power management method in FreeBSD 13+ instead of Speed Step with PowerD.

According to the Intel spec this model supports both the old Speed Step and the newer Speed Shift:

https://www.intel.com/content/www/us/en/products/sku/212328/intel-celeron-processor-n5105-4m-cache-up-to-2-90-ghz/specifications.html?wapkw=N5105

After disabling PowerD in OPNsense (in System->Settings->Miscellaneous) and rebooting, I am still not seeing that Speed Shift is active in 'dmesg' output.  The system is still using the old Speed Step.


root@firewall:~ # dmesg | grep Speed
usbus0: 5.0Gbps Super Speed USB v3.0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
usbus0: 5.0Gbps Super Speed USB v3.0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
usbus0: 5.0Gbps Super Speed USB v3.0
est0: <Enhanced SpeedStep Frequency Control> on cpu0



root@firewall:~ # sysctl -a | grep hwpstate
debug.hwpstate_pstate_limit: 0
debug.hwpstate_verify: 0
debug.hwpstate_verbose: 0
machdep.hwpstate_pkg_ctrl: 1


root@firewall:~ # sysctl dev.cpufreq.0.freq_driver dev.cpu.0.freq_levels dev.cpu.0.freq
dev.cpufreq.0.freq_driver: est0
dev.cpu.0.freq_levels: 2001/10000 2000/10000 1800/8793 1600/7632 1400/6524 1200/5466 1000/4445 800/3472
dev.cpu.0.freq: 2001


Is there a trick to disabling the 'est' driver and enabling 'hwpstate_intel' properly?