Live data from Hacker News

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

nyanpasu64.gitlab.io

81–90 of 218 posts

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

#81

Earlier quoted context omitted.

This space is problematic enough that you could reliably segfault 2017-2019 Intel MacBooks by closing the lid before unplugging HID peripherals, preventing suspend (and cooking it in your bag on the commute home). It also plagues Windows on custom PC builds, even when there are vendor drivers. Not every component plays nicely with suspend states, ASPM, C-sates, load line calibration, etc. And while often the capabili…

Hmm I thought that was a feature, not a bug. I used to leave everything plugged and close the lid if I wanted big downloads to keep going or wanted an even quicker start up.

The computer staying awake when there's a monitor / keyboard/ other HID connected is one thing

The computer locking up when said devices are removed and not properly going to sleep then is a different (much worse) issue

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

#82
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!

Interestingly sleep/wake is something I've found to work almost always just fine out of the box in Linux, including on machines Windows has sleeping issues! It used to be quite bad but things has improved heaps over the last 10 or so years -- however I've also stuck with Lenovo laptops which does generally seem to have better support in Linux.

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

#83
post #52

Apple became a trillion dollar company by mastering sleeping / waking up of electronic devices. why nobody else sees this?

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.

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

#84

Apple became a trillion dollar company by mastering sleeping / waking up of electronic devices. why nobody else sees this?

I have had several Apple devices over the last 20 years and every single one has had the occasional sleep/wake issues. Yes it is generally better but I would stop short of saying Apple has mastered it. I've observed wake failures on all Apple laptops I've owned -- say 1 in every 50 or so wakes will fail. I had one Apple laptop in particular struggle to stay in a sleep state overnight to the point it'd often be completely flat the next morning requiring a cold boot. YMMV but Apple hasn't completely solved the sleep/wake issues in my experience. My Lenovo laptops under Linux and Windows achieve sleep/wake reliability almost as good as Apple/macOS IMHO.

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

#85
post #31

I've had zero problems with S3 wake/sleep on AMD ThinkPad with FreeBSD for years. And FreeBSD uses AMD drivers pulled from Linux. How is this still a problem on Linux? hw.acpi.lid_switch_state=S3

Ditto. My Thinkpad X1 and X390 both have reasonably reliable sleep/wake under Debian.

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

#86

Earlier quoted context omitted.

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

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

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

#87
post #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)

With how much trouble I had with trying (and failing) to make my brand new Dell laptop sleep properly and not the "Modern Standby" crap, plus my desktop randomly breaking GPU hardware acceleration in browser after waking up, I would say it's around O(n4) now. Or maybe even O(n!).

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

#88

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…

> It looks to me that if you want to have a working computer under Linux, it's worth the extra cost to avoid AMD. I think this is a rather hasty conclusion. The popular opinion is the opposite. If you want a working computer under Linux, it's worth it to avoid NVIDIA, especially for laptops. Sure, AMD are not perfect contributors to the kernel, but they are contributing more than NVIDIA[0]. NVIDIA has made some moves…

It depends on the use case. AMD is notorious for their "AMD reset bug" when passing a GPU through to a VM using VFIO. Restart the guest and most cards will lock up because AMD doesn't handle PCI resets properly. You then need to reboot the host to fix it (!). This has been a problem since Polaris if not before and AMD hasn't fixed it, despite knowing full well that the problem exists. At least in this regard, NVIDIA (and Intel as far as I know) work fine.

The community has been able to come up with a workaround for some older cards but the problem persists even in their current cards.

https://github.com/gnif/vendor-reset

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

#89
post #2

Fantastic news. AMD's linux graphics drivers have mostly worked great for me but this has been the one exception that I've hit multiple times.

My luck has been a little less good. Latest problem I'm having is the driver spamming my logs after waking from sleep with "[drm] scheduler comp_1.0.n is not ready, skipping" after "WARNING: CPU: 12 PID: 11871 at drivers/gpu/drm/amd/amdgpu/../display/dc/dc_helper.c:100 generic_reg_update_ex+0x1d2/0x290 [amdgpu]" https://gitlab.freedesktop.org/drm/amd/-/issues/3911

I have something similar with dmesg spam and a possibly related issue, sadly:

https://gitlab.freedesktop.org/drm/amd/-/issues/3790

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

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

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…

It’s much better on ARM. And their external monitor support is so much faster and reliable now. Having control over all their hardware has made a noticeable improvement.
Post reply on HN