Bug 206961 - powerd broken on SMP
Summary: powerd broken on SMP
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.2-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-05 23:42 UTC by Duraid Madina
Modified: 2016-07-08 11:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duraid Madina 2016-02-05 23:42:16 UTC
bug 125141 is marked FIXED, but I see it.

background:

2-way Xeon E5-2690 system

/etc/rc.conf: 

powerd_enable="YES"
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"


Consider these three cases:

1) Load no CPUs

powerd works here. All cores run at reduced frequencies and enter deep sleep states.

2) Load all CPUs

powerd works here. All cores run at high frequency and spend essentially all time in C0. (Actually, after a couple of minutes the system (hardware) alarm goes off because the CPUs are overheating; FreeBSD ignores that I guess, but let's worry about that some other day...)

3) Load one CPU

Expected:

One CPU runs at maximum ("boost") frequency and spends ~100% time in C0. (hardware-specific technicality: the core's "pair" spends 100% time in C1.) Other cores run at minimum frequency in deep(er) sleep.

Observed:

All CPUs stay in sleep states, though all of them average frequencies >30% above minimum. One core will average around 2% in C0 and will run at a higher (though not maximum) frequency.



It looks like there is some serious brokenness in SMP. #125141 makes it seem like powerd can be expected to do the right thing, but I seem to get the worst of both worlds: increased power consumption as all cores stay out of deep sleep and run at elevated frequencies, and decreased performance as no one core stays in C0 running and peak frequency.

Perhaps interestingly, this problem can be exacerbated by setting dev.cpu.<pick_one>.cx_lowest=C1 . (Which is necessary on my system to avoid USB keyboard stuttering, but that's another issue...) It's not clear to me, then, that this is "the same" as #125141. Maybe it is, or maybe there remains something fundamentally wrong with powerd in (variable frequency, variable sleep) SMP scenarios.
Comment 1 Duraid Madina 2016-02-05 23:45:47 UTC
I should also have mentioned that there is something of a workaround, too: restricting single-thread jobs to a single core with cpuset makes powerd do the right thing.
Comment 2 Ivan Klymenko 2016-07-08 11:04:40 UTC
Try to use it sysutils/powerdxx