Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

framework laptop 11th gen: Improve sleep power efficiency #717

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

obj-obj
Copy link
Contributor

@obj-obj obj-obj commented Sep 10, 2023

Description of changes

Change mem_sleep_default=deep kernel parameter to acpi_osi="!Windows 2020" (fixes a regression in s2idle, making it more power efficient than deep sleep). It's also a good idea to get rid of deep sleep on the 11th gen anyway, as it doesn't function correctly and takes 10-15 seconds to wake back up.

Things done
  • Tested the changes in your own NixOS Configuration
  • Tested the changes end-to-end by using your fork of nixos-hardware and
    importing it via <nixos-hardware> or Flake input

I haven't tested it using my own fork, as I just started using NixOS yesterday, but I've been using this kernel parameter on my Arch Linux install for a while now.

…ameter to `acpi_osi="!Windows 2020"` (fixes a regression in s2idle, making it more power efficient than deep sleep)
@Mic92 Mic92 merged commit 88348cb into NixOS:master Sep 11, 2023
1 check passed
@Pacman99
Copy link

Should the mem deep sleep kernel param be removed from the 12th generation module?

@Mic92
Copy link
Member

Mic92 commented Sep 11, 2023

@Pacman99 maybe. Don't have the hardware but I can ask around for people to test.

picnoir added a commit to picnoir/nixos-hardware that referenced this pull request Sep 11, 2023
Trying to apply NixOS#717 to gen 12 to see if it improves the sleep or idle
power efficiency.

Looking at
https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt,
it seems like this line disables the "Windows 2020" OS vendor. Not
really sure what this means, that's all the doc I could find.

TODO dig that further from the source code.
@picnoir
Copy link
Member

picnoir commented Sep 11, 2023

I'm testing that on my gen12 frawework.

After applying this PR, the powertop/cpupower idle output looks pretty similar to what I had before. That being said, this only test the idle power draw, not the suspend one.

I don't really know how to test the suspend power efficiency. I'll daily drive this for a couple of days and see if I see a massive change.

@obj-obj
Copy link
Contributor Author

obj-obj commented Sep 11, 2023

I'm testing that on my gen12 frawework.

After applying this PR, the powertop/cpupower idle output looks pretty similar to what I had before. That being said, this only test the idle power draw, not the suspend one.

I don't really know how to test the suspend power efficiency. I'll daily drive this for a couple of days and see if I see a massive change.

This PR won't idle affect power draw. To test suspend power efficiency, I usually leave the laptop unplugged overnight (in suspend), writing down the battery % and time before and after. Then I do hours ÷ % lost to get % drain/hour

@picnoir
Copy link
Member

picnoir commented Sep 12, 2023

👍 Will do that for the next two nights (with and without this patch). I'll post the results here.

@Pacman99
Copy link

Well regardless of hardware, rn i think your change affects both laptops profiles because it's in default.nix. but the 12th Gen also has the deep sleep kernel param which could conflict with s2idle. I don't fully know how all this works but I don't think those two should be set at the same time.

@Mic92
Copy link
Member

Mic92 commented Sep 12, 2023

Well regardless of hardware, rn i think your change affects both laptops profiles because it's in default.nix. but the 12th Gen also has the deep sleep kernel param which could conflict with s2idle. I don't fully know how all this works but I don't think those two should be set at the same time.

Currently the 12th Gen profile does not import the other file.

@obj-obj
Copy link
Contributor Author

obj-obj commented Sep 12, 2023

👍 Will do that for the next two nights (with and without this patch). I'll post the results here.

This PR only affects 11th gen, so you'll have to enter the kernel parameters manually. You should test deep sleep one night and s2idle with these two kernel parameters the other night, to see which one is more efficient

@picnoir
Copy link
Member

picnoir commented Sep 14, 2023

In the lack of a better test, here's what I got after suspending the laptop with and without the windows 2020 interface disabled:

Windows 2020 disabled: 21:30 -> 8h05: 100% -> 82%
Without patch : 22:20 -> 9:20: 98% -> 76% 

Looking at this dubious test, it seems like the 12th gen implements the Windows 2020 operating system interface just fine. Or at least, disabling it doesn't significantly improves the sleep power efficiency.

I don't think we need to apply this patch to the 12th gen profile.


Edit: forgot to note that I tested this with the unpatched HDMI adapter attached to the laptop.

Dongles connected during the test:

  • USB-C
  • USB-A
  • Ethernet gen 1
  • HDMI gen 1

@obj-obj
Copy link
Contributor Author

obj-obj commented Sep 14, 2023

In the lack of a better test, here's what I got after suspending the laptop with and without the windows 2020 interface disabled:

Windows 2020 disabled: 21:30 -> 8h05: 100% -> 82%
Without patch : 22:20 -> 9:20: 98% -> 76% 

Looking at this dubious test, it seems like the 12th gen implements the Windows 2020 operating system interface just fine. Or at least, disabling it doesn't significantly improves the sleep power efficiency.

I don't think we need to apply this patch to the 12th gen profile.

Edit: forgot to note that I tested this with the unpatched HDMI adapter attached to the laptop.

Dongles connected during the test:

* USB-C

* USB-A

* Ethernet gen 1

* HDMI gen 1

I think it's just an 11th gen bug, as without Windows 2020 kernel parameter the power button and keyboard backlight stay on during s2idle

@picnoir
Copy link
Member

picnoir commented Sep 14, 2023

On 12th gen, the power button turns off and pulsates, keyboard backlight turns off when in s2idle w/ ACPI windows 2020 interface enabled.

@obj-obj
Copy link
Contributor Author

obj-obj commented Sep 14, 2023

On 12th gen, the power button turns off and pulsates, keyboard backlight turns off when in s2idle w/ ACPI windows 2020 interface enabled.

Does it still do so without it enabled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants