Commit 2351f8d2 authored by Dexuan Cui's avatar Dexuan Cui Committed by Rafael J. Wysocki

PM: hibernate: Freeze kernel threads in software_resume()

Currently the kernel threads are not frozen in software_resume(), so
between dpm_suspend_start(PMSG_QUIESCE) and resume_target_kernel(),
system_freezable_power_efficient_wq can still try to submit SCSI
commands and this can cause a panic since the low level SCSI driver
(e.g. hv_storvsc) has quiesced the SCSI adapter and can not accept
any SCSI commands: https://lkml.org/lkml/2020/4/10/47

At first I posted a fix (https://lkml.org/lkml/2020/4/21/1318) trying
to resolve the issue from hv_storvsc, but with the help of
Bart Van Assche, I realized it's better to fix software_resume(),
since this looks like a generic issue, not only pertaining to SCSI.

Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 6a8b55ed
...@@ -898,6 +898,13 @@ static int software_resume(void) ...@@ -898,6 +898,13 @@ static int software_resume(void)
error = freeze_processes(); error = freeze_processes();
if (error) if (error)
goto Close_Finish; goto Close_Finish;
error = freeze_kernel_threads();
if (error) {
thaw_processes();
goto Close_Finish;
}
error = load_image_and_restore(); error = load_image_and_restore();
thaw_processes(); thaw_processes();
Finish: Finish:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment