Please, improve the S0ix experience under Linux

I have started looking into S0ix again today.

I have filled a bug on kernel.org:

https://bugzilla.kernel.org/show_bug.cgi?id=217603

@mariolimonciello

Yes, I believe what makes sense here would be systemd having some kind of database storing the stats about suspend, since it already deals with session and power anyway.
Also, if at some future point Linux ends up supporting waking from S0ix for doing some tasks and then going back to sleep, that would likely also end up being managed by systemd.

This is likely LVFS and being uploaded by fwupd.

I already noticed that it can send anonymized hardware data as well as anonymized HSI (basically the security features status from firmware + OS). So, it could very well have suspend data as well.
Since the LVFS already ships the firmware drivers from some OEMs, it should be possible to contact them in case it’s their firmware to blame for the suspend failures.

Hmm, @rhughes what do you think? If we managed to get systemd to capture suspend data into a database would it make sense to let fwupd access that data and report it to LVFS?

I don’t know; it’s feature creep and we have to justify it using the existing LVFS privacy policy. I guess what we could do is collect more details in the existing HSI sleep attribute and then upload that as part of the “fwupdmgr security” scan on the logic we want to get people to use s2idle when possible.

A few other thoughts about using LVFS for this.

  1. Only the command line client (fwupdmgr) currently uploads anonymous data to LVFS. Even if we ended up using LVFS for this purpose, I suspect that removes a very large amount of data. It’s tangential to this thread’s problem, but I think the three graphical GNOME clients (gnome-software, gnome-control-center and gnome-firmware) should grow support for uploading data too.
  2. Uploads only happen when actions happen to make the data change. For example if someone ran fwupdmgr update and updated firmware or fwupdmgr security and something changed from last time they’ll be prompted to upload data. Whereas suspend cycles happen constantly. How frequent should suspend data be uploaded?

IMO:
Step 1 is figure out which telemetry data is useful to be collected with each sleep cycle.
Step 2 is get systemd to start collecting this.
Step 3 is get a way to present this data to a user (GNOME?)
Step 4 is get a way to get this data uploaded to a consumable web service.

Another option for collecting such data is Fedora’s in-the-works telemetry.

1 Like

So another thing you may wish to check – may be specific to my laptop.
On Linux & Windows, while suspended, if I jolt vigourously for 3 seconds my laptop, it exits S0idle’s “mem” suspend (on Linux appears to be easier to trigger).

Using echo freeze > /sys/power/state makes this harder to happen, but still happens.

YMMV

Laptop: Thinkpad L13 Yoga (2-in-1/convertible)

Is there anything in the logs that gives the reason for the wake?
Any chance the lid opened just a tiny bit and triggered an lid open event?

Pretty certain I did not. I usually shake it holding the whole laptop with the two hands.

If you can’t reproduce it please do ignore. It may be just a model or machine quirk.

If anyone can reproduce it: maybe some forgotten sensor for harddisk parking is doing stuff. Nothing shows up in the logs though (journalctl).

Today I finally gave up on S0ix on my system, after keeping it enabled for a while.

Basically, more often than not, a failed suspend can happen with S0ix sleep enabled.
Sometimes this won’t cause problems, other times the session will break in subtle ways or in catastrophic ways (likely something in logind broke) such as: flatpaks will refuse to launch, some of the options in GNOME power menu will disappear and I won’t be able to shutdown neither via GNOME nor via systemctl.

It seems there’s no point in keeping using something as broken as that on my system unless there are better tools to report these problems so it can be properly fixed.

In anyway, I reverted to using mem_sleep_default=deep for S3 sleep and I hope to not have problems anymore. Just as a note, I’m using the very latest BIOS firmware available.

1 Like

Can I ask, earnestly, what is the best-case energy consumption that S0ix can achieve in the near future?

I just bought a ThinkPad, my first new laptop in several years. Ironically for me, suspend was one of the things I was most looking forward to (my old laptop was physically damaged and suspend was not working properly). Now I find myself sorely disappointed at the battery drain, but let’s say that’s improved. What’s the ceiling for that in the short-term?

Hi Mauricio,

Which ThinkPad and what numbers are you getting? (and BIOS/EC version is useful once I know which platform it is).

In my experience - expect to see between 0.3 and 0.6W during sleep. If you’re seeing anything significantly above that let me know and we can debug.

Mark

FWIW, I enabled the modern suspend via fwupd on this Ryzen 7 laptop and your script mostly works now, but complains about Kernel lockdown being engaged and it appears to be missing some headers for the ACPI BIOS checks. Otherwise, the suspend itself triggered by your script worked for me.

If you think there are some problems with the script, please file a bug at AMD DRM (gitlab.freedesktop.org) with the details. I’m open to any adjustments if it makes it more accessible.

My primary point is that it appears to more or less be working on this AMD system. (I say more or less because it’s working fine AFAICT, but the script gives an ACPI Error stack trace at the bottom around missing symbols.)

Ref.

In my case, I hadn’t enabled it with fwupd yet.

Hi Mark,

Thank you for your kind answer. TL;DR is my issue may have gone away.

Just got a Carbon X1 (Gen 11, BIOS N3XET42W 1.17); I put it to sleep for the first time while traveling and came back to see ~20% battery drain (in about 12h, so ~1W/h). Now, reading more carefully maybe that’s not crazy high (certainly there’s reports of more severe drain) but it was high enough that I looked it up and ended here.

Now, I’ve tried some troubleshooting (e.g. I found a report from one user blaming WWAN; I didn’t get my laptop with a broadband card but I turned it off anyway) and have tested it a few more times. I’m consistently getting around 0.25W/h on sleep, which is on the low end of what you’re telling me to expect. I’m not sure how to test it more thoroughly, but the current performance seems reasonable.

Thanks again for the reply and apologies if I came off poorly. My first experience was disconcerting.

Hi!

On my case ( ThinkPad L13 Yoga Gen 2 / 20VKCTO1WW ) the issues with modern standby were due to the laptop waking up fully and not suspending afterwards.

Through a Ubuntu Mate post and trial and error, I decided to disable all wakeup sources except for keyboard / USB (XHCI) and power button (SLPB).

On Fedora 38, I’ve a good sleep status with the following script:

$ cat /etc/systemd/system/acpi-wake.service

[Unit]
Description=ACPI Wake Service

[Service]
Type=oneshot
ExecStart=/bin/sh -c "for i in $(cat /proc/acpi/wakeup|grep enabled|awk '{print $1}'|xargs); do case $i in SLPB|XHCI);; *) echo $i|tee /proc/acpi/wakeup;; esac; done"

[Install]
WantedBy=multi-user.target

and

$ sudo systemctl enable --now acpi-wake.service

This way, disabling almost everything including the LID (which I’m thinking it is somehow the source of the problem), sleep issues never happen.

Battery should last 2 or 3 days this way (not a full weekend probably, but overnight will).



NOTE: unrelated, but on Fedora 38 there was a bug where the OS ignored the lid close. Seems to be fixed on Fedora 39 (again, waking up on lid open won’t work since I disabled it with the script above but closing the lid now suspends the system).