mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>, decui@microsoft.com
Cc: linux-pm@vger.kernel.org, len.brown@intel.com, pavel@ucw.cz,
	mikelley@microsoft.com, longli@microsoft.com,
	linux-kernel@vger.kernel.org, ming.lei@redhat.com,
	wei.liu@kernel.org, sthemmin@microsoft.com,
	haiyangz@microsoft.com, kys@microsoft.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] PM: hibernate: Freeze kernel threads in software_resume()
Date: Sun, 26 Apr 2020 11:33:56 -0700	[thread overview]
Message-ID: <08f28683-4978-3e3c-e85a-303f6e46ef55@acm.org> (raw)
In-Reply-To: <2420808.aENraY2TMt@kreacher>

On 2020-04-26 09:24, Rafael J. Wysocki wrote:
> On Friday, April 24, 2020 5:40:16 AM CEST Dexuan Cui wrote:
>> 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: Bart Van Assche <bvanassche@acm.org>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Dexuan Cui <decui@microsoft.com>
>> ---
>>  kernel/power/hibernate.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
>> index 86aba8706b16..30bd28d1d418 100644
>> --- a/kernel/power/hibernate.c
>> +++ b/kernel/power/hibernate.c
>> @@ -898,6 +898,13 @@ static int software_resume(void)
>>  	error = freeze_processes();
>>  	if (error)
>>  		goto Close_Finish;
>> +
>> +	error = freeze_kernel_threads();
>> +	if (error) {
>> +		thaw_processes();
>> +		goto Close_Finish;
>> +	}
>> +
>>  	error = load_image_and_restore();
>>  	thaw_processes();
>>   Finish:
> 
> Applied as a fix for 5.7-rc4, thanks!

Hi Rafael,

What is not clear to me is how kernel threads are thawed after
load_image_and_restore() has finished? Should a comment perhaps be added
above the freeze_kernel_threads() call that explains how
thaw_kernel_threads() is invoked after load_image_and_restore() has
finished?

Thanks,

Bart.

  reply	other threads:[~2020-04-26 18:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24  3:40 Dexuan Cui
2020-04-26 15:03 ` Sasha Levin
2020-04-26 16:24 ` Rafael J. Wysocki
2020-04-26 18:33   ` Bart Van Assche [this message]
2020-04-27  0:58     ` Dexuan Cui
2020-04-27  8:43     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=08f28683-4978-3e3c-e85a-303f6e46ef55@acm.org \
    --to=bvanassche@acm.org \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=mikelley@microsoft.com \
    --cc=ming.lei@redhat.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=stable@vger.kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®