Bug 28863 - Xorg is messed up after waking up from sleep / S3 / suspend to RAM
Summary: Xorg is messed up after waking up from sleep / S3 / suspend to RAM
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 8
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords: IN_ERRATA8
Depends on:
Blocks:
 
Reported: 2021-05-01 12:46 CEST by Rob Teng
Modified: 2022-01-07 17:57 CET (History)
3 users (show)

See Also:
Source RPM: kernel-5.10.30-1.mga8.src.rpm
CVE:
Status comment:


Attachments

Description Rob Teng 2021-05-01 12:46:34 CEST
Description of problem:
The screen is messed up, blocky graphics and such.
The keyboard doesn't work, num-lock and caps-lock don't react.
Replugging the keyboard doesn't help.
The system looks to be crashed/locked, but it's not a kernel panic.
The mouse works, looks messed up and blocky, but it moves.

And: I can ssh into the system!
When I then do: 
telinit 3
I can then use keyboard again. 
Logging in and doing:
X
will however give a randomly messed up screen again.
But: the keyboard then somewhat works, caps-lock and num-lock will toggle as evidenced by the indicator lights.
I can't get much further, but ctrl-alt-backspace also works.

From the ssh root shell, doing:
telinit 5
will give random graphic blockyness once more, mouse response with blocky messed up cursor, and the keyboard won't work anymore.

I already tried turning off the graphics effects in Plasma, this reduces the occurrence of the phenomenon, it now happens after a handful of times of going to sleep and waking up, not every single or second time.

This didn't happen in Mageia 7 before upgrading to Mageia 8.
I did try to use my last kernel from Mageia 7, but that one fails to start properly.

I  have an AMD APU A10 7800, onboard graphics.
The logs show me this repeatedly:
kernel: [drm] scheduler sdma0 is not ready, skipping

However, no idea if that is related.
Please let me know what I could look at in the logs.


Version-Release number of selected component (if applicable):
My Mageia 8 is up to date.


How reproducible:


Steps to Reproduce:
1. Use Plasma
2. Goto sleep
3. Wake up
Comment 1 Rob Teng 2021-05-01 13:11:06 CEST
I just tried again to boot with the last Mageia 7 kernel: 5.10.27-desktop-1.mga7, to find on vt12 that it won't go to graphics mode at all due to sddm not starting, "failed to read display number from pipe"

I then logged in on vt2 as normal user, entered the command:
X
to find the error (copied from log after rebooting to latest desktop kernel):
[   212.250] (II) AMDGPU: Driver for AMD Radeon:
        All GPUs supported by the amdgpu kernel driver
[   212.270] (WW) Falling back to old probe method for v4l
[   212.270] (II) AMDGPU(0): [KMS] Kernel modesetting enabled.
[   212.270] (EE) AMDGPU(0): amdgpu_device_initialize failed
[   212.302] (II) AMDGPU(1): [KMS] Kernel modesetting enabled.
[   212.302] (EE) AMDGPU(1): amdgpu_device_initialize failed
[   212.333] (II) AMDGPU(G0): [KMS] Kernel modesetting enabled.
[   212.333] (EE) AMDGPU(G0): amdgpu_device_initialize failed
[   212.365] (EE) Screen 0 deleted because of no matching config section.
[   212.365] (II) UnloadModule: "amdgpu"

From the screen error message I got this (more / different information):
amdgpu_device_initialize: DRM version is 2.50.0 but this driver is only compatible with 3.x.x.


So without debugging, I can't run the older Mageia 7 kernel...

Naturally, I prefer to fix the Mageia 8 system plus latest desktop kernel.
Comment 2 Rob Teng 2021-05-01 14:23:28 CEST
Managed to start the last Mageia 7 kernel: 5.10.27-desktop-1.mga7, and even with Plasma compositor on, it works, I did at least 10 sleep-wake cycles.
To start the old kernel, I just removed the xorg.conf (quite possibly crufty) and then it would start.

So the 5.10.30 kernel of Mga8 is not okay.

Just tried 5.10.27-desktop-1.mga8, 3rd try failed, screen remains black and num-lock/caps-lock don't work.
The trick with telinit also doesn't work, and shutdown -r hangs halfway.

So the kernel 5.10.27-desktop-1.mga8 is also not ok.

Kernel 5.10.27-desktop-1.mga7 works fine. With OpenGL2.0 and 3.1 compositor.

Anything I can look up in the logs or try, please tell me.

Source RPM: (none) => kernel-5.10.30-1.mga8.src.rpm

Comment 3 Morgan Leijström 2021-05-01 15:05:59 CEST
FYI kernel 5.10.33 desktop is in updates testing.
Also other new packages there that are related to your system.

CC: (none) => fri

Comment 4 Aurelien Oudelet 2021-05-03 15:52:12 CEST
I wonder if this system is affected by the switch for amdgpu for some AMD/Radeon systems.

@ reporter, can you try to switch the video driver to radeon instead of amdgpu?

CC: (none) => ouaurelien

Comment 5 Morgan Leijström 2021-05-03 16:14:39 CEST
How to switch:
https://wiki.mageia.org/en/Mageia_8_Errata#AMD.2FATI
Comment 6 Lewis Smith 2021-05-04 09:20:29 CEST
Yet another sleep related bug (according to the title, but not mentioned in the description). This one is not a duplicate of the others I found.
Since this a video problem, to give its details please post the output of:
 $ inxi -SGxx

CC: (none) => lewyssmith

Comment 7 Aurelien Oudelet 2021-05-08 15:28:07 CEST
Reporter, could you please reply to the question from Comment 4 to 6? If you don't reply within two weeks from now, I will have to close this bug as OLD. Thank you.

Keywords: (none) => NEEDINFO

Comment 8 Rob Teng 2021-05-09 22:03:40 CEST
Hello all, sorry, holidays intervened... Thanks for all comments/feedback/ideas.

First: kernel vmlinuz-5.10.33-desktop-1.mga8 has a similar problem, the graphics are not messed up, but it doesn't always come back properly from sleep.
I only tried with Plasma, effects turned on.

Second, with the "good" kernel:
$ inxi -SGxx
System:    Host: zurich Kernel: 5.10.27-desktop-1.mga7 x86_64 bits: 64 compiler: gcc v: 8.4.0 Desktop: KDE Plasma 5.20.4 
           tk: Qt 5.15.2 wm: kwin_x11 dm: SDDM Distro: Mageia 8 mga8 
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Kaveri [Radeon R7 Graphics] vendor: ASUSTeK driver: radeon v: kernel 
           bus ID: 00:01.0 chip ID: 1002:130f 
           Device-2: Conexant Systems CX23880/1/2/3 PCI Video and Audio Decoder 
           vendor: Hauppauge works Hauppauge WinTV 34xxx models driver: cx8800 v: 1.0.0 bus ID: 01:06.0 chip ID: 14f1:8800 
           Display: x11 server: Mageia X.org 1.20.11 compositor: kwin_x11 driver: ati,radeon unloaded: fbdev,modesetting,vesa 
           resolution: 3840x2160~60Hz s-dpi: 96 
           OpenGL: renderer: AMD KAVERI (DRM 2.50.0 5.10.27-desktop-1.mga7 LLVM 11.0.1) v: 4.5 Mesa 21.0.2 direct render: Yes 

With the "bad" kernel:
$ inxi -SGxx
System:    Host: zurich Kernel: 5.10.33-desktop-1.mga8 x86_64 bits: 64 compiler: gcc v: 10.3.0 Desktop: KDE Plasma 5.20.4 
           tk: Qt 5.15.2 wm: kwin_x11 dm: SDDM Distro: Mageia 8 mga8 
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Kaveri [Radeon R7 Graphics] vendor: ASUSTeK driver: amdgpu v: kernel 
           bus ID: 00:01.0 chip ID: 1002:130f 
           Device-2: Conexant Systems CX23880/1/2/3 PCI Video and Audio Decoder 
           vendor: Hauppauge works Hauppauge WinTV 34xxx models driver: cx8800 v: 1.0.0 bus ID: 01:06.0 chip ID: 14f1:8800 
           Display: x11 server: Mageia X.org 1.20.11 compositor: kwin_x11 driver: amdgpu,ati unloaded: fbdev,modesetting,vesa 
           resolution: 3840x2160~60Hz s-dpi: 96 
           OpenGL: renderer: AMD KAVERI (DRM 3.40.0 5.10.33-desktop-1.mga8 LLVM 11.0.1) v: 4.6 Mesa 21.0.2 direct render: Yes
Comment 9 Rob Teng 2021-05-09 22:29:28 CEST
Swapped in the radeon driver by adding "radeon.cik_support=1 amdgpu.cik_support=0" to the kernel boot line, which leads to this:

$ inxi -SGxx
System:    Host: zurich Kernel: 5.10.33-desktop-1.mga8 x86_64 bits: 64 compiler: gcc v: 10.3.0 Desktop: KDE Plasma 5.20.4 
           tk: Qt 5.15.2 wm: kwin_x11 dm: SDDM Distro: Mageia 8 mga8 
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Kaveri [Radeon R7 Graphics] vendor: ASUSTeK driver: radeon v: kernel 
           bus ID: 00:01.0 chip ID: 1002:130f 
           Device-2: Conexant Systems CX23880/1/2/3 PCI Video and Audio Decoder 
           vendor: Hauppauge works Hauppauge WinTV 34xxx models driver: cx8800 v: 1.0.0 bus ID: 01:06.0 chip ID: 14f1:8800 
           Display: x11 server: Mageia X.org 1.20.11 compositor: kwin_x11 driver: ati,radeon unloaded: fbdev,modesetting,vesa 
           resolution: 3840x2160~60Hz s-dpi: 96 
           OpenGL: renderer: AMD KAVERI (DRM 2.50.0 5.10.33-desktop-1.mga8 LLVM 11.0.1) v: 4.5 Mesa 21.0.2 direct render: Yes 

I'm currently at the 10th cycle of sleep + wake up, looks to be working fine!


Perhaps unrelated: I do see a warning on the text interface before the graphics are awake (and after they've gone asleep):
[ 557.547954] [drm:radeon_dp_link_train [radeon]] *ERROR* clock recovery tried 5 times
[ 557.547985] [drm:radeon_dp_link_train [radeon]] *ERROR* clock recovery failed

I think these messages were often there before, I just stopped paying attention (it's hard to read, tiny text and very brief).
And I now guess they weren't there with the amdgpu driver, but I'll have to reboot without kernel options to find out. Let me know if you think it's relevant.


Also, and more importantly, let me know if there's an amdgpu kernel / module / option to try what is wrong with the driver.
Until then I'll figure out how to make the latest kernel start with the right/
Comment 10 Aurelien Oudelet 2021-05-10 14:24:16 CEST
(In reply to Rob Teng from comment #9)
> Swapped in the radeon driver by adding "radeon.cik_support=1
> amdgpu.cik_support=0" to the kernel boot line, which leads to this:
> 
> $ inxi -SGxx
> System:    Host: zurich Kernel: 5.10.33-desktop-1.mga8 x86_64 bits: 64
> compiler: gcc v: 10.3.0 Desktop: KDE Plasma 5.20.4 
>            tk: Qt 5.15.2 wm: kwin_x11 dm: SDDM Distro: Mageia 8 mga8 
> Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Kaveri [Radeon R7
> Graphics] vendor: ASUSTeK driver: radeon v: kernel 
>            bus ID: 00:01.0 chip ID: 1002:130f 

>            Display: x11 server: Mageia X.org 1.20.11 compositor: kwin_x11
> driver: ati,radeon unloaded: fbdev,modesetting,vesa 
>            resolution: 3840x2160~60Hz s-dpi: 96 
>            OpenGL: renderer: AMD KAVERI (DRM 2.50.0 5.10.33-desktop-1.mga8
> LLVM 11.0.1) v: 4.5 Mesa 21.0.2 direct render: Yes 
> 
> I'm currently at the 10th cycle of sleep + wake up, looks to be working fine!
> 

Ho, yes! Your device seems affected by this errata https://wiki.mageia.org/en/Mageia_8_Errata#AMD.2FATI

So, you must add "radeon.cik_support=1 amdgpu.cik_support=0" to solve this bug.

Your device is a "Kaveri" chip, that has both support from old radeon driver and from newer amdgpu one. But, the amdgpu seems less advanced than radeon one for your device. Moreover, AMD focuses on newer graphic chips support than fixing existing one.

Unsure if we should do more. Adding Kernel and Drivers maintainers for additional advice.

Good candidate to add this Bug Report in that Erratas as an example.

Status: NEW => RESOLVED
CC: (none) => kernel
Resolution: (none) => FIXED
Keywords: NEEDINFO => (none)

Comment 11 Morgan Leijström 2021-05-10 15:15:33 CEST
Added link as example

Keywords: (none) => IN_ERRATA8

Comment 12 Rob Teng 2021-05-10 19:48:45 CEST
In the description it would be good to mention that in this case, it's a wake from sleep / S3 issue, it doesn't appear on straight boot.
That's also the reason I didn't find it, I was looking through the errata for sleep issues.

Btw if there is another potential fix at some point with the amdgpu driver, I'll be happy to try things out.
I'll check back at this bugreport until I get my email address updated, then I can subscribe...
Comment 13 Thomas Backlund 2021-05-10 20:11:09 CEST
There are several suspend/resume related fixes for amd gpus landing in upstream 5.13-rc, and some of them are also currently being backported to older kernels...

There is also a 5.12.2 based kernel in backports_testing that might work better..
Comment 14 Morgan Leijström 2021-05-10 21:03:24 CEST
Thanks. Improved Errata.
Comment 15 Rob Teng 2021-05-20 10:44:26 CEST
Quick update from my side:
Kernel: vmlinuz-5.10.33-desktop-1.mga8 and vmlinuz-5.10.37-desktop-2.mga8 both don't work well with amdgpu, in both cases reverting to the radeon enabled proper  wake up from sleep / STR / S3.
Comment 16 Rob Teng 2021-06-05 17:08:52 CEST
I just tried with the kernel-desktop-5.10.41-1.mga8-1-1.mga8.x86_64.rpm update, after five or six successful S3/sleep/STR cycles, the screen remained black and the keyboard got no response, caps-lock and num-lock had no effect (lights didn't toggle).
Comment 17 Aurelien Oudelet 2021-06-05 17:11:56 CEST
(In reply to Rob Teng from comment #16)
> I just tried with the kernel-desktop-5.10.41-1.mga8-1-1.mga8.x86_64.rpm
> update, after five or six successful S3/sleep/STR cycles, the screen
> remained black and the keyboard got no response, caps-lock and num-lock had
> no effect (lights didn't toggle).

With amdgpu or Radeon driver?
Comment 18 Rob Teng 2021-06-11 15:46:23 CEST
Sorry, Aurelien, I forgot to check this page for responses... 

The latest kernel works great with the old radeon driver, the new amdgpu driver still has the "same" problem.

Suspend to RAM / Sleep / S3 did work for a couple of times, so perhaps that's an indication of progress.
Comment 19 Morgan Leijström 2021-06-11 16:14:55 CEST
@Rob: did you try kernel 5.12 from backports (see comment 13)

I also see tmb is cooking new 5.10 and 5.12 in core testing and backports testing repos, no related Bug raised yet.
Lewis Smith 2021-06-11 21:52:16 CEST

CC: lewyssmith => (none)

Comment 20 Morgan Leijström 2021-06-11 22:18:17 CEST
Testing kernels: Bug 29106, Bug 29111,
Comment 21 Rob Teng 2021-06-15 15:18:33 CEST
I just tried kernel 5.10.43-desktop-1.mga8, it got locked with scrambled artefacts on screen after the 2nd cycle of Suspend-to-RAM+Wake-up when booting with the amdgpu driver.
Comment 22 Rob Teng 2021-06-24 14:23:42 CEST
I just updated to 5.10.45-desktop-2.mga8, with the amdgpu driver it locked up the first time it tried to wake up from Sleep/S3.
Comment 23 Rob Teng 2021-07-01 11:13:41 CEST
And also with 5.10.46-desktop-1.mga8, with the amdgpu driver it locked up the first time it tried to wake up from Sleep/S3.
Comment 24 Rob Teng 2021-07-16 17:42:48 CEST
FYI: I updated to kernel 5.10.48-desktop-1.mga8, again with the amdgpu driver it locked up the first time it tried to wake up from Sleep/S3, with the radeon driver S3 / STR works fine.
Comment 25 Rob Teng 2021-07-28 22:56:58 CEST
I updated to kernel 5.10.52-desktop-1.mga8, again with the amdgpu driver it locked up the first time it tried to wake up from Sleep/S3, with the radeon driver S3 / STR works fine.

I do feel like I'm repeating myself here... ;-)
Comment 26 Morgan Leijström 2022-01-07 17:57:00 CET
Just wondering if it works better with later kernels?

Note You need to log in before you can comment on or make changes to this bug.