|
|
Log in / Subscribe / Register

Garrett: Reducing power consumption on Haswell and Broadwell systems

Matthew Garrett looked into why Linux systems consume too much power on recent Intel chipsets and wrote up his results — a reduction of idle power use on his laptop from 8.5W to 5W. "This trend is likely to continue. As systems become more integrated we're going to have to pay more attention to the interdependencies in order to obtain the best possible power consumption, and that means that distribution vendors are going to have to spend some time figuring out what these dependencies are and what the appropriate default policy is for their users."

to post comments

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 5:02 UTC (Tue) by salimma (subscriber, #34460) [Link] (29 responses)

As commented on mjg's article, it's rather ... shocking ... that no developer is being paid to perform this task. Especially considering Dell partners with Canonical to provide support for their XPS 13 and M3800 laptops...

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 7:15 UTC (Tue) by rvfh (guest, #31018) [Link] (28 responses)

I used to foolishly assumed Intel were working on this... disappointed!

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 7:24 UTC (Tue) by bmillemathias (guest, #54343) [Link] (2 responses)

Yep, same raisoning from my self, I dumbly assumed that Intel was working on this kind of feature.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 15:06 UTC (Tue) by ledow (guest, #11753) [Link] (1 responses)

I can just imagine the furore.

"Intel turn on buggy sata code, losing user data, with official kernel patch".

Intel are just the first step of the chain. The people using their chipsets can presumably play all kinds of games with them and take them out of spec and cause situations where (as documented) sleep modes can lose data in some corner cases.

That they don't replicate workingcode from another platform direct into Linux is probably just prudence on their part - testing that level of interaction, especially in data-critical situations - is not something that you'll get a lot of volunteers for in any case.

It's not like Intel have deliberately hindered matters - they just haven't applied identical settings between Windows and Linux when it comes to their chipsets. That's probably a good thing. "What's this patch for?", "Oh it just brings in all the same settings as we plug in on Windows"... followed by a mailing list flame-war that performance has plummeted, programmed expectations aren't met, etc.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 29, 2015 18:10 UTC (Wed) by flussence (guest, #85566) [Link]

> "Intel turn on buggy sata code, losing user data, with official kernel patch".

I've inflicted exactly that on myself on one occasion: I own one of the older Asus netbooks (which are well known among enthusiasts for having frequent BIOS updates of questionable quality). It turns out the chipset on this one is artificially locked to IDE mode, probably so they could sell it with Windows XP, but I found a third-party modded BIOS that enabled real AHCI on it. It worked great - until I suspended it and it woke up with no SATA on the PCI bus...

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 7:30 UTC (Tue) by mjg59 (subscriber, #23239) [Link] (16 responses)

Intel do most of the implementation, but not the integration. From their perspective that's a downstream job.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 8:45 UTC (Tue) by hadess (subscriber, #24252) [Link] (13 responses)

That's how they lob some features over the fence and never work on any integration, or even upstream merging. Like compressed DSP work[1], or CSI/ISP cameras[2].

[1]: https://code.google.com/p/compressed-audio-dsp-driver/
[2]: http://sourceforge.net/projects/e3845mipi/files/

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 9:08 UTC (Tue) by kbabioch (guest, #92872) [Link] (1 responses)

I guess that many people weren't even aware of the current situation, so hopefully this will bring some attention to the issue. Power saving is VERY (!) important, and after having read Garrett's article I'm really shocked that so little effort is made in this regard.

Best regards,
Karol Babioch

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 11:38 UTC (Thu) by ernest (guest, #2355) [Link]

People should never assume that things magically happen by themselves.

Don't be shocked that this effort was not done before!
Be happy that is this effort has started!

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 9:46 UTC (Tue) by zyga (subscriber, #81533) [Link] (6 responses)

I love the 2.9MB+ patches that get dumped to sourceforge. That's the spirit of open source, right? ;-)

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 12:13 UTC (Tue) by torquay (guest, #92428) [Link] (4 responses)

As opposed to having no patches? Much of open source work is volunteer driven, and stuff that's corporate driven is really giftware. In either case you can't complain about it.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 12:54 UTC (Tue) by zyga (subscriber, #81533) [Link] (3 responses)

I kind of agree and not at the same time.

It's pretty dumb to expect anyone to merge in a 3MB patch. This patch is a classic code drop (maybe someone applies it and that's easier for them to make it public).

At the same time this is Intel, it's not like we need to hand-hold them to show how to work in the open. They already know and they have plenty of people that can educate any internal developers that don't. If intel is throwing money at the development and then just goes 90% there why do they do it? Who benefits from a lump of code that's not used in the wild?

Sure, you cannot complain. But you can educate and I think it's important to point out that free software has a process. If you don't understand the process and don't follow the process your contribution is as useful as a historic source that shows what not to do if want to have influence and drive changes. I'm only complaining this way because I think it's quite surprising from a multi-billion dollar company with a track record of working with the "community" and successfully contributions to the kernel.

If those patches are just dead and all the code is merged then I'm just sorry for making that comment. Though personally I'd remove them. Code needs gardening.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 14:11 UTC (Tue) by Wol (subscriber, #4433) [Link] (1 responses)

Look at it from a commercial developer's point of view. Much as I would like to get stuff merged, if I'm under pressure to move on to the next project, it's much better to dump the code "over the wall" as an example of something that actually works, than to leave it to another developer to reverse-engineer my work.

At the end of the day, does the employer think it's worth the effort to get the code merged? If not, do the linux devs think it's worth the effort pulling the code dump apart? Legal aside, the actual code dump itself should cost near enough nothing.

Cheers,
Wol

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 29, 2015 9:18 UTC (Wed) by mjthayer (guest, #39183) [Link]

> At the end of the day, does the employer think it's worth the effort to get the code merged? If not, do the linux devs think it's worth the effort pulling the code dump apart?

I wonder whether anyone has ever looked at game theory and the process of getting a particular piece of open source code written. Often there are many people who have an interest in it getting done, but the actual process remains painful. This case seems to be a happy ending, but there are so many examples of bugs on bug trackers with tens or even hundreds of people affected, but no one for whom it is quite painful enough to justify the effort of doing it themselves. (Successful bounties seem to be the exception, not the rule.)

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 29, 2015 6:49 UTC (Wed) by marcH (subscriber, #57642) [Link]

> They already know and they have plenty of people that can educate any internal developers that don't. If intel is throwing money at the development and then just goes 90% there why do they do it?

There can be many different business reasons why things are not always done the right way and why not every single project is always a resounding success at all levels and from all perspectives and terms. Wol already gave a few; I'm sure you can imagine a million others with a limited effort.

> Who benefits from a lump of code that's not used in the wild?

Dunno, maybe someone who prefers to do 10% of the work rather than 100%?

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 29, 2015 13:06 UTC (Wed) by javispedro (guest, #83660) [Link]

This is one of the reasons I generally tend to prefer hardware companies that give out (properly-written) documentation, rather than half-assed Linux-specific code dumps (even if GPL). Obviously, both would be better, but that almost never happens...

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 29, 2015 13:07 UTC (Wed) by tiwai (subscriber, #39450) [Link] (2 responses)

The compressed audio has been already upstreamed in 2011.

It's mostly for mobile chipsets, thus it wasn't useful for PCs. Now since Broadwell, the situation seems changing, though.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 29, 2015 13:46 UTC (Wed) by hadess (subscriber, #24252) [Link] (1 responses)

> The compressed audio has been already upstreamed in 2011.

Where does that code live/how do we use it? I couldn't find any references to it anywhere.

> It's mostly for mobile chipsets, thus it wasn't useful for PCs. Now since Broadwell, the situation seems changing, though.

I believe Baytrail already had support for that, and it's used in tablets and convertible laptops.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 14:51 UTC (Thu) by broonie (subscriber, #7078) [Link]

Compressed audio is in sound/core/compress_offload.c, there's the tinycompress library for userspace (http://git.alsa-project.org/?p=tinycompress.git;a=summary). If you've got a system with an appropriate DSP and drivers you need to write an application using tinycompress (I don't know of any), or if you've got an Android phone with such a setup it's probably using i already.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 14:48 UTC (Thu) by broonie (subscriber, #7078) [Link]

They have been engaged on the compressed audio stuff - the framework has been in mainline since v3.10 and they've got drivers in now too, they've also worked on userspace bis for it too (that's mainly targeted at Android since the feature mainly has value on phones). Definitely more than an throw it over the wall job.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 6:13 UTC (Thu) by nhippi (subscriber, #34640) [Link] (1 responses)

There a bunch of haswell/broadwell computers sold with ubuntu preloaded from Dell at least. It would therefor fall down to be the responsibility of the canonical OEM team to do at least some of the integration. I mean it shouldn't be that Dell XPS 13 is shipped with ubuntu but only gets decent power management after Mr. Garret gets one in his hands...

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted May 3, 2015 10:59 UTC (Sun) by tjaalton (subscriber, #54012) [Link]

Realize that the machines that now ship with Broadwell were certified last summer, with backported gfx driver code that was/is still somewhat fragile (3.15+ on top of 3.13). Meanwhile upstream kernels have seen ~5 releases to stabilize and enable features. But PSR still isn't on by default as pointed out in the article.

A set of PSR related bugfixes for BDW et al got in 4.1 though, so perhaps it'll be working by the time 14.04.4 with backport kernel from 15.10 is out early next year ;)

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 13:18 UTC (Tue) by arjan (subscriber, #36785) [Link] (7 responses)

Well Intel wrote the code in the first place many years ago.
Intel wrote a tool (PowerTOP) for use by linux distros to verify their distro does the right things, and said tool catches this.
Intels own distros enable this.

So Intel is not completely to blame here ;-)

(and yes I work for Intel)

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 13:44 UTC (Tue) by imitev (guest, #60045) [Link] (6 responses)

>> said tool catches this.

I remember PowerTop suggesting stuff like "enable sata power link management" but IIRC it was only a matter of setting some value in /sys/..., not something as advanced as suggesting to use intel's firmware's defaults (which based on the comments on mjg's post, requires patching the kernel).

Do you mean that newer versions of PowerTop are able to (re)set the device's settings/firmware to Intel's default values ?

(By the way thanks for writing PowerTop !)

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 14:12 UTC (Tue) by arjan (subscriber, #36785) [Link] (5 responses)

the patch in the kernel here is about not letting the kernel go backwards afaics, e.g. if the firmware turns this feature on, leave it on.

powertop suggests you to turn it on if its off....

there have been suggestions of bad behavior, and the only case I've seen myself was with a dodgy sata cable, which triggered the driver to then go into error handling. One of the options we COULD do, is to turn off all the ALPM once you hit such error handling case.

Now, way back when we wrote the feature, the SATA maintainers refused to turn it on because it was policy, and in theory someone could build a chipset that wouldn't have hotplug work with this (since hotplugging internal laptop drives is an important usecase).
oh well.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 16:44 UTC (Tue) by mjg59 (subscriber, #23239) [Link] (4 responses)

Powertop sets min_power, which enables ALPE. This *does* break a range of devices (just search for "min_power" ata error), which is obviously a problem when it comes to whether distributions can enable it by default. The medium_power policy should be fine in that respect, but up until now it only enabled PARTIAL rather than SLUMBER and would disable devslp, so it was leaving some savings on the table.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 20:04 UTC (Tue) by arjan (subscriber, #36785) [Link] (1 responses)

one of the options is to automatically back off on such ata error...

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 20:11 UTC (Tue) by mjg59 (subscriber, #23239) [Link]

That doesn't help if the drive is no longer talking to you, and even if it is we may already have corrupted data at that point. It's a poorly tested configuration, and so it's a bad default.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 20:22 UTC (Tue) by arjan (subscriber, #36785) [Link] (1 responses)

also way back, min was supposed to be slumber and medium was mapped to partial.
I guess this got more fuzzy over time...

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 28, 2015 20:24 UTC (Tue) by mjg59 (subscriber, #23239) [Link]

Yes, that's the current mapping. Neither of these corresponds to the IRST configuration, so we have the choice between excessively conservative settings or excessively aggressive settings.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 29, 2015 9:18 UTC (Wed) by gebi (guest, #59940) [Link] (2 responses)

Should this also affect "older" intel systems?
On my x200s (core2duo) the battery time get from 9h (kernel 3.10) to 6h with kernel 3.16 (current debian).

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 29, 2015 9:54 UTC (Wed) by tao (subscriber, #17563) [Link]

Should be possible to test if you tweak your system with powertop and compare before/after.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 29, 2015 19:55 UTC (Wed) by alvieboy (guest, #51617) [Link]

I have experienced higher power consumption in some version after 3.2 kernel. Not sure which version caused that, but at least issue is present in 3.12 and newer. Since I'm using stock Debian kernels, I was unable to try other versions.

What I suspect is that higher heat from CPU is causing my fans to stay on most of the time. It's rare to have my CPU (a Core-i7) below 51-52C with these later kernels, whilst in 3.2 it was often <48C, and fan mostly off all the time.

Unfortunately I don't have time to bisect this. Perhaps someone has some idea (I once thought it may be related to pmodes, but I think that's not the culprit).

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 7:27 UTC (Thu) by aleXXX (subscriber, #2742) [Link] (11 responses)

This only matters when the system is idle, right ?
<rant>
with firefox running for several days, my system is never idle, at some point firefox starts to hog one CPU more or less completely, the cooling fan starts, etc.
There's a bug in the firefox bug tracker for that, but the developers are asking for ways how to reproduce it. It happens always here, after several days and many tabs open. I assume this is the biggest cause of power consumption of Linux machines these days.
</rant>

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 11:02 UTC (Thu) by tao (subscriber, #17563) [Link] (7 responses)

With or without flashplayer installed? In my experience this behaviour stopped once I uninstalled flashplayer.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 12:47 UTC (Thu) by aleXXX (subscriber, #2742) [Link] (4 responses)

With flashplayer. And I want to keep it installed.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 15:05 UTC (Thu) by mstone_ (subscriber, #66309) [Link]

Then you're doomed to a life of pain.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 17:30 UTC (Thu) by pabs (subscriber, #43278) [Link]

What are you using flash player for?

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 20:06 UTC (Thu) by sjj (guest, #2020) [Link]

This happens to me without flash and I don't use many FF extensions either.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 21:29 UTC (Thu) by mathstuf (subscriber, #69389) [Link]

youtube-dl handles the majority of the video use cases of Flash.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 16:17 UTC (Thu) by nye (guest, #51576) [Link]

Doesn't Firefox run flashplayer out-of-process? I would have expected that would make it easy to determine if it's flash that's at fault.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted Apr 30, 2015 18:14 UTC (Thu) by dlang (guest, #313) [Link]

for me it happens without using flash. I'm not sure offhand if I have it installed, but if I do, it's behind flashblock that requires me to explicitly click on the flash item to run it.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted May 2, 2015 2:29 UTC (Sat) by jzbiciak (guest, #5246) [Link] (1 responses)

I've noticed that Firefox's background GC (or something related to its current heap size) continues to inch up in CPU utilization. Eventually, it can reduce responsiveness, especially in text boxes. I can usually knock it down by going to about:memory and doing a little dance:

  • Click "Minimize memory usage." This does help a little.
  • Click "Measure", and then scan for the pages using the most memory. I then either close those tabs, or if I really want to keep them around, re-open the page in a new tab and kill the old one. (Likely, it's a leak in the JavaScript on that page that Firefox can't fix. Reachable data that will never be re-examined, but can't be GC'd.)
  • Click "Minimize memory usage" once more, after auditing the tabs.

After that, Firefox becomes usable for awhile again.

There's a big but though: If I do something memory intensive outside of Firefox (such as a make -j, or running GIMP on a ginormous file), Firefox goes into a garbage collection meltdown. At least, I assume that's what it's doing. It will sit there, pegging the CPU and thrashing through its working set. Maybe it will eventually die down and return to normal, but most of the time I don't bother waiting.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted May 5, 2015 7:06 UTC (Tue) by jospoortvliet (guest, #33164) [Link]

Thanks a bunch for these, by the time FFirefox has been running for a few days here it just becomes unbearable.

Garrett: Reducing power consumption on Haswell and Broadwell systems

Posted May 7, 2015 15:56 UTC (Thu) by ssam (guest, #46587) [Link]

I think its bits of javascript and animation in tabs. noscript helps a lot, but once you white list a few things it can be a problem.

It would be nice if firefox would freeze unfocused tabs, or severely limit how much CPU time the could have. If if it would show you how much CPU time is being used per tab, so you could avoid (or report) heavy sites.


Copyright © 2015, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds