From: Chen Yu <yu.c.chen@intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Pavel Machek <pavel@ucw.cz>, Len Brown <lenb@kernel.org>,
Linux PM <linux-pm@vger.kernel.org>,
Linux Kernel Mail List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][RFC v5] PM / hibernate: Introduce test_resume mode for hibernation
Date: Fri, 22 Jul 2016 10:25:29 +0800 [thread overview]
Message-ID: <20160722022529.GA5770@sharon> (raw)
In-Reply-To: <9253636.UcfhxActux@vostro.rjw.lan>
On Thu, Jul 21, 2016 at 03:23:32PM +0200, Rafael J. Wysocki wrote:
> On Tuesday, July 19, 2016 08:36:44 AM Chen Yu wrote:
> > test_resume mode is to verify if the snapshot data
> > written to swap device can be successfully restored
> > to memory. It is useful to ease the debugging process
> > on hibernation, since this mode can not only bypass
> > the BIOSes/bootloader, but also the system re-initialization.
> >
> > For example:
> > echo test_resume > /sys/power/disk
> > echo disk > /sys/power/state
> >
> > [ 187.306470] PM: Image saving progress: 70%
> > [ 187.395298] PM: Image saving progress: 80%
> > [ 187.476697] PM: Image saving progress: 90%
> > [ 187.554641] PM: Image saving done.
> > [ 187.558896] PM: Wrote 594600 kbytes in 0.90 seconds (660.66 MB/s)
> > [ 187.566000] PM: S|
> > [ 187.589742] PM: Basic memory bitmaps freed
> > [ 187.594694] PM: Checking hibernation image
> > [ 187.599865] PM: Image signature found, resuming
> > [ 187.605209] PM: Loading hibernation image.
> > [ 187.665753] PM: Basic memory bitmaps created
> > [ 187.691397] PM: Using 3 thread(s) for decompression.
> > [ 187.691397] PM: Loading and decompressing image data (148650 pages)...
> > [ 187.889719] PM: Image loading progress: 0%
> > [ 188.100452] PM: Image loading progress: 10%
> > [ 188.244781] PM: Image loading progress: 20%
> > [ 189.057305] PM: Image loading done.
> > [ 189.068793] PM: Image successfully loaded
> >
> > Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> > ---
> > v5:
> > - Introduce a new function to be shared with software_resume().
> > v4:
> > - Fix some errors and modify the comment for software_resume_unthaw.
> > v3:
> > - As Pavel mentioned, there was a potential risk in previous
> > version that might break the filesystem. According to Rafael's suggestion,
> > this version avoids that issue by restoring the pages with user/kernel
> > threads kept in frozen. Also updated the patch on top of linux-next.
> > ---
> > kernel/power/hibernate.c | 61 ++++++++++++++++++++++++++++++++----------------
> > kernel/power/swap.c | 6 +++++
> > 2 files changed, 47 insertions(+), 20 deletions(-)
> >
> > diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> > index 5f3523e..73ec63c 100644
> > pr_debug("PM: writing image.\n");
> > error = swsusp_write(flags);
> > swsusp_free();
> > - if (!error)
> > + if (hibernation_mode == HIBERNATION_TEST_RESUME)
> > + snapshot_test = true;
> > + if (!error && !snapshot_test)
>
> The above change isn't correct IMO.
>
> If swsusp_write() returns an error, snapshot_test shouldn't be set (that
> basically means "no image", so nothing to test).
>
> So this code should look like
>
> if (!error) {
> if (hibernation_mode == HIBERNATION_TEST_RESUME)
> snapshot_test = true;
> else
> power_down();
>
OK, I'll send another version to fix this, thanks!
Thanks,
Yu
prev parent reply other threads:[~2016-07-22 2:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-19 0:36 [PATCH][RFC v5] PM / hibernate: Introduce test_resume mode for hibernation Chen Yu
2016-07-21 13:23 ` Rafael J. Wysocki
2016-07-22 2:25 ` Chen Yu [this message]
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=20160722022529.GA5770@sharon \
--to=yu.c.chen@intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
/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).