Live data from Hacker News

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

nyanpasu64.gitlab.io

181–190 of 218 posts

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

#181
post #56

Memory management and specifically OOM conditions remain an unbelievably painful nightmare on Linux. It's not like I run into these issues constantly, but I've definitely tried to debug issues like these (unsuccessfully). Ultimately if I OOM a machine I usually wind up installing more RAM, which is wasteful/expensive, but it's pretty clear that handling OOM conditions gracefully is going to be a hard problem for Linu…

Have you been running zswap / zram?

With zstd you can turn 8GB of RAM into 20GB of 'RAM' without much issue. or 16GB into 40GB. Hell, if you're feeling adventurous (and Android does this, so its very stable) you can overcommit your memory past 100%.

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

#182
post #125

Earlier quoted context omitted.

Even Apple struggled to get it working perfectly in my experience across several models in the PPC/x86 era. Yes they are better(-ish) but when I had Apple laptops I'd still see weird sleep/wake issues in around 1 in every ~50 sleep/wake cycles. I also had one Apple laptop which had its battery going from 100% to 0% overnight during sleep requiring a cold start in the morning on a regular basis despite it being put to…

> Lenovo manages to do sleep/wake fine in Linux almost as well as Apple in my experience and I sleep/wake my Lenovo laptop regularly -- this is across two different models I have used so far (X1 and X390). I'd rate my OpenBSD X1 as not terrible too. Not as smooth as MacBook but adequate.

Carbon or Extreme? I can't even get resume on windows to work properly on my 1st gen X1 Extremes

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

#183
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?

This is highly hardware dependent. Modern hardware is complex enough that it pretty much has to explicitly support Linux or it won't work well.

I have been buying System76 for about twenty years now, and this is has not been an issue for me either.

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

#184
post #56

Memory management and specifically OOM conditions remain an unbelievably painful nightmare on Linux. It's not like I run into these issues constantly, but I've definitely tried to debug issues like these (unsuccessfully). Ultimately if I OOM a machine I usually wind up installing more RAM, which is wasteful/expensive, but it's pretty clear that handling OOM conditions gracefully is going to be a hard problem for Linu…

> Memory management and specifically OOM conditions remain an unbelievably painful nightmare on Linux.

Yes. It's horrendous to put it mildly. Linux does not handle OOM conditions properly.

I know I can set up a few guardrails with cgroups. I know I can also install earlyoom. I know I can increase swap or use zram. In the end these are all fundamentally just nasty hacks that might spare one once in a while. They do not fix how these conditions are handled. Please do not offer these as solutions.

I've seen LUKS volumes mount themselves read-only because the kernel couldn't allocate memory in dm_crypt, for the love of god just kill something in userspace. The current state is utterly unacceptable and I'm tired of all the excuses.

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

#185

AMD GPU linux drivers are (were?) a nightmare in general, and this includes iGPUs in their processors. Sadly, I don't have the impression that AMD is actively working on fixing this. Just to make sure I'm not griping over something long fixed, I took a quick look and instantly found someone with a very similar issue to the one I ran into happening on a semi-recent kernel: https://community.amd.com/t5/pc-drivers-softw…

This used to be the case.

However, they have published docs on their hardware. For instance, https://gpuopen.com/amd-gpu-architecture-programming-documen... Their driver is also in-tree: https://wiki.archlinux.org/title/AMDGPU

It may or may not be as good as Intel. I don't have the depth of experience there right now.

It looks like AMD and Intel GPUs should be roughly similar in terms of support / out of the box experience on Linux, but AMD will have better performance.

Nvidia is still super proprietary, so it will generally have more headaches and hoops to deal with.

So, generally, I rank them by default:

1. AMD 2. Intel 3. Nvidia

Unless there is a reason (firmware or configuration differences for Intel/AMD needing to run/develop CUDA code for Nvidia) I try to stick with that. I've not yet had an AMD laptop though.

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

#186

Update: I upgraded to an Intel Arc B570 GPU... and ran into the exact same problem on an independent driver: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4288

Oh hey, another Intel Arc user! I got the LE B580 and so far it's been a pretty good experience for me, though I don't really use suspend.

Also I got curious about your blog (haven't heard about Zola, recently migrated my own blog over to a newer version of Grav, which is a flat file CMS with no DB) and saw your post about looking for a new job. Hope things work out for you, stay safe!

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

#187
post #3

> Through some digging, I found that when a desktop enters S3 sleep, the system cuts power to PCIe GPUs I am not sure how correct this assumption is. S3 is supposed to cut power to everything but RAM, but for example Gigabyte Aorus motherboards are notorious for an NVMe SSD sleep bug that randomly prevents the system from properly sleeping or waking. This is fixed by adding the following udev rule: # Generic PCIe fix…

> I am not sure how correct this assumption is. S3 is supposed to cut power to everything but RAM, but for example Gigabyte Aorus motherboards are notorious for an NVMe SSD sleep bug that randomly prevents the system from properly sleeping or waking.

You would hope that you could probe the hardware to see if it really is in sleep or not, or that re-waking the hardware would not cause issue if it never went to sleep.

Also I would expect that you could send a sleep command to the PCIe device, then try to sleep the bus itself. The to wake you would bring back the bus and then wake the device.

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

#188
post #125

Earlier quoted context omitted.

Even Apple struggled to get it working perfectly in my experience across several models in the PPC/x86 era. Yes they are better(-ish) but when I had Apple laptops I'd still see weird sleep/wake issues in around 1 in every ~50 sleep/wake cycles. I also had one Apple laptop which had its battery going from 100% to 0% overnight during sleep requiring a cold start in the morning on a regular basis despite it being put to…

> Lenovo manages to do sleep/wake fine in Linux almost as well as Apple in my experience and I sleep/wake my Lenovo laptop regularly -- this is across two different models I have used so far (X1 and X390). I'd rate my OpenBSD X1 as not terrible too. Not as smooth as MacBook but adequate.

I always had the suspicion that this has more to do with a lot of kernel hackers using Thinkpads, so they fix them up, rather than Lenovo doing a good job.

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

#189
post #47

Earlier quoted context omitted.

My custom-build desktop had an issue with the previous AM4 motherboard I had where if you told Windows to hibernate, the entire machine would shut down as normal, but then a few seconds later it'd wake back up by itself and unhibernate. I had to turn off the PSU power switch during those few moments to keep it in hibernate mode. New mobo and that's gone now. BIOS updates never helped. Really odd.

Probably no help to you now, but if someone has a Windows machine that keeps waking up by itself, you can see what triggered the wake by running powercfg /lastwake in a command window as admin.

True, and that helps if it won't go to sleep. This was some weird bug in either the board or the bios.

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

#190
post #108

Earlier quoted context omitted.

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…

0% of new Windows laptops support proper S3 sleep mode since Microsoft gutted it in favor of "modern standby".

Framework does! I think they might be the _only_ one to consistently support it.
Post reply on HN