Live data from Hacker News

I helped fix sleep-wake hangs on Linux with AMD GPUs

nyanpasu64.gitlab.io

191–200 of 218 posts

Re: I helped fix sleep-wake hangs on Linux with AMD GPUs

#191
post #86

Earlier quoted context omitted.

Linus tech tips on YouTube did a video about a windows bug where sleeping while charging would allow the laptop to wake up to check for updates etc but often caused this issue of turning on in a bag

It wouldn't happen that this feature was released around early/mid 2020? Windows sleep used to be semi-reliable but one it's been shit for a couple of years. (Any link to the video/docs for turning it off?)

Search "LTT Windows Modern Standby" on YouTube. Sadly all the workarounds to turn it off no longer work reliably. For reliable sleep, buy a Framework (only current Windows laptop that still supports S3 Sleep) or Macbook.

Re: I helped fix sleep-wake hangs on Linux with AMD GPUs

#192
post #77

Earlier quoted context omitted.

There's really two problems as I understand it: - Overcommit. Linux will "overcommit" memory: allocations will succeed when there's no memory, and then hang when the page is actually mapped if no physical pages are available (to my understanding.) Windows NT doesn't do this. Not sure exactly how macOS/XNU handles it. - The OOM killer. Because allocations don't fail, to actually recover from an OOM situation the kerne…

> two problems ... overcommit Is there any other sensible way to do this though? It would be quite inefficient to constantly call mmap for additional small(ish) pieces of memory. In effect overcommit just means that until the page is actually written to it hasn't really been allocated. (Aside: I believe a malloc implementation that zero'd out blocks on allocation would fail abruptly rather than later in case that hap…

A potential workaround would be to still allow giant mmaps but not hang a program when it runs out of pages and instead send a signal to it. Obviously, neither Chrome nor Firefox actually use this much memory in practice.

Re: I helped fix sleep-wake hangs on Linux with AMD GPUs

#193
post #83
post #52

Earlier quoted context omitted.

Because they own the now hardware, and MacOS iOS run exclusively on their hardware Source: I work on windows power management and I know system engineers at apple.

That's the often repeated argument. But as a counter point you have the Google Pixel. Google owns the hardware, even the SoC, and the software. And yet, battery is still poorer than third party Android phone manufacturers. And let's not even compare to Apple. So controlling the entire stack isn't enough. There has to be a desire to do better, as well as technical competency.

third-party manufacturers cheat for battery life benchmarks and they don't even get that much better battery life. the current state of the pixel phones allows me all day battery life without such headaches.

in my experience with OnePlus, it aggressively kills and/or throttles applications that you want to be running in the background (e.g. fitness trackers or even audio players) even when you put them on the battery allowlist.

at the same time, my iPad just randomly decides to drain all of its battery even when it's been sitting unused without any apps installed. I don't have this problem on Pixel devices. (you do get this problem as soon as you install some misbehaving apps but that's something you've done to yourself)

Re: I helped fix sleep-wake hangs on Linux with AMD GPUs

#194
post #66

I used to think that naming things, cache invalidation, and off-by-one errors were the 2 biggest problems in CS, but then I learned about the "sleep/wake" problem and realized it's NP-complete.

I think sleep/wake is a subset of cache invalidation - if all peripherals were stateless, probably it wouldn't be an issue.

Re: I helped fix sleep-wake hangs on Linux with AMD GPUs

#195
post #108
post #36

Earlier quoted context omitted.

Sleep & suspend doesn’t work on Windows either. Power control is the kind of stuff that benefits from very tight integration, and PCs just don’t have that. Firmware is seen by most vendors as a pure cost to minimize, so you get a fragmented market full of subcontractors delivering the bare minimum that is considered “working”. Manufacturers also know most people aren’t going to use a big part of the functions they’re…

Are there issues in Windows? Sure but if you give me 100 laptops, 80% will do this right without any issue. Maybe 30% of those laptops will work right on any Linux distro without major fucking around with bullshit trying to make it work. Yes those numbers are made up but I have been running versions of Linux since Slackware in the 90s. I still have a desktop with an amd cpu and nvidia gpu that I can’t get to sleep/su…

Once upon a time, Windows sleep was reliable 99.xy% of the time. If you put a Windows laptop to sleep it stayed asleep cozily.

Now its like an elderly nursing home patient who wakes up several times and raids the kitchen to eat all the time.

The fall of a once great OS is sad to see. I guess AI matters more to Microsoft than their Core OS nowadays.

Re: I helped fix sleep-wake hangs on Linux with AMD GPUs

#196

Earlier quoted context omitted.

> Sleep & suspend doesn’t work on Windows either. Or Macintosh. My $DAYJOB Macbook sleeps properly about about 2 out of 10 times, at best. Most of the time it fails to sleep and by the next morning when I open it up, the battery is dead. :-( For comparison, my System76 laptop running PopOS! sleeps perfectly, every time with no issues. shrug

> My $DAYJOB Macbook sleeps properly about about 2 out of 10 times, at best. Most of the time it fails to sleep and by the next morning when I open it up, the battery is dead. :-( Important to remember that work laptops typically install all sorts of crap spyware and fleet management software that causes the system to misbehave. That’s not as much on Apple although not protecting their brand against such software is…

Good point. And this machine does have the typical stack of enterprise spyware crapola. Curiously enough though, sleep / suspend do work occasionally. Just not consistently.

Re: I helped fix sleep-wake hangs on Linux with AMD GPUs

#197
post #77

Earlier quoted context omitted.

There's really two problems as I understand it: - Overcommit. Linux will "overcommit" memory: allocations will succeed when there's no memory, and then hang when the page is actually mapped if no physical pages are available (to my understanding.) Windows NT doesn't do this. Not sure exactly how macOS/XNU handles it. - The OOM killer. Because allocations don't fail, to actually recover from an OOM situation the kerne…

> two problems ... overcommit Is there any other sensible way to do this though? It would be quite inefficient to constantly call mmap for additional small(ish) pieces of memory. In effect overcommit just means that until the page is actually written to it hasn't really been allocated. (Aside: I believe a malloc implementation that zero'd out blocks on allocation would fail abruptly rather than later in case that hap…

> Chromium runs (AFAIK) 1 PID namespace per tab. On my machine right now it reports 1.1 TiB virtual memory with a little over 100 MiB resident per tab. 1.1 TiB mapped PER TAB. Of the resident I have no idea how much is actually unique (ie written to following the initial fork).

This is most likely a trick for garbage collection or memory bug hardening or both. Haskell programs also map 1tb.

Re: I helped fix sleep-wake hangs on Linux with AMD GPUs

#198
post #86

Earlier quoted context omitted.

Linus tech tips on YouTube did a video about a windows bug where sleeping while charging would allow the laptop to wake up to check for updates etc but often caused this issue of turning on in a bag

It wouldn't happen that this feature was released around early/mid 2020? Windows sleep used to be semi-reliable but one it's been shit for a couple of years. (Any link to the video/docs for turning it off?)

TL;DR pull the the plug from the laptop _before_ closing the lid. That way it will not be sleeping thinking it got power from the wall.

Re: I helped fix sleep-wake hangs on Linux with AMD GPUs

#200

Earlier quoted context omitted.

After my (closed) gaming laptop started making annoying Windows noises earlier today, I'm led to believe that it doesn't work properly on Windows either. It seems like it's basically hardware whack-a-mole at this point. The only reason Apple does it reasonably well is they control more of the stack and they support less hardware. The only reason Windows does it better than Linux is they have more eyes on it.

The reason it works better on Mac and windows is because they're designed to be desktop OSs. On Linux the funding goes to things cloud services and Android use, which decidedly does not include suspension or other desktop features

The article we're replying under has the author working with Mario Limonciello, an AMD employee and kernel developer.

I've interacted with him countless times on the kernel mailing list and bug tracker, he's literally paid by AMD to work on Linux support for AMD's consumer desktop hardware.

Post reply on HN