lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1205132212070.5628-100000@netrider.rowland.org>
Date:	Sun, 13 May 2012 22:25:08 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Bojan Smojver <bojan@...ursive.com>
cc:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	Linux PM list <linux-pm@...r.kernel.org>,
	Kernel development list <linux-kernel@...r.kernel.org>,
	<bp@...en8.de>
Subject: Re: [PATCH]: In kernel hibernation, suspend to both

On Mon, 14 May 2012, Bojan Smojver wrote:

> On Mon, 2012-05-14 at 05:02 +0530, Srivatsa S. Bhat wrote:
> > This is the point where your patch gets scary - Suspend is not carried
> > out in its fullest sense; instead you jump directly to
> > suspend_devices_and_enter(). Luckily, most of the things that happen
> > before this are common between suspend and hibernation. However, one
> > thing that really stands out is the notifications: if you directly
> > call suspend_devices_and_enter(), we end up missing the
> > PM_SUSPEND_PREPARE notifications.
> 
> I'm guessing because at the point of suspend to RAM here, we are not
> really doing the real, full suspend to RAM, things would be different.
> At this point, not the whole system is alive - most of it is frozen.
> Only devices required for image writing are alive. Or maybe I'm
> misunderstanding the hibernation process...

Yes, you misunderstand it.  It's documented pretty thoroughly in
Documentation/power/devices.txt and there's a fair amount of kerneldoc
in include/linux/pm.h.  After the memory image has been prepared,
_every_ device goes back to full functionality before the image gets
written out (with maybe a few platform-specific exceptions).

> > And there is no guarantee that everybody implements the same thing for
> > both PM_SUSPEND_PREPARE and PM_HIBERNATION_PREPARE notifications. That
> > is the reason I don't think it is safe.
> 
> OK.
> 
> So, you would do:
> 
> - prepare for hibernation (includes suspension of devices)

No, devices are not suspended -- they are "frozen".  There's a
difference (frozen devices are supposed to remain at full power).

> - resume devices involved in image writing

Resume all devices.  Except that it's not called "resume"; it's called 
"thaw" -- the reverse of freezing.

> - write image
> - prepare for suspend
> - suspend to RAM
> - resume from RAM
> - post suspend from RAM

It's not clear what you mean by this last step.

> - unwind unsuccessful hibernation

Not exactly.  For example, the devices are already back at full power 
so they don't need any "unwinding".  Basically you just have to 
invalidate the hibernation image stored on disk and unfreeze the tasks.

> Isn't that going to confuse devices involved in image writing even more
> by essentially executing post-resume twice (once for suspend to RAM,
> once for hibernation)?

Not if you do it as described above.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ