All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Kyle Moffett <mrmacman_g4@mac.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>,
	David Chinner <dgc@sgi.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	xfs-masters@oss.sgi.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Len Brown <lenb@kernel.org>
Subject: Re: freeze vs freezer
Date: Wed, 28 Nov 2007 00:01:59 +0100	[thread overview]
Message-ID: <200711280002.00755.rjw@sisk.pl> (raw)
In-Reply-To: <8B00F353-983F-40E7-931B-EA73CCD32F0A@mac.com>

On Tuesday, 27 of November 2007, Kyle Moffett wrote:
> On Nov 27, 2007, at 12:40:24, Rafael J. Wysocki wrote:
> > On Tuesday, 27 of November 2007, Matthew Garrett wrote:
> >> On Mon, Nov 26, 2007 at 10:53:34PM +0100, Rafael J. Wysocki wrote:
> >>> On Monday, 26 of November 2007, David Chinner wrote:
> >>>> So how do you handle threads that are blocked on I/O or a lock  
> >>>> during the system freeze process, then?
> >>>
> >>> We wait until they can continue.
> >>
> >> So if I have a process blocked on an unavilable NFS mount, I can't
> >> suspend?
> >
> > That's correct, you can't.
> >
> > [And I know what you're going to say. ;-)]
> 
> Why exactly does suspend/hibernation depend on "TASK_INTERRUPTIBLE"  
> instead of a zero preempt_count()?  Really what we should do is just  
> iterate over all of the actual physical devices and tell each one  
> "Block new IO requests preemptably, finish pending DMA, put the  
> hardware in low-power mode, and prepare for suspend/hibernate".  As  
> long as each driver knows how to do those simple things we can have  
> an entirely consistent kernel image for both suspend and for  
> hibernation.

Well, this is more-or-less how we all imagine that should be done eventually.

The main problem is how to implement it without causing too much breakage.
Also, there are some dirty details that need to be taken into consideration.

> When all tasks are preemptable we can very trivially rely on the  
> drivers to enforce the "Stop new IO submission" with a dirt-simple  
> semaphore or waitqueue.  The sleep itself will be  
> TASK_UNINTERRUPTIBLE, but it will be done from a preemptible context.

If there are any drivers that make their devices available via mmap(), that
won't be sufficient.

Probably, we'll need a two iterations over devices to handle all corner cases.

Moreover, for hibernation we need to resume at least some devices in order
to save the image, which shouldn't result in unblocking the waiting tasks.

> That way the system suspend time is the sum of the suspend times of  
> the devices on the system, and the suspend time of any given device  
> is the sum of its maximum non-preemptible critical section and the  
> time to flush all of its remaining pending DMA/etc.  This is almost  
> completely independent of the load-level of the machine, and it does  
> not depend on things like NFS filesystems.  The one gotcha is that it  
> does not flush dirty filesystem pages to disk first, although that  
> could be fixed with a few VFS and blockdev hooks which hierarchically  
> flush and "freeze" block devices and filesystems before actually  
> disabling devices much the way that device-mapper can pause a device  
> to take a snapshot and end up with a clean journal on the filesystem  
> afterwards.

Yes, I generally agree.

Greetings,
Rafael

  reply	other threads:[~2007-11-27 22:44 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-22  3:54 freeze vs freezer Jeremy Fitzhardinge
2007-11-23 23:47 ` Rafael J. Wysocki
2007-11-26 18:44   ` Jeremy Fitzhardinge
2007-11-26 21:20     ` Rafael J. Wysocki
2007-11-26 21:17   ` David Chinner
2007-11-26 21:53     ` Rafael J. Wysocki
2007-11-27  5:38       ` Matthew Garrett
2007-11-27 17:40         ` Rafael J. Wysocki
2007-11-27 20:33           ` Kyle Moffett
2007-11-27 23:01             ` Rafael J. Wysocki [this message]
2007-11-27 22:49               ` Jeremy Fitzhardinge
2007-11-27 23:14                 ` Kyle Moffett
2007-11-27 23:32                   ` Jeremy Fitzhardinge
2008-01-02 16:02             ` Pavel Machek
2008-01-02 21:30               ` Nigel Cunningham
2008-01-02 22:04                 ` Rafael J. Wysocki
2008-01-03  9:19                   ` Nigel Cunningham
2008-01-03  9:47                     ` Oliver Neukum
2008-01-03  9:52                       ` Nigel Cunningham
2008-01-03 11:15                         ` Oliver Neukum
2008-01-03 22:06                           ` Nigel Cunningham
2008-01-04 20:54                             ` Oliver Neukum
2008-01-05  1:38                               ` Kyle Moffett
2008-01-05 21:18                               ` Pavel Machek
2008-01-05 23:01                                 ` Nigel Cunningham
2008-01-03 22:31                     ` Rafael J. Wysocki
2008-06-23  7:16             ` Pavel Machek
2008-06-23 14:00               ` Henrique de Moraes Holschuh
2008-06-24  8:08                 ` Elias Oltmanns
2008-06-26 15:09                   ` Pavel Machek
2008-06-29 22:12                     ` [xfs-masters] " Dave Chinner
2008-06-29 23:22                       ` Rafael J. Wysocki
2008-06-30  6:11                         ` Christoph Hellwig
2008-06-30 20:34                           ` Rafael J. Wysocki
2008-07-03 19:43                             ` Eric Sandeen
2008-06-30  6:29                         ` Dave Chinner
2008-06-30  6:37                           ` Jeremy Fitzhardinge
2008-06-30 12:33                             ` Dave Chinner
2008-06-30 21:00                               ` Rafael J. Wysocki
2008-06-30 22:21                                 ` Dave Chinner
2008-06-30 22:38                                   ` Rafael J. Wysocki
2008-07-01  6:38                                     ` Dave Chinner
2008-07-01 14:35                                       ` Rafael J. Wysocki
2008-07-01 15:05                                         ` Elias Oltmanns
2008-07-01 15:17                                           ` Christoph Hellwig
2008-07-01 21:15                                           ` Dave Chinner
2008-07-01 21:46                                             ` Elias Oltmanns
2008-07-01 21:12                                         ` Dave Chinner
2008-07-01 21:21                                           ` Rafael J. Wysocki
2008-07-01  8:59                             ` Pavel Machek

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=200711280002.00755.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=dgc@sgi.com \
    --cc=jeremy@goop.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=mrmacman_g4@mac.com \
    --cc=xfs-masters@oss.sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.