public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Maitin-Shepard <jbms@cmu.edu>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: david@lang.hm, linux-kernel@vger.kernel.org,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Pavel Machek <pavel@ucw.cz>, "Huang, Ying" <ying.huang@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-pm@lists.linux-foundation.org
Subject: Re: [PATCH 0/2] Kexec jump: The first step to kexec base hibernation
Date: Fri, 13 Jul 2007 12:48:36 -0400	[thread overview]
Message-ID: <87644o1c7v.fsf@jbms.ath.cx> (raw)
In-Reply-To: <200707131745.43055.rjw@sisk.pl> (Rafael J. Wysocki's message of "Fri\, 13 Jul 2007 17\:45\:41 +0200")

"Rafael J. Wysocki" <rjw@sisk.pl> writes:

[snip]

> Okay, I have thought it through and I think that, as an initial step, we can do
> something like this:

> - preload the image-saving kernel before hibernation
> - in the hibernation code path replace device_suspend() with the shutting down
> of
>   all devices without unregistering them (not very nice, but should be
> sufficient
>   for a while)

It seems that the effect of what is done by the current hibernate
implementations is to shutdown all of the devices, but according to
kernel data structures, have it look like the devices were merely
suspended (i.e. device_suspend).  Then in the resume path, the "restore
image" kernel also calls device_suspend just before jumping to the
hibernated kernel, so all of the devices the "restore image" kernel knew
about are in the state device_suspend expects them to be in, except that
they were actually suspended by a different kernel, so they might not be
in quite the right state.  There is also the issue that the "restore
image" kernel might not know about all of the devices; for instance, if
USB support is modular, and, as is likely to be the case, the user
didn't load the USB modules in the "restore image" kernel from an initrd
or something, then the USB devices will actually be powered off, rather
than "suspended".  Despite these apparent discrepancies, it seems that
for many devices (I'm not sure USB devices are included, though),
device_restore happens to do the right thing so that the device is
placed back in the state it needs to be so that the driver can begin
talking to it as it did before, and the device is recognized as the same
device as was there before (since otherwise mounted filesystems backed
by block devices that came back as a different device would cause great
havoc).

Since I recall there being issues with USB devices being recognized as
the same devices post-hibernate-resume, without looking at the code I'm
inclined to believe that the USB drivers still don't end up resuming
from hibernate correctly.

Note that I am describing what is done currently, not what is planned to
be done (i.e. change device_suspend to quiesce and device_resume to
unquiesce).  It seems that ironically, despite everyone believing that
device_suspend/device_resume is incorrect for hibernate, many of the
things that those functions do (like saving the PCI configuration,
perhaps, and then restoring it later, or re-initializing the device) are
actually necessary, especially for modular drivers that won't be loaded
by the "restore image" kernel.

What needs to be done is for the devices to be shut down (or possibly
just quiesced for a select few, but we won't worry about that
complication until later; in the case of the current implementations,
they should all be quiesced rather than shut down), but whatever
information that will be needed later to reinitialize the device
(ideally the reinitialization should be able to handle the device either
being in a quiesced state or completely off) and recognize it as the
same device must be saved.  This probably means they cannot be
"unregistered", as otherwise there would be nothing with which to
associate the saved information.

The resume path needs to use the saved state to reinitialize the device
and recognize it as the same device.  It seems that the existing
reprobing code may not be sufficient for this.  Note that exactly the
same thing must be done on resume for both the current hibernate
implementations and the kexec approach.  It seems that properly
restoring the devices should be relatively easy for the devices that
already get this correct, like IDE devices and basic PCI devices (and
SATA and SCSI devices as well perhaps?), and possibly harder for
Firewire or USB devices.

> - when we've called device_power_down() and save_processor_state(), jump to
>   the image-saving kernel and let it run
> - make the image-saving kernel set up everything, save the image without
>   starting any user space (we may use the existing image-saving code for this
>   purpose, with some modifications) and power off the system (or make it enter
>   S4)

I suppose this has the advantage of not requiring that a
kernel-to-userspace interface be created for this purpose.

> - use the existing restoration code to load the image and jump to the
>   hibernated kernel

This would again avoid the need for a separate userspace-kernelspace
interface for the purpose, so I agree it could be a useful thing to do
initially.

> - in the restore code patch replace device_resume() with the reprobing of all
>   devices.

See my comments above.

-- 
Jeremy Maitin-Shepard

  parent reply	other threads:[~2007-07-13 16:48 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-11 15:30 [PATCH 0/2] Kexec jump: The first step to kexec base hibernation Huang, Ying
2007-07-11 11:13 ` Pavel Machek
2007-07-12  0:22 ` Andrew Morton
2007-07-12  5:48   ` Jeremy Fitzhardinge
     [not found]   ` <1184251423.9346.55.camel@caritas-dev.intel.com>
2007-07-12  7:03     ` david
2007-07-12 12:53     ` Rafael J. Wysocki
2007-07-12 16:32     ` Eric W. Biederman
     [not found]     ` <Pine.LNX.4.64.0707112345250.28090@asgard.lang.hm>
     [not found]       ` <1184260683.9346.91.camel@caritas-dev.intel.com>
2007-07-12 10:10         ` david
2007-07-12 13:01           ` Rafael J. Wysocki
     [not found]           ` <200707121501.03016.rjw@sisk.pl>
2007-07-12 13:22             ` jimmy bahuleyan
2007-07-12 19:03             ` david
2007-07-12 13:55           ` Mark Lord
2007-07-12 19:05             ` david
2007-07-12 14:06           ` Pavel Machek
2007-07-12 17:18       ` Huang, Ying
     [not found]     ` <200707121453.49616.rjw@sisk.pl>
2007-07-12 18:57       ` david
     [not found]       ` <Pine.LNX.4.64.0707121150460.25614@asgard.lang.hm>
2007-07-12 19:34         ` Rafael J. Wysocki
     [not found]         ` <200707122134.29991.rjw@sisk.pl>
2007-07-12 19:55           ` Jeremy Maitin-Shepard
2007-07-13  3:06           ` david
2007-07-13  5:42             ` Hibernating To Swap Considered Harmful Joseph Fannin
2007-07-13  5:57               ` david
2007-07-13  6:20                 ` Joseph Fannin
     [not found]                 ` <20070713062039.GA29055@nineveh.local>
2007-07-13  6:27                   ` david
     [not found]                   ` <Pine.LNX.4.64.0707122319270.25614@asgard.lang.hm>
2007-07-13  7:15                     ` Joseph Fannin
     [not found]                     ` <20070713071512.GB29055@nineveh.local>
2007-07-13 14:35                       ` Jeremy Maitin-Shepard
     [not found]                       ` <87odig1idx.fsf@jbms.ath.cx>
2007-07-17  0:12                         ` Joseph Fannin
     [not found]                         ` <20070717001239.GB20082@nineveh.local>
2007-07-17  5:44                           ` Oliver Neukum
     [not found]                           ` <200707170744.08191.oliver@neukum.org>
2007-07-17  6:28                             ` Joseph Fannin
     [not found]                             ` <20070717062803.GA9069@nineveh.local>
2007-07-17  6:42                               ` david
2007-07-17  7:26                                 ` Joseph Fannin
2007-07-17  7:34                                   ` david
2007-07-17 11:52                                   ` Rafael J. Wysocki
     [not found]                                   ` <Pine.LNX.4.64.0707170030460.19248@asgard.lang.hm>
2007-07-17 11:54                                     ` Rafael J. Wysocki
2007-07-17  7:10                               ` Oliver Neukum
2007-07-13  9:30               ` Rafael J. Wysocki
     [not found]               ` <200707131130.51279.rjw@sisk.pl>
2007-07-14  0:45                 ` Joseph Fannin
     [not found]                 ` <20070714004517.GA18336@nineveh.local>
2007-07-14  9:48                   ` Rafael J. Wysocki
     [not found]                   ` <200707141148.18279.rjw@sisk.pl>
2007-07-16  5:37                     ` Joseph Fannin
2007-07-13  9:29             ` [PATCH 0/2] Kexec jump: The first step to kexec base hibernation Rafael J. Wysocki
     [not found]             ` <200707131129.34974.rjw@sisk.pl>
2007-07-13  9:38               ` david
2007-07-13 11:59                 ` Rafael J. Wysocki
2007-07-13 14:37                   ` Alan Stern
2007-07-13 15:12                   ` Jeremy Maitin-Shepard
     [not found]                   ` <87abu01gnv.fsf@jbms.ath.cx>
2007-07-13 15:45                     ` Rafael J. Wysocki
     [not found]                     ` <200707131745.43055.rjw@sisk.pl>
2007-07-13 15:50                       ` Alan Stern
2007-07-13 16:48                       ` Jeremy Maitin-Shepard [this message]
2007-07-13 21:23                         ` Rafael J. Wysocki
2007-07-14  7:12                   ` david
     [not found]             ` <1184347974.4523.30.camel@caritas-dev.intel.com>
2007-07-13 12:01               ` Rafael J. Wysocki
2007-07-13 17:32             ` Huang, Ying
     [not found]           ` <877ip54cti.fsf@jbms.ath.cx>
2007-07-12 20:45             ` Rafael J. Wysocki
2007-07-13  3:12             ` david
     [not found]             ` <Pine.LNX.4.64.0707122008550.25614@asgard.lang.hm>
2007-07-13  9:17               ` Rafael J. Wysocki
2007-07-13  9:25                 ` david
2007-07-13 11:41                   ` Rafael J. Wysocki
     [not found]                   ` <200707131341.35801.rjw@sisk.pl>
2007-07-14  7:51                     ` david
     [not found]                     ` <Pine.LNX.4.64.0707140017560.25614@asgard.lang.hm>
2007-07-14  8:33                       ` david
     [not found]                       ` <Pine.LNX.4.64.0707140128210.25614@asgard.lang.hm>
2007-07-14  9:24                         ` Rafael J. Wysocki
2007-07-14 20:00                       ` Rafael J. Wysocki
2007-07-14 20:34                         ` david
     [not found]                         ` <Pine.LNX.4.64.0707141257290.14672@asgard.lang.hm>
2007-07-14 21:06                           ` Rafael J. Wysocki
     [not found]                           ` <200707142306.33783.rjw@sisk.pl>
2007-07-14 21:13                             ` david
2007-07-15 10:31                               ` Rafael J. Wysocki
     [not found]                               ` <200707151231.27410.rjw@sisk.pl>
2007-07-15 19:23                                 ` david
2007-07-15 22:59                                   ` Rafael J. Wysocki
     [not found]                                   ` <200707160059.08277.rjw@sisk.pl>
2007-07-15 23:22                                     ` david
     [not found]                                     ` <Pine.LNX.4.64.0707151549200.25614@asgard.lang.hm>
2007-07-16 12:17                                       ` Rafael J. Wysocki
     [not found]                                       ` <200707161417.50166.rjw@sisk.pl>
2007-07-16 14:42                                         ` Huang, Ying
     [not found]                                         ` <1184596950.24143.28.camel@caritas-dev.intel.com>
2007-07-16 15:40                                           ` Rafael J. Wysocki
     [not found]                                           ` <200707161740.26703.rjw@sisk.pl>
2007-07-17  4:18                                             ` david
2007-07-17 11:46                                               ` Rafael J. Wysocki
2007-07-14 21:34                         ` david
2007-07-15 10:39                           ` Rafael J. Wysocki
     [not found]                           ` <200707151239.28400.rjw@sisk.pl>
2007-07-15 19:33                             ` david
     [not found]                             ` <Pine.LNX.4.64.0707151224160.25614@asgard.lang.hm>
2007-07-15 23:11                               ` Rafael J. Wysocki
     [not found]                               ` <200707160111.16805.rjw@sisk.pl>
2007-07-15 23:33                                 ` david
     [not found]     ` <m14pk9fuqa.fsf@ebiederm.dsl.xmission.com>
2007-07-12 19:09       ` david
2007-07-12 19:49         ` Eric W. Biederman
     [not found]       ` <1184368525.1069.68.camel@caritas-dev.intel.com>
2007-07-13 16:43         ` Eric W. Biederman
     [not found]         ` <m1k5t4dzl4.fsf@ebiederm.dsl.xmission.com>
2007-07-14  5:48           ` Huang, Ying
     [not found]           ` <1184392129.1898.69.camel@caritas-dev.intel.com>
2007-07-14  9:59             ` Rafael J. Wysocki
2007-07-14 10:55               ` Huang, Ying
     [not found]               ` <1184410554.1898.84.camel@caritas-dev.intel.com>
2007-07-14 19:16                 ` Rafael J. Wysocki
     [not found]                 ` <200707142116.10237.rjw@sisk.pl>
2007-07-15  9:30                   ` Huang, Ying
     [not found]                   ` <1184491804.1898.121.camel@caritas-dev.intel.com>
2007-07-15 10:49                     ` Rafael J. Wysocki
2007-07-17  8:13                     ` david
     [not found]                     ` <Pine.LNX.4.64.0707170101010.19248@asgard.lang.hm>
2007-07-17 11:59                       ` Rafael J. Wysocki
2007-07-17 12:48                       ` Huang, Ying
     [not found]                       ` <1184676518.10998.34.camel@caritas-dev.intel.com>
2007-07-17 14:22                         ` Rafael J. Wysocki
2007-07-18  0:25                           ` david
2007-07-13 23:15       ` Huang, Ying
2007-07-12 12:38   ` Rafael J. Wysocki
2007-07-12 14:43   ` Huang, Ying
     [not found]   ` <4695C096.5080400@goop.org>
2007-07-12  6:43     ` david
2007-07-12 12:46       ` Rafael J. Wysocki
     [not found]       ` <200707121446.14170.rjw@sisk.pl>
2007-07-12 13:51         ` Mark Lord
     [not found]         ` <469631FA.2070405@rtr.ca>
2007-07-12 14:49           ` Pavel Machek
2007-07-12 15:35           ` Rafael J. Wysocki
     [not found]           ` <200707121735.40077.rjw@sisk.pl>
2007-07-12 16:03             ` Mark Lord
     [not found]             ` <469650DE.4000901@rtr.ca>
2007-07-12 16:35               ` Mark Lord
     [not found]               ` <46965837.8030907@rtr.ca>
2007-07-12 20:05                 ` Jeremy Maitin-Shepard
     [not found]                 ` <87y7hl2xro.fsf@jbms.ath.cx>
2007-07-13  2:38                   ` Mark Lord
2007-07-12 16:09           ` Alan Stern
2007-07-12 18:49           ` david
2007-07-12 18:42         ` david
     [not found]         ` <Pine.LNX.4.64.0707121138140.25614@asgard.lang.hm>
     [not found]           ` <200707122120.19662.rjw@sisk.pl>
2007-07-12 19:14             ` david
     [not found]             ` <Pine.LNX.4.64.0707121210210.25614@asgard.lang.hm>
2007-07-12 19:45               ` Rafael J. Wysocki
2007-07-12 19:20           ` Rafael J. Wysocki
     [not found]     ` <1184260174.9346.85.camel@caritas-dev.intel.com>
2007-07-12 12:47       ` Rafael J. Wysocki
2007-07-12 17:09     ` Huang, Ying
     [not found] ` <20070711111350.GI7091@elf.ucw.cz>
     [not found]   ` <1184257734.9346.76.camel@caritas-dev.intel.com>
2007-07-12  8:54     ` Pavel Machek
     [not found]     ` <20070712085428.GA1866@elf.ucw.cz>
2007-07-13 23:18       ` Huang, Ying
2007-07-12 16:28   ` Huang, Ying
     [not found] <Pine.LNX.4.44L0.0707131146340.2555-100000@iolanthe.rowland.org>
2007-07-13 16:54 ` Eric W. Biederman
2007-07-13 18:15   ` Alan Stern
2007-07-13 20:55 ` Rafael J. Wysocki
     [not found] <Pine.LNX.4.44L0.0707131402001.2684-100000@iolanthe.rowland.org>
2007-07-13 21:08 ` Rafael J. Wysocki
     [not found] <200707151249.26148.rjw@sisk.pl>
2007-07-24 14:00 ` Huang, Ying
     [not found] <9D7649D18729DE4BB2BD7B494F7FEDC236CF66@pdsmsx415.ccr.corp.intel.com>
2007-07-24 15:27 ` 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=87644o1c7v.fsf@jbms.ath.cx \
    --to=jbms@cmu.edu \
    --cc=akpm@linux-foundation.org \
    --cc=david@lang.hm \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=ying.huang@intel.com \
    /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