|
| 1 | ++++ |
| 2 | +title = "S2idle and the Nature of Laptops" |
| 3 | +date = '2025-07-18T01:20:18+02:00' |
| 4 | +author = "Ariadna" |
| 5 | +tags = ["linux", "hardware", "my stories", "history"] |
| 6 | +keywords = ["s0ix", "acpi", "linux", "hardware", "sleep states"] |
| 7 | ++++ |
| 8 | + |
| 9 | +You tell your laptop to "suspend to RAM." Are you really sure that's what your |
| 10 | +system just did? I was utterly surprised, when I purchased my current laptop (a |
| 11 | +model of the HP 15 series that was released in 2024), that _things had changed_ |
| 12 | +since the last laptop I had bought back in 2013.[^1] Power management has |
| 13 | +changed, and things smell a lot of "mobile convergence" these days. |
| 14 | + |
| 15 | +It's funny because using Linux shields you from one day discovering that your |
| 16 | +10 years old PC doesn't work anymore. Linux supports old systems by philosophy, |
| 17 | +where MacOS and Windows are picky about how old your laptop, especially laptops, |
| 18 | +is. Microsoft is more lenient on the software side of things, such that only |
| 19 | +until recently you still could run old Win16 software on modern Windows |
| 20 | +versions. When it comes to hardware, though, good luck if your system doesn't |
| 21 | +come with UEFI and "certified" hardware, and good luck in a couple of years. |
| 22 | + |
| 23 | +So, while my old ASUS X55C had the power management features of a laptop from |
| 24 | +2013, this HP 15 showed me that... even "sleep" had changed. I'm not sure how I |
| 25 | +noticed that something was different; I guess it was the fact that waking up |
| 26 | +from "sleep" was super fast on this new laptop, with almost no time delay when |
| 27 | +it came to reconnect to WiFi or Bluetooth. I immediately knew where to look at |
| 28 | +and I was presented with something I had never met before: |
| 29 | + |
| 30 | +```bash |
| 31 | +$ cat /sys/power/mem_sleep |
| 32 | +[s2idle] |
| 33 | +``` |
| 34 | + |
| 35 | +In the old days of regular ACPI S3 sleep, you would've seen a couple of |
| 36 | +different options, like ``shallow`` and ``deep``, the latter being what we would |
| 37 | +usually call _Suspend to RAM_ or "actual" S3. The ``shallow`` setting is for |
| 38 | +_Suspend to standby._ For more details about what all of this means, there's |
| 39 | +[documentation available][sleep-docs] from the Linux kernel itself explaining |
| 40 | +everything in detail. |
| 41 | + |
| 42 | +The way the sysfs files for power management work is interesting. Files under |
| 43 | +``/sys/power`` only show power states that your system _supports._ That |
| 44 | +information, obviously, comes from the firmware itself. Therefore, if I tried |
| 45 | +something like the following on **my** computer to put it to sleep into an |
| 46 | +actual, traditional S3 state that powers everything off except for the RAM... |
| 47 | + |
| 48 | +```bash |
| 49 | +# echo 'deep' > /sys/power/mem_sleep |
| 50 | +bash: echo: write error: Invalid argument |
| 51 | +``` |
| 52 | + |
| 53 | +So, my new laptop only supports a sleep state that is implemented somewhere in |
| 54 | +the motherboard (the UEFI?). The important bit about S0ix/s2idle states is that |
| 55 | +there are different levels, beyond the one that is equivalent to _suspend to |
| 56 | +RAM;_ you actually may enter a S0i1 state just by having your laptop sitting |
| 57 | +idle with the screen off: some parts of the motherboard may enter a low-power |
| 58 | +state, some not... Deeper S0ix states will power down more parts of the hardware |
| 59 | +or make them enter deeper low-power states. Of course, this requires the Linux |
| 60 | +kernel to support requesting these states to the firmware. |
| 61 | + |
| 62 | +If this sounds oddly familiar to how smartphones manage power, bingo. Although |
| 63 | +smartphones, as far as I know do not follow ACPI specifications, the behavior is |
| 64 | +practically the same. When you leave your smartphone sitting idle, it selective |
| 65 | +powers down components to save energy. On Android, this is called |
| 66 | +[Doze.][android-doze] |
| 67 | + |
| 68 | +You know what else has happened to laptops in the last couple of years? I |
| 69 | +noticed this when I got this new one. They're significantly harder to extend, to |
| 70 | +open up, etc., if not straight impossible. I can't even upgrade the RAM on this |
| 71 | +one. It's a sealed box, meant to stay as is since it was shipped from the |
| 72 | +factory. If you have the skills to get inside it, you may do so, but it is not |
| 73 | +meant to be opened. My old laptop, and any old laptop, at least allowed you to |
| 74 | +change some components: I had replaced my old ASUS's spinning hard drive with a |
| 75 | +SATA SSD drive, extended its RAM with a pair of extra modules, and replaced its |
| 76 | +battery pack. All three upgrades or repairs are _hardly possible_ on this new HP |
| 77 | +15. |
| 78 | + |
| 79 | +There are many reasons why we got into this situation, Apple being an important |
| 80 | +part of it (I guess), but there's also another side to this. If you, the vendor, |
| 81 | +can predict that the hardware _will_ stay the same, then you are able to |
| 82 | +implement coherent power management to all components the laptop ships with. One |
| 83 | +of the issues with traditional S3 sleep, or even S4 (_Suspend to disk,_ aka |
| 84 | +"hibernation"), was that many times hardware components entered undefined states |
| 85 | +when woken up. This wasn't even a problem exclusive to Linux: this could happen |
| 86 | +to you on Windows as well. The reason behind this is obvious: the platform was |
| 87 | +open, you couldn't predict whether the user was going to change or upgrade |
| 88 | +something that would break when entering a sleep state because of drivers or |
| 89 | +your firmware not being able to handle that new component correctly. |
| 90 | + |
| 91 | +I'm under the impression that a modern laptop is much closer to a smartphone |
| 92 | +than to a desktop workstation. We're still on a version of x86 that internally |
| 93 | +complies with the PC standard, but laptops have evolved to behave much more like |
| 94 | +our ARM-based smartphones. My HP 15 is practically a big tablet running Arch |
| 95 | +Linux. And you know what? There are improvements to take into account from this |
| 96 | +historical evolution. |
| 97 | + |
| 98 | +I no longer suspend to disk. I know this laptop will _reliable_ wake up every |
| 99 | +single time I ask it to suspend _to idle._ I know my WiFi and Bluetooth cards |
| 100 | +will resume operations immediately as soon as I wake the system up. I know there |
| 101 | +will be no graphical gitches or slow-downs either (I was plagued with these on |
| 102 | +my old ASUS, thanks to the infamous i915 driver). I'm not even getting into the |
| 103 | +improvements in battery life that come from smart charging and discharging |
| 104 | +implemented in UEFI and modern power supplies.[^2] Suspending to disk was sort |
| 105 | +of a workaround I used to save power and time, but also had its own issues |
| 106 | +(again, the i915 driver, but sometimes also networking). Now, with this new |
| 107 | +machine, I know things will work out of the box (unless some kernel update |
| 108 | +breaks something, which is unlikely). |
| 109 | + |
| 110 | +Convenience is mostly always good, unless it comes with ethical problems [like |
| 111 | +generative AI does]({{< ref "posts/ai-not-friend-not-therapist" >}}). Of course, |
| 112 | +everyone's definition of _convenience_ will be different. Arch Linux is |
| 113 | +convenient for me, but you might find Ubuntu more convenient. We all love |
| 114 | +tinkering and I guess we all also love the thrill (and frustration) of fixing an |
| 115 | +unexpected issue on our computers, but in the end of the day, we use these |
| 116 | +machines _to get things done._ And I'm someone who wants her computer to be up |
| 117 | +and running as fast as possible from a sleep state because I might want to write |
| 118 | +down an idea on a text editor and close the lid a minute later. |
| 119 | + |
| 120 | +I understand the problems with closing down the platforms we use daily, though. |
| 121 | +I'm also nostalgic of the past where PCs were your hardware playground. Laptops |
| 122 | +were always more closed down than desktop PCs, but still. However, I do wonder |
| 123 | +whether we were compensating for the shortcomings of the industry back in the |
| 124 | +90s and 00s. Gravis, from the [_Cathode Ray Dude_ YouTube channel,][crd-yt] has |
| 125 | +repeatedly stated that the PC platform has become a "solved problem" in the last |
| 126 | +decade or so. There are no weird hardware experiments like [strange PCMCIA |
| 127 | +cards,][crd-pcmcia-camera] peripherals have all converged into USB devices |
| 128 | +(maybe HDMI is the only standing exception), WiFi has become practically |
| 129 | +universal (this laptop does _not_ have an Ethernet port), we have gotten rid of |
| 130 | +SD cards and other external storage devices... I am surprised that my new laptop |
| 131 | +comes with a headphone jack. The PC in general, but probably laptops even more, |
| 132 | +have become "boring." This is the price of having figured a technology out, I |
| 133 | +guess. |
| 134 | + |
| 135 | +[^1]: I tried to extend its life as much as I could, but after 11 years of many |
| 136 | + repairs, changed parts, that old ASUS X55C was in no shape to be my main |
| 137 | + system at all. It was a sad goodbye, because I wrote my PhD thesis on it, |
| 138 | + and we had endured many, many adventures together. |
| 139 | + |
| 140 | +[^2]: Have you noticed the data pin living inside the DC connector? |
| 141 | + |
| 142 | +[sleep-docs]: https://www.kernel.org/doc/html/latest/admin-guide/pm/sleep-states.html |
| 143 | + |
| 144 | +[android-doze]: https://source.android.com/docs/core/power/platform_mgmt |
| 145 | + |
| 146 | +[crd-yt]: https://www.youtube.com/@CathodeRayDude |
| 147 | + |
| 148 | +[crd-pcmcia-camera]: https://www.youtube.com/watch?v=xpJBHjl9_VU |
0 commit comments