Hacker News new | past | comments | ask | show | jobs | submit login
Deleting a Few LOC Can Yield “Significant” Power Savings on Some Linux Systems (phoronix.com)
72 points by Memosyne 15 days ago | hide | past | web | favorite | 30 comments



It's increasingly difficult to do power saving in modern laptops with highly integrated SoC - a single component can prevent the entire system from entering a deeper power saving state. In the old days, CPU and graphics were basically everything, but there can be an endless number of traps today, a SATA driver, an audio driver, or a PCI bridge in this case, not to mention that many subsystems are poorly documented. And even if the potential of power saving in a device driver is identified, it's often plagued with mysterious bugs (the Window driver may include nonstandard workarounds).

Only Intel knows everything, I guess even Microsoft doesn't (try running Windows without all the Intel chipset drivers installed...). If you take a modern laptop and put Linux on it, it's possible that you'll only able to get 50% of the battery life. And there's nothing you can do about it.


Even Microsoft's own hardware can't get it right. I have a Surface Pro 3, and it will not stay in sleep mode. The screen frequently turns on for no reason at all, even if the keyboard cover is closed. I've taken to putting it in hibernate mode whenever I know I won't be using it for more than a few minutes, otherwise I'll come back to a dead battery.

But even hibernation doesn't always work. My custom-built desktop PC frequently wakes itself out of hibernation in the middle of the night. I don't even know how that's possible, because I thought hibernation was "off, with RAM saved to storage". Which is just wonderful when I'm sleeping in the same room.


> But even hibernation doesn't always work. My custom-built desktop PC frequently wakes itself out of hibernation in the middle of the night. I don't even know how that's possible, because I thought hibernation was "off, with RAM saved to storage". Which is just wonderful when I'm sleeping in the same room.

This is generally using ACPI 'wake timers', which allow the RTC on the motherboard to wake up the system at a particular time (which I think is a useful feature, but only if explicitly requested by a user). Windows is particularly bad at this, since scheduled events are allowed to use this by default to wake up the PC when they are supposed to fire (and 'UpdateOrchastrator' has one which fires in the middle of the night). There's a decent bit of info on how to identify why this is happening and stop it here:

https://superuser.com/questions/1020768/laptop-wakes-up-from...


For me it's only my cat walking over the keyboard or mouse.

The third allowed option (Linux) is wake on lan, which is only triggered through my laptop. I automate WOL events sometimes over cronjobs, when the big machine needs to do some work overnight for some minutes, but very rarely, because it's too loud. But I do those wake up, sleep cycles occasionally automatically when the machine processes big events like the Berlinale, Cannes or Sundance Film Festivals.


Oh god thanks. This issue plagued me for the last 5 years, to the point I joked my desktop was possessed.


I’ve had this same issue with a different laptop. On my machine, any change in WiFi network or Bluetooth device availability would cause the laptop to spin up, prevent sleep, and drain battery. One trick is to turn off connected standby and switch to “disconnected modern standby”. That disables the WiFi and Bluetooth chips during standby, which should solve your issues. The only downside I’m aware of is that the machine will take a few seconds upon awakening to reconnect to WiFi and Bluetooth peripherals.

Alternatively, you can disable connected/modern standby altogether and revert to traditional S3 sleep. You lose that instant-on tablet effect, but it should fix the excess battery drain too.


I have that happen with hibernated desktops, where they would wake up randomly to do something then shut down again.

On some forums I read that people suspect its the virus scanner or some other scheduled task that is doing this. If someone knows why this is actually happening then that knowledge would be appreciated.


SP3 was their first experiment with "Connected Standby" and it showed. I had the same experience with sleep, as well as other problems like the wifi being unable to hold a connection. I wonder if newer models have gotten any better.


There are power mode settings in windows that you might be able to configure to alleviate some of the grief. I can't say how much of it will actually work, but if you haven't gone down that rabbit hole it's worth a try.


Double checked WOL and/or wireless device wakeup settings?


AMD is now doing new power saving system basically from scratch. I really hope it will be linux friendly.


I've looked at code like that. It's amazing the kinds of rigamarole you have to do to prevent something waking up just because some a API call (like a status call) should be turned away instead of poking the chip.


My Dell XPS had less than 30% with latest Ubuntu (after powertop) :\


I'd say powertop is almost useless today. It was designed in an era when individual devices were loosely-coupled, you could simply identify the power hogs one-by-one and fix them. Today, power management is tightly-coupled with many subtle interactions and dynamic behavior. The most-common failure mode today: something prevents the SoC from entering a deeper sleep mode - you can't fix it with powertop, better to start reverse engineering firmware and Windows drivers... :(


I'd say powertop can be worse than useless today. Its suggestions are too aggressive, it suggests min_power which can cause data corruption, instead of med_power_with_dipm which is the recommended value nowadays.


We also use Dell XPS laptops with Ubuntu. We get about an hour of battery life and no hibernate or suspend.

It's made me consider installing Windows and developing inside VirtualBox.


Check `/sys/power/men_sleep`. For me its default setting was the source of poor battery life during suspend.


If you don’t need a dm, I recommend Windows Subsystem for Linux (WSL). It’s been a joy to use so far. GUI applications can run via X11 server (I recommend VcXsrv).


I actually did this for awhile. It was kinda nice from a distraction point of view, as the VM didnt have my bookmarks or other programs.


Did you check `/sys/power/men_sleep`? it was the source of this problem for me on XPS.


To save you a click: There was code that disabled ASPM[1] when you have a PCI bridge connected downstream of PCIe. That code is gone now.

https://en.wikipedia.org/wiki/Active_State_Power_Management


Reminds me of the Raspberry pi 4 update, where enabling ASPM shaved something like 10% off the idle power consumption:

https://www.cnx-software.com/2019/06/29/new-raspberry-pi-4-v...


I see this as a flaw of Linux development model, and how code from hardware vendors gets a free go.

When Linux was still small, each and every major hardware platform was worked on until mirror polish, and it worked "well."

Now, the only criteria, when Linux mainly relies on hardware maker programmers to do their job, is that the code compiles and works.

Without much pressure from users, there is nobody to push against "barely works" driver code.


I don't think this is a specific PCI driver but core to how the PCI subsystem works.


“Old patch disabling Active State Power Management deleted, significant energy savings expected on some ancient hardware.”


So what's the cumulative amount of power wasted?


Depends on the system. On newer Intel machines, it will prevent the SoC from going into lower power states than PC2. On my laptop, that means idling at 5 watts instead of 2ish watts.

That said, I don't think any laptop has a PCIe to PCI bridge. This should only affect some desktops and servers.


Clickbait title


Agree. It would be better if it gave the maximum amount of technical detail possible given the space constraint.


Not really.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: