hwpstate_intel epp performance oddities

From: Sean C. Farley <scf_at_FreeBSD.org>
Date: Mon, 15 Jan 2024 17:48:52 UTC
I recently assembled a new system (FreeBSD 14-STABLE) using an i7-14700K 
and am odd results when setting epp levels in the hwpstate driver.  From 
the man page, I expected setting dev.hwpstate_intel.0.epp to change the 
performance level in some manner where 0 is highest and 100 is lowest 
with some in-between values, however, it does not quite obey that.

Upon boot, all dev.hwpstate_intel.N.epp (28 cores) default to 50.  Using 
sysutils/powermon and hearing the volume of the fans, running "stress-ng 
--matrix 0 --timeout 1m --metrics" shows a moderate run.

When changing dev.hwpstate_intel.0.epp to any valid value, the system 
runs at full performance.  Setting it to 0 actually increases the power 
draw from approximate 14W to close to 40W when the system is idle, so I 
avoid that value.  This appears to be the only difference between all 
values from 0 to 100 after setting it once.

However, there is another variable that can affect the system: 
dev.hwpstate_intel.16.epp.  I have tested all the others with zero 
difference.  Setting dev.hwpstate_intel.16.epp to any value lowers the 
performance back to moderate performance level regardless of how 
dev.hwpstate_intel.0.epp is set.

All these results are with machdep.hwpstate_pkg_ctrl at its default of 
1.  Changing that did not seem to help.  Toggling BIOS options to 
prevent the motherboard from "optimizing" the CPUs also did not help.

Can anyone replicate or explain this?

Sean
-- 
scf@FreeBSD.org