You are not logged in.

#1 2021-06-07 08:42:16

tubize
Member
Registered: 2021-06-07
Posts: 6

Laptop randomly unable to wake from suspend state

Hey!

Been lurking on this forum since the beginning of this year, when I installed Arch on my Lenovo T495. This forum is a fantastic resource, with which I've been able to fix all my problems so far. I never like signing up and creating account, that's why I've waited so long smile But this issue is becoming quite frustrating and I can't find anything else I could try.

The problem is that my laptop sometimes fails to wake from suspend state. I just get a black screen and no response whatsoever. When I hold the power button for 4 seconds, the cursor appears, but that's it.
Oftentimes, it wakes just fine. It's very hard to find a pattern in this behaviour, but I think it happens more, as the sleep time is longer if that makes sense.

My laptop is a T495 with an AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx.
DWM as WM, X11. I am using amdgpu driver.
inxi -Fxz:

System:    Kernel: 5.12.9-arch1-1 x86_64 bits: 64 compiler: gcc v: 11.1.0 Desktop: dwm 6.2 Distro: Arch Linux
Machine:   Type: Laptop System: LENOVO product: 20NKS03P00 v: ThinkPad T495 serial: <filter>
           Mobo: LENOVO model: 20NKS03P00 serial: <filter> UEFI: LENOVO v: R12ET57W(1.27 ) date: 11/24/2020
Battery:   ID-1: BAT0 charge: 21.2 Wh (41.2%) condition: 51.5/50.5 Wh (101.9%) volts: 11.5 min: 11.6 model: LGC 02DL007
           status: Unknown
CPU:       Info: Quad Core model: AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx bits: 64 type: MT MCP arch: Zen/Zen+
           note: check rev: 1 cache: L2: 2 MiB
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 36750
           Speed: 1225 MHz min/max: 1400/2300 MHz boost: enabled Core speeds (MHz): 1: 1225 2: 1225 3: 1219 4: 1223 5: 1346
           6: 1223 7: 1221 8: 1223
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Picasso vendor: Lenovo driver: amdgpu v: kernel bus-ID: 06:00.0
           Device-2: IMC Networks Integrated Camera type: USB driver: uvcvideo bus-ID: 4-2.1:4
           Display: x11 server: X.Org 1.20.11 driver: loaded: amdgpu resolution: 1920x1080~60Hz
           Message: Unable to show advanced data. Required tool glxinfo missing.
Audio:     Device-1: Advanced Micro Devices [AMD/ATI] Raven/Raven2/Fenghuang HDMI/DP Audio vendor: Lenovo
           driver: snd_hda_intel v: kernel bus-ID: 06:00.1
           Device-2: Advanced Micro Devices [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor vendor: Lenovo
           driver: snd_pci_acp3x v: kernel bus-ID: 06:00.5
           Device-3: Advanced Micro Devices [AMD] Family 17h HD Audio vendor: Lenovo driver: snd_hda_intel v: kernel
           bus-ID: 06:00.6
           Sound Server-1: ALSA v: k5.12.9-arch1-1 running: yes
           Sound Server-2: JACK v: 0.125.0 running: no
           Sound Server-3: PulseAudio v: 14.2 running: yes
Network:   Device-1: Intel Wireless-AC 9260 driver: iwlwifi v: kernel bus-ID: 01:00.0
           IF: wlp1s0 state: up mac: <filter>
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Lenovo driver: r8169 v: kernel port: 3400
           bus-ID: 03:00.0
           IF: enp3s0f0 state: down mac: <filter>
           Device-3: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Lenovo driver: r8169 v: kernel port: 2000
           bus-ID: 04:00.0
           IF: enp4s0 state: down mac: <filter>
Drives:    Local Storage: total: 476.94 GiB used: 147.42 GiB (30.9%)
           ID-1: /dev/nvme0n1 vendor: Samsung model: MZVLB512HBJQ-000L7 size: 476.94 GiB
Partition: ID-1: / size: 467.18 GiB used: 147.42 GiB (31.6%) fs: ext4 dev: /dev/nvme0n1p3
Swap:      ID-1: swap-1 type: partition size: 1024 MiB used: 0 KiB (0.0%) dev: /dev/nvme0n1p2
Sensors:   System Temperatures: cpu: 66.1 C mobo: 0.0 C gpu: amdgpu temp: 66.0 C
           Fan Speeds (RPM): cpu: 0
Info:      Processes: 246 Uptime: 1h 10m Memory: 13.61 GiB used: 1.98 GiB (14.6%) Init: systemd Compilers: gcc: 11.1.0
           Packages: 916 Shell: Zsh v: 5.8 inxi: 3.3.04

When I run journalctl -b -1, this seems to be the error that's causing the crash (kernel panic?)

[drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] *ERROR* [CRTC:67:crtc-0] flip_done timed out

and 10 seconds later:

[drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:67:crtc-0] flip_done timed out

I've tried booting with kernel options IOMMU=soft, amdgpu.noretry=0 and intremap=off
Each time I thought it fixed it, but no cigar..
I'm running the early microcode updates from amd-ucode

I read somewhere that it might have something to do with processor C-states, and that disabling C6 state was a workaround for some error, but it seems my AMD only supports two C-states?
grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/name:

/sys/devices/system/cpu/cpu0/cpuidle/state0/name:POLL
/sys/devices/system/cpu/cpu0/cpuidle/state1/name:C1
/sys/devices/system/cpu/cpu0/cpuidle/state2/name:C2

Anyone that can point me in the right direction?
Thanks in advance!
Kind regards

Last edited by tubize (2021-06-08 09:43:09)

Offline

#2 2021-06-07 09:03:09

tubize
Member
Registered: 2021-06-07
Posts: 6

Re: Laptop randomly unable to wake from suspend state

Previous errors (related I think) that I had (that seem to have gone with those boot options:

May 14 12:25:33 nvr kernel: irq 7: nobody cared (try booting with the "irqpoll" option)
May 14 12:25:33 nvr kernel: CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           OE     5.12.3-arch1-1 #1
May 14 12:25:33 nvr kernel: Hardware name: LENOVO 20NKS03P00/20NKS03P00, BIOS R12ET57W(1.27 ) 11/24/2020
May 14 12:25:33 nvr kernel: Call Trace:
May 14 12:25:33 nvr kernel:  <IRQ>
May 14 12:25:33 nvr kernel:  dump_stack+0x76/0x94
May 14 12:25:33 nvr kernel:  __report_bad_irq+0x35/0xaa
May 14 12:25:33 nvr kernel:  note_interrupt.cold+0xb/0x64
May 14 12:25:33 nvr kernel:  handle_irq_event+0xa9/0xb0
May 14 12:25:33 nvr kernel:  handle_fasteoi_irq+0x8a/0x1f0
May 14 12:25:33 nvr kernel:  __common_interrupt+0x41/0xa0
May 14 12:25:33 nvr kernel:  common_interrupt+0x7e/0xa0
May 14 12:25:33 nvr kernel:  </IRQ>
May 14 12:25:33 nvr kernel:  asm_common_interrupt+0x1e/0x40
May 14 12:25:33 nvr kernel: RIP: 0010:cpuidle_enter_state+0xc7/0x380
May 14 12:25:33 nvr kernel: Code: 8b 3d 15 8d 40 7e e8 d8 67 8c ff 49 89 c5 0f 1f 44 00 00 31 ff e8 f9 74 8c ff 45 84 ff 0f 85 da 01 00 00 fb 66 0f 1f 44 00 00 <45> 85 f6 0f 88 11 01 00 00 4>
May 14 12:25:33 nvr kernel: RSP: 0018:ffffffff82e03e50 EFLAGS: 00000246
May 14 12:25:33 nvr kernel: RAX: ffff941fb0a2c7c0 RBX: 0000000000000002 RCX: 000000000000001f
May 14 12:25:33 nvr kernel: RDX: 0000000000000000 RSI: 0000000037c1b90d RDI: 0000000000000000
May 14 12:25:33 nvr kernel: RBP: ffff941d03ef8000 R08: 00000174dd23bd06 R09: 00000174dfd1aaf7
May 14 12:25:33 nvr kernel: R10: 0000000000000001 R11: 0000000000000001 R12: ffffffff82f49e60
May 14 12:25:33 nvr kernel: R13: 00000174dd23bd06 R14: 0000000000000002 R15: 0000000000000000
May 14 12:25:33 nvr kernel:  cpuidle_enter+0x29/0x40
May 14 12:25:33 nvr kernel:  do_idle+0x1e3/0x280
May 14 12:25:33 nvr kernel:  cpu_startup_entry+0x19/0x20
May 14 12:25:33 nvr kernel:  start_kernel+0x876/0x89b
May 14 12:25:33 nvr kernel:  secondary_startup_64_no_verify+0xc2/0xcb
May 14 12:25:33 nvr kernel: handlers:
May 14 12:25:33 nvr kernel: [<00000000f352a4c4>] amd_gpio_irq_handler [pinctrl_amd]
May 14 12:25:33 nvr kernel: Disabling IRQ #7
amdgpu 0000:06:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x113f00040 flags=0x0070]

Offline

#3 2021-06-08 12:14:54

loqs
Member
Registered: 2014-03-06
Posts: 13,443

Re: Laptop randomly unable to wake from suspend state

Have you read https://gitlab.freedesktop.org/drm/amd/-/issues/1553?
Although that particular issue should already be fixed.  Also look at some of the others mentioning amdgpu_dm_atomic_commit_tail https://gitlab.freedesktop.org/drm/amd/ … ommit_tail
It seems it was only partially fixed,  I was thinking of https://github.com/torvalds/linux/commi … f374409e2a
https://gitlab.freedesktop.org/agd5f/li … 75a0aaa928 has not been merged

Last edited by loqs (2021-06-08 12:37:31)

Offline

#4 2021-06-08 15:38:51

tubize
Member
Registered: 2021-06-07
Posts: 6

Re: Laptop randomly unable to wake from suspend state

Thanks loqs! I didn't stumble on those posts yet, and if I had, I would've probably moved on, seems a bit out of my comfort zone.
This is a good thing however ofcourse, and one of the reasons I moved to Arch, learn new things.
Seems like I will be compiling the kernel then? Or is this a kernel module?
..
I'll start reading smile

Offline

#5 2021-06-08 19:16:53

loqs
Member
Registered: 2014-03-06
Posts: 13,443

Re: Laptop randomly unable to wake from suspend state

Ensure you have configured Makepkg#Parallel_compilation to reduce build time and that base-devel,  git and pacman-contrib are installed

git clone git://git.archlinux.org/svntogit/packages.git --single-branch --branch "packages/linux" #obtain the PKGBUILD
cd packages trunk

Edit the PKGBUILD to add the patch.  Below is a diff of the change.  See Patching_packages#Applying_patches for more details.  The linux package auto applies patches so in this case all that is being done is adding the patch and checksum to the PKGBUILD.

git diff
diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 23d2f96..20786d2 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -17,6 +17,7 @@ options=('!strip')
 _srcname=archlinux-linux
 source=(
   "$_srcname::git+https://git.archlinux.org/linux.git?signed#tag=$_srctag"
+  https://gitlab.freedesktop.org/agd5f/linux/-/commit/260c4c06b9c05265099545fd1be81e75a0aaa928.patch
   config         # the main kernel config file
 )
 validpgpkeys=(
updpkgsums #requires pacman-contrib
makepkg -rsi #build and install package

Offline

#6 2021-06-08 19:49:02

tubize
Member
Registered: 2021-06-07
Posts: 6

Re: Laptop randomly unable to wake from suspend state

Hey!
Wow thanks for those tips!!
Saw your post a little too late and I'm already at the install step of this article
https://wiki.archlinux.org/title/Kernel … stallation

make modules_install

So I will let it run and see what happens.. I took the 5.12.9 sources and manually added the first six commits on this page:
https://gitlab.freedesktop.org/agd5f/li … its/s0ix-8
The reason is, that I was also really disappointed in the standby times of this machine, losing lots of battery % overnight.
Now I might know the reason why (only going into s2idle instead of suspend to ram)

We'll see smile Anyhow will be cool, running my first 'custom' kernel, even if it doesn't fix the problem.
I once compiled a kernel for an Android phone, for my day job, I think it took me a week to get it working.

Edit: installed and running this kernel now. I will check the power useage on stuspend overnight

cat /sys/power/mem_sleep

still reports s2idle [deep]. How can you tell whether your system goes to an S3 state or an S2idle?

See if I get a hangup on wakeup the next days.

Thanks a lot for your help!

Last edited by tubize (2021-06-08 20:40:55)

Offline

#7 2021-06-09 15:15:51

tubize
Member
Registered: 2021-06-07
Posts: 6

Re: Laptop randomly unable to wake from suspend state

Still lost 8% of battery over 11 hours of suspend, on a 51480 mWh battery. Not sure if that's normal and how I can check if the laptop really goes into S3 suspend to ram instead of s2idle?

So far no hangups on wakeup, but I've gone days without one before..

Offline

#8 2021-06-10 12:29:02

davc0n
Member
Registered: 2020-02-01
Posts: 64

Re: Laptop randomly unable to wake from suspend state

Hello,

I have the same wakeup issue. As loqs suggested I am testing the patched kernel and is working well so far the problem persists.

About battery consumption when in suspend state that's less than 1% per hour, so I guess that's okay (don't know for sure though).
If you're interested, to avoid battery drain I use the following systemd service which automatically hibernates the system after a given amount of time in suspend state (eg. 2 hours):

# /etc/systemd/system/suspend-to-hibernate.service

[Unit]
Description=delayed hibernation trigger
Before=suspend.target
StopWhenUnneeded=true
Conflicts=hibernate.target hybrid-suspend.target

[Service]
Type=oneshot
RemainAfterExit=yes

Environment="WAKEALARM=/sys/class/rtc/rtc0/wakealarm"

ExecStart=-/bin/sh -c 'echo -n "alarm set for "; date +%%s -d+2hour | tee $WAKEALARM'

ExecStop=-/bin/sh -c '\
  alarm=$(cat $WAKEALARM); \
  now=$(date +%%s); \
  if [ -z "$alarm" ] || [ "$now" -ge "$alarm" ]; then \
     echo "hibernate triggered"; \
     systemctl hibernate; \
  else \
     echo "normal wakeup"; \
  fi; \
  echo 0 > $WAKEALARM; \
'

[Install]
WantedBy=sleep.target

I'm not the author of this and I don't remember where I took it from, sorry if credits aren't given.

Last edited by davc0n (2021-06-10 18:59:34)

Offline

Board footer

Powered by FluxBB