Joined: 17 Feb 2018
|Posted: Sat Feb 17, 2018 8:41 pm Post subject: Busy Kernel Work Queue Prevents Suspend to RAM
|When I run pm-suspend or s2ram -f, sometimes suspending works perfectly, and sometimes
the screen shuts off, but nothing is suspended and I need to reboot to get access to the
system, clearing dmesg from the previous boot, so I don't have access to those logs.
Other times, s2ram fails with the message "s2ram_do: Device or resource busy" (and
the equivalent pm-suspend, if run, fails, returning "128" as an error code), and both
processes exit (without borking my display, thankfully). When that happens, the linux kernel
displays this error message (retrieved from dmesg):
|[ 438.727794] PM: Syncing filesystems ... done.
[ 438.739507] PM: Preparing system for sleep (mem)
[ 440.220675] Freezing user space processes ... (elapsed 0.002 seconds) done.
[ 440.222957] Freezing remaining freezable tasks ...
[ 460.225315] Freezing of tasks failed after 20.002 seconds (0 tasks refusing to freeze, wq_busy=1):
[ 460.225318] Showing busy workqueues and worker pools:
[ 460.225327] workqueue writeback: flags=0x4e
[ 460.225329] pwq 8: cpus=0-3 flags=0x4 nice=0 active=0/0
[ 460.225345] delayed: wb_workfn, wb_workfn
[ 460.225378] workqueue usb_hub_wq: flags=0x4
[ 460.225382] pwq 2: cpus=1 node=0 flags=0x0 nice=0 active=2/0
[ 460.225393] in-flight: 4913:hub_event hub_event
[ 460.225421] workqueue vmstat: flags=0xc
[ 460.225424] pwq 2: cpus=1 node=0 flags=0x0 nice=0 active=0/0
[ 460.225434] delayed: vmstat_update
[ 460.225449] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=0/0
[ 460.225459] delayed: vmstat_update
[ 460.225486] pool 2: cpus=1 node=0 flags=0x0 nice=0 hung=20s workers=3 idle: 5754 3929
[ 460.225698] Restarting kernel threads ... done.
[ 460.226128] Restarting tasks ... done.
If it helps, I'm working with a ThinkPad T560, the TPM is disabled in BIOS (though disabling it
didn't change anything), and here's the output of $(uname -rp):
4.9.76-gentoo-r1 Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
Also, here's my kernel config: lukasyoder.com/kernelconfig
Been trying to get suspending to work reliably for a few days now and finally decided to turn to the forums
for help. If any of you can help fix this, I will be forever grateful
[Moderator edit: added [code] tags to preserve output layout. -Hu]
Edit: Suspending to RAM always works and resumes properly the first time it is done after boot,
but all subsequent tries are a roll of the dice.
Update: Here were some unsuccessful attempts I made at fixing the problem:
I made the kernel preemptive (CONFIG_PREEMPT=y) and enabled the work queue power efficient mode (CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y), however those haven't fixed the problem.