#1029356 Thinkpad AMD: amd_pmc module is required for correct s0ix (Windows mode) suspend

Package:
src:linux
Source:
src:linux
Submitter:
Didier 'OdyX' Raboud
Date:
2023-01-24 07:12:04 UTC
Severity:
normal
Tags:
#1029356#5
Date:
2023-01-16 21:33:05 UTC
From:
To:
Hello there,

this is a regression from 6.0.0 too; after post-suspend wakeup, my
plasma wayland session stays frozen; the two DisplayPort screens light
up, backgrounds are shown, but the mouse doesn't move, nothing works.

I'm reportbug'ging this from a SysRQ-R, Ctrl-Alt-F2 text tty.

From cursory dmesg reading, it seems amdgpu has an "IB test failed"
_before_ kernel suspend.

This is on 6.1.4-1a~test, patched against the "2nd DisplayPort doesn't
light up", so feel free to close the bug; I'll test if I get the same
symptoms on an unpatched kernel anyway :-)

Best,

OdyX

#1029356#16
Date:
2023-01-17 14:32:37 UTC
From:
To:
Hi OdyX,

If this issue doesn't occur with the unpatched kernel, that would be VERY
important extra information!
https://gitlab.freedesktop.org/drm/amd/-/issues/2171#note_1724186 may be the
same or similar finding?

If that issue doesn't occur with the unpatched kernel, could you add your
finding to that upstream/forwarded issue?

Thanks!

#1029356#21
Date:
2023-01-17 21:53:54 UTC
From:
To:
Hello there,

Le mardi, 17 janvier 2023, 15.32:37 h CET Diederik de Haas a écrit :

Now that I got my kernel build in place; I can actually confirm that:

On my Thinkpad X13 Gen 2a, without any dongle, hub or docking station (on
battery), with a KDE Plasma Wayland session:

* 6.0.0-6-amd64 (6.0.12-1)
  suspends and resumes correctly
* 6.1.0-1-amd64 (6.1.4-1, unpatched)
  doesn't finish suspending
* 6.1.0-2-amd64 (6.1.6-1, from the 'sid' branch on salsa, not patched)
  doesn't finish suspending
* 6.1.0-2-amd64 (6.1.6-1, from the 'sid' branch on salsa, patched),
  doesn't finish suspending

All three 6.1 kernels (whether patched or not) don't bring the laptop to the
suspended state (power led 'breathing', fans off), but it's kept in an "on"
state (power led on, fans on), from which I found that I *can* wake the laptop
up by short-pressing the power button; the screens gets back to life and show
my lockscreen. But from there, I can't move the mouse nor do anything else.
Alt-SysRq-r + ctrl-alt-f2 give me a tty, but any comeback to tty1 only blank
(not even a blank screen, just a freeze).

This seems to point to a quite severe regression in amdgpu or other amd-
related code; I can't suspend-and-resume the laptop anymore on any 6.1 kernel,
on battery, without anything attached to it.

I'll forward the above findings to the bug you pointed to, hoping it could
help upstream too!

Best,

OdyX

#1029356#30
Date:
2023-01-18 08:22:03 UTC
From:
To:
Le mardi, 17 janvier 2023, 22.53:54 h CET Didier 'OdyX' Raboud a écrit :

It turns out to get suspend to work, the `amd_pmc` module needs to be enabled
(_AND_ the BIOS needs to have the "Sleep State" toggled to Windows (from
Linux).

I _think_ Debian should make sure amd_pmc is loaded on (all?) modern AMD
laptops. I have no idea (yet) what the mechanism to make this happen is though.

#1029356#37
Date:
2023-01-18 10:07:40 UTC
From:
To:
Hi,

Awesome, thanks.

Due to https://bugs.debian.org/992832 the AMD_PMC module got enabled and
I and IIUC you too, verified that it is present in the kernel.

I agree it should be auto-loaded, but I don't know why that didn't happen.
Tagging this bug with 'help' to request the help from ppl who know more
about this then I do.

Cheers,
  Diederik

#1029356#52
Date:
2023-01-21 16:54:26 UTC
From:
To:
Hello there,

My understanding is that there are two distinct bugs here; hereby splitting
to make this clearer.

* Original bug, as retitled by Salvatore; S3 suspend is broken on some AMD
  Ryzens. This is fixed by this patch queue, also attached.
https://gitlab.freedesktop.org/superm1/linux/-/commits/mlimonci/rhbz-2162013-gitlab-2357-v4/

  In the BIOS, "S3" is "Linux mode" for suspend.

* While investigating this; it turns out modern kernels can also suspend
  on s0ix "Windows mode", but this _requires_ the `amd_pmc` module, which
  is not loaded automatically, but it really should. This doesn't look
  like an upstream bug, but rather a Debian one.

  As this only shows on Laptops with a "Windows mode" BIOS configuration
  (in a box that also shows "Linux mode"), I think it's reasonable to see
  this as a bug of only "important" level (even though not resuming from
  suspend is _bad_).

  I don't think we have seen a patch to fix this one yet though.

Best,

OdyX

#1029356#67
Date:
2023-01-23 21:09:22 UTC
From:
To:
Hi Didier,

(Adding Mario to CC, I guess he is fine with it, given as well
involved in Debian).

The answer here is probably "maybe".

This is one clear bug, which has now patches submitted upstream for
review, hopefully for inclusion and then tickle in in 6.1.y.

I asked explicitly again here upstream, but I think there might be a
missunderstanding of each other's side. I asked upstream what can help
identify why the module is not autoloading, in the thread
https://lore.kernel.org/lkml/Y81Ja5Y%2FtgPXk5FA@eldamar.lan/#t .
Unfortunately the replies from Mario are not archived. But his final
reply was:

Didier, in my undestanding of your comments on upstream issue, you did
that actually, correct? I.e. setting to Modern Standby/s2idle mode in
BIOS, but amd_pmc was still *not* autoloading?

Regards,
Salvatore

#1029356#74
Date:
2023-01-24 07:03:23 UTC
From:
To:
Hello there,

Le lundi, 23 janvier 2023, 22.09:22 h CET Salvatore Bonaccorso a écrit :

Right. I probably got confused during testing; or it was not the case in a
previous version. I just rebooted in my 6.1.7-2 (with two patches) with
amd_pmc commented in its /etc/modules-load.d/* file, and indeed, it's loaded
now.

Hereby closing then; thanks for your patience!

Cheers,

    OdyX