RE: [PATCH 4.19 11/37] PM: hibernate: Freeze kernel threads in software_resume()

From: Dexuan Cui
Date: Tue May 05 2020 - 12:57:36 EST


> From: Pavel Machek <pavel@xxxxxxx>
> Sent: Tuesday, May 5, 2020 5:10 AM
> To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx; stable@xxxxxxxxxxxxxxx; Dexuan Cui
> <decui@xxxxxxxxxxxxx>; Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> Subject: Re: [PATCH 4.19 11/37] PM: hibernate: Freeze kernel threads in
> software_resume()
>
> Hi!
>
> > commit 2351f8d295ed63393190e39c2f7c1fee1a80578f upstream.
> >
> > 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.
>
> I believe it is too soon to merge this into stable. It is rather big
> hammer. Yes, it is right thing to do. But I'd wait for 5.7 to be
> released before merging it to stable.
>
> It needs some testing and it did not get any.
>
> Best regards,
> Pavel

Hi,
I did do some testing in a Linux VM running on Hyper-V:
Without the patch, I can easily hit the panic I described in the first link
above. With the patch, my Linux VM can hibernate >10K times without
seeing the panic and I don't see any issue caused by the patch.

That being said, I don't mind waiting for 5.7 before we merge the patch
to stable. It would be good for the patch to get more testing from others.

Thanks,
-- Dexuan