Live data from Hacker News

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

nyanpasu64.gitlab.io

61–70 of 218 posts

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

#61

TL;DR: During suspend, for graphics cards, GPU VRAM needs to be transferred to system RAM. However, during high memory usage scenarios the VRAM + RAM usage could exceed system memory -- this would ordinarily involve system swap coming into play and handling the temporarily out of memory issue. However system swap was already deactivated when it came time to suspending the AMD card causing all sorts of problems. The f…

Technically it was the suspend notifier; even suspend prepare executes after swap is disabled. See replies.

Isn’t the hook called PM_SUPEND_PREPARE as per https://nyanpasu64.gitlab.io/blog/amdgpu-sleep-wake-hang/#so...

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

#62
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…

> Sleep & suspend doesn’t work on Windows either. What's strange is that it never used to be a problem. There are five Windows laptops floating around our house at various times (mixture of work and personal) and suspend works properly on none of them. Oddly, it works on my personal laptop with Debian Stable almost every time, failing maybe 1/25 times. Other distros are about the same as Windows.

My colleague showed me his windows machine recently. The rubber on the back around the fans has melted from the times he forgot to shut it down and sleep didn't trigger when he packed it away in his backpack.

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

#63

Since a couple Linux versions something around 6.10 IIRC I've had it where my Nvidia system wakes into a black screen, but with a cursor and alt shells work, specifically KDE Plasma seems bugged here, but they say it's a kernel issue, or at least there are dozens of separate issues open about this kind of bug and it's rather annoying that I can't put my machine to sleep. If anyone has ideas what could fix this I'd re…

Does `sudo systemctl enable nvidia-suspend` help?

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

#64

Earlier quoted context omitted.

Technically it was the suspend notifier; even suspend prepare executes after swap is disabled. See replies.

Isn’t the hook called PM_SUPEND_PREPARE as per https://nyanpasu64.gitlab.io/blog/amdgpu-sleep-wake-hang/#so...

Sorry I had forgotten my own article :( It is confusing that PM_SUSPEND_PREPARE and dpm_prepare share the same word.

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

#67
post #23
post #16

This is amazing work! If folks have ever wondered why suspend is so difficult to get working on linux and why debugging it is equally difficult, this is a single datapoint with lots of information about all the things that can go wrong. Even now I have a thinkpad P1G4 where the fans won't turn off automatically unless I turn them off before going into suspend. Recently I also started having crackling issues with my b…

Remarkable that it's 2025 and laptop sleep/suspend still doesn't work right on linux. I think the first time I encountered this was probably 15 years ago now?

If you have a modern machine with S0 sleep, which is "modern standby" it's very much solved. What it does is it pauses all userspace processes, disables all cores but one and keeps it running on the lowest frequency. The system stays "on" but all devices go in power-saving state which is good enough for days.

So it's not really a problem unless you really wanna do deeper sleeps.

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

#69
post #24

For all the years I've been using Linux, I've always had some kind of sleep issues. I've used Intel, AMD, ATI, and NVIDIA hardware across countless distros and setups, yet nothing seems to make a difference, there's always something that doesn’t work properly with sleep or hibernation. Honestly, it's one of the main issues I wish the Linux community would take a closer look at and finally fix!

This. Linux users must resort to bronze-age tooling in 2025; Crafting and launching handmade scripts by candlelight to diagnose their plethora of sleep issues. But the community likes it this way. Meanwhile, Mac users continue to have sleep that 'just works' and Windows users have an entire sleep troubleshooting toolkit:

https://learn.microsoft.com/en-us/windows-hardware/design/de...

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

#70
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.

Only on Linux though, on Windows it’s O(n2) and on Macos it’s O(log n)
Post reply on HN