[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0707041030540.25704-100000@netrider.rowland.org>
Date: Wed, 4 Jul 2007 10:38:47 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Matthew Garrett <mjg59@...f.ucam.org>
cc: linux-kernel@...r.kernel.org, <linux-pm@...ts.linux-foundation.org>
Subject: Re: [linux-pm] [PATCH] Remove process freezer from suspend to RAM
pathway
On Tue, 3 Jul 2007, Matthew Garrett wrote:
> On Tue, Jul 03, 2007 at 06:21:42PM -0400, Alan Stern wrote:
> > On Tue, 3 Jul 2007, Matthew Garrett wrote:
> > > We're used to the idea of applications blocking when a resource they're
> > > using goes away - NFS has done it forever.
> >
> > You persist in evading my point. I'm not worried about applications;
> > I'm worried about drivers.
> >
> > Let me put it explicitly: You're writing a driver. You're working on
> > the read, write, or probe method. You add code to check if a system
> > sleep is underway. Suppose the answer is Yes -- what does your driver
> > do next?
>
> Leave the process blocked and defer any i/o until after resume. Why does
> it need to be any more complicated than that?
(1) The driver will undoubtedly hold some mutex or semaphore at the
time it checks whether a system sleep is underway. You will have to
drop it before blocking and then reacquire it afterward.
(2) The driver may have been called by some other routine which holds a
mutex needed for resuming the device. In this case the driver _can't_
drop the mutex and so the resume will deadlock.
Okay, I agree that (1) can be handled without too much effort. But
doing it adds an extra test to _every_ driver's I/O pathway. Freezing
userspace does not incur all this additional overhead.
(2) shouldn't arise during normal read and write operations, but it
certainly _will_ arise during probe.
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