linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dexuan Cui <decui@microsoft.com>
To: Bart Van Assche <bvanassche@acm.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"len.brown@intel.com" <len.brown@intel.com>,
	"pavel@ucw.cz" <pavel@ucw.cz>,
	Michael Kelley <mikelley@microsoft.com>,
	Long Li <longli@microsoft.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"ming.lei@redhat.com" <ming.lei@redhat.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	KY Srinivasan <kys@microsoft.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH] PM: hibernate: Freeze kernel threads in software_resume()
Date: Mon, 27 Apr 2020 00:58:09 +0000	[thread overview]
Message-ID: <HK0P153MB0273B5E4E48EFEF90893972FBFAF0@HK0P153MB0273.APCP153.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <08f28683-4978-3e3c-e85a-303f6e46ef55@acm.org>

> From: Bart Van Assche <bvanassche@acm.org>
> Sent: Sunday, April 26, 2020 11:34 AM
> To: Rafael J. Wysocki <rjw@rjwysocki.net>; Dexuan Cui <decui@microsoft.com>
> >> --- 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?
> 
> Bart.

Hi Bart, Rafael, I would suggest the below comment:

If load_image_and_restore() succeeds, it won't return, and the
execution will be restored from the 'old' kernel's hibernate() -> 
hibernation_snapshot() -> create_image() -> swsusp_arch_suspend(),
and later hibernate() -> thaw_processes() will thaw every frozen
kernel process and userspace process of the 'old' kernel.

Thanks,
-- Dexuan

  reply	other threads:[~2020-04-27  0:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24  3:40 [PATCH] PM: hibernate: Freeze kernel threads in software_resume() 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
2020-04-27  0:58     ` Dexuan Cui [this message]
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=HK0P153MB0273B5E4E48EFEF90893972FBFAF0@HK0P153MB0273.APCP153.PROD.OUTLOOK.COM \
    --to=decui@microsoft.com \
    --cc=bvanassche@acm.org \
    --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;
as well as URLs for NNTP newsgroup(s).