public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <ncunningham@cyclades.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Linux-pm mailing list <linux-pm@lists.osdl.org>,
	Pavel Machek <pavel@ucw.cz>
Subject: Re: Problems with PM_FREEZE
Date: Wed, 28 Sep 2005 13:27:25 +1000	[thread overview]
Message-ID: <1127877808.4802.74.camel@localhost> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0509272236580.15378-100000@netrider.rowland.org>

[-- Attachment #1: Type: text/plain, Size: 2893 bytes --]

Hi Alan.

On Wed, 2005-09-28 at 12:58, Alan Stern wrote:
> On Wed, 28 Sep 2005, Nigel Cunningham wrote:
> 
> > Yes, that's true. If the usb modules are loaded when suspending and not
> > loaded when resuming or vice versa, you'll get inconsistencies:
> > 
> > State at suspend	State at resume		Image state
> > 
> > Built in		Built in		Freeze->Freeze
> > Loaded modules	Unloaded modules	Undefined->Freeze
> > Unloaded modules	Loaded modules		Freeze->Undefined
> 
> This table is misleading.  Better to describe it like this:
> 
> 	If the image doesn't contain USB drivers, the device state
> 	doesn't matter.
> 
> 	If the image does contain USB drivers and the boot kernel
> 	did not meddle with the device states, then the devices
> 	will be suspended even though the image thinks they are
> 	frozen.

So a power off or reboot doesn't reset the USB devices?

> 	If the image does contain USB drivers and the boot kernel
> 	did meddle with the device states, then the devices probably
> 	will not be resumable by the image kernel.  They will have
> 	to be rediscovered.

Even if frozen? They should end up in the same state. But then USB
suspend/resume hasn't worked reliably for me, so I'm still in
unload-usb-while-suspending mode.

> > I guess there are three possible solutions:
> > 1) Leave things as they are and say it is the user's problem if they
> > make the state inconsistent.
> > 2) Keep knowledge of the device states across the atomic restore and use
> > that information in deciding what to do in device resume/powerup.
> > 3) Make device drivers handle the situation properly without knowledge
> > of what state the hardware is really in (or check the real state - where
> > possible - and rely on that in deciding what to do).
> > 
> > 2 seems to me to make for the most reliable solution.
> 
> No.  The best answer is to
> 
> 	(A) tell the boot kernel that the impending freeze is for a
> 	restore-from-disk, so that it can wipe out the state of any
> 	devices it has changed, and
> 
> 	(B) tell the image kernel that it is resuming from disk, so
> 	that it can know that the devices are really suspended even
> 	though its internal records say they are frozen.

But if the drivers are loaded, we will tell them to freeze, so the state
will be frozen.

> Better than (A) would be to tell the boot kernel that it _is_ only a boot 
> kernel, so that its drivers will know not to mess up the state of any 
> devices.  This would have the side effect of making it impossible to 
> reload an image from a USB drive, but that's pretty much unavoidable 
> anyway.

I would like to be able to get suspend to and resuming from usb going at
some stage. No chance?

The problem with telling the kernel it is only a boot kernel is that we
don't know that until we look and see if there's an image, which may
involve running an initramfs/initrd first (encryption, eg).

Regards,

Nigel



[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2005-09-28  3:27 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-24  2:09 Problems with PM_FREEZE Alan Stern
2005-09-27 12:26 ` Pavel Machek
2005-09-27 19:02   ` Alan Stern
2005-09-27 19:58     ` Pavel Machek
2005-09-27 20:25       ` Alan Stern
2005-09-27 20:32         ` Pavel Machek
2005-09-27 21:30     ` Nigel Cunningham
2005-09-27 22:01       ` Pavel Machek
2005-09-27 23:19         ` Nigel Cunningham
2005-09-28  2:58           ` Alan Stern
2005-09-28  3:27             ` Nigel Cunningham [this message]
2005-09-28 15:46               ` David Brownell
2005-09-28 16:17               ` Alan Stern
2005-09-28 20:53                 ` Pavel Machek
2005-09-28 21:15                   ` Alan Stern
2005-09-28 21:18                     ` Pavel Machek
2005-09-28 21:20                   ` David Brownell
2005-09-28 21:22                     ` Pavel Machek
2005-09-28 13:03             ` Pavel Machek
2005-09-29 15:45               ` Alan Stern
2005-09-29 17:12                 ` David Brownell
2005-09-29 17:31                   ` Pavel Machek
2005-09-29 18:22                     ` David Brownell
2005-09-29 19:01                       ` Rafael J. Wysocki
2005-09-29 17:49                   ` Alan Stern
2005-09-28 13:04           ` Pavel Machek
2005-09-28 13:51             ` Rafael J. Wysocki
2005-09-28 18:54               ` Alan Stern
2005-09-28 19:09                 ` Rafael J. Wysocki
2005-09-28 19:31                   ` Alan Stern
2005-09-28 20:51                     ` Pavel Machek
2005-09-28 21:13                       ` Alan Stern
2005-09-28 21:19                         ` Pavel Machek
2005-09-28 21:56                     ` Rafael J. Wysocki
2005-09-28 22:01                       ` Pavel Machek
2005-09-28 22:14                         ` Rafael J. Wysocki
2005-09-28 20:51                 ` Pavel Machek
2005-09-28 21:08                   ` David Brownell
2005-09-28 21:13                     ` Pavel Machek
2005-09-28 21:12                   ` Alan Stern
2005-09-28 15:28         ` David Brownell

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=1127877808.4802.74.camel@localhost \
    --to=ncunningham@cyclades.com \
    --cc=linux-pm@lists.osdl.org \
    --cc=pavel@ucw.cz \
    --cc=stern@rowland.harvard.edu \
    /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