From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pm@lists.linux-foundation.org
Subject: Re: Re: Suspend without the freezer
Date: Wed, 1 Aug 2007 21:08:23 +0200 [thread overview]
Message-ID: <200708012108.24061.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0708011013260.3764-100000@iolanthe.rowland.org>
On Wednesday, 1 August 2007 16:33, Alan Stern wrote:
> On Wed, 1 Aug 2007, Paul Mackerras wrote:
>
> > Alan Stern writes:
> >
> > > I think this is subject to the same weakness Dmitry mentions: By the
> > > time the driver would block on the new rwsem, it has already started
> > > mucking with the device. Worse yet, it may hold a mutex that the
> > > suspend method needs, thereby deadlocking the suspend. (That's what
> > > would happen with serio->drv_mutex in the input layer.)
> > >
> > > Maybe the best answer is simply to fail all attempts at device
> > > registration while a suspend is underway. At least that is a known
> > > error path which drivers are prepared (in theory) to deal with. It
> > > could be implemented quite easily with an rwsem, by making the
> > > registration code use down_read_trylock.
> >
> > What about making a list of devices that drivers have attempted to
> > register? While the system is suspending, if a driver attempts to
> > register a device, put it on a list and return success. Then, after
> > resuming, run through the list and actually process them.
>
> I'm not sure it's safe to lie to drivers, telling them that their
> device has been registered when in fact it hasn't. For instance, what
> if the driver then calls device_create_file()? Safe or not, it
> certainly isn't transparent and therefore isn't a good thing to do.
I agree.
I'm always cautious about things like that, because they almost certainly
break someone's assumptions.
> Of course, the problem with my approach is that it puts the burden on
> drivers of blocking threads which want to register devices. This turns
> out to be distressingly difficult -- easier just to let them fail. I
> was hoping to find a centralized solution but apparently there isn't
> one.
>
> A better approach would be to fail registrations only if the parent is
> already suspended. Maybe that can be made to work... but I'm doubtful.
> (What if the parent gets suspended _during_ the child's registration?)
>
> > I guess removal during suspend/resume should remove the list entry, if
> > the device is one of the ones on the list. Otherwise, is there a
> > problem with letting removals proceed during suspend/resume? (In
> > general removal can be notified after the device has physically
> > disappeared IIRC, so driver unbind functions have to avoid touching
> > the device or at least be prepared to deal with it not responding.)
>
> I don't think removal during suspend poses a serious problem. It can
> never lead to a situation where a suspended parent has an unsuspended
> child, which is what we need to avoid.
With our current design, removal during resume, before the device is put back
onto dpm_active, may lead to nasty problems. I haven't analysed that in
detail, but at least generally it seems highly suspicious to me.
Greetings,
Rafael
--
"Premature optimization is the root of all evil." - Donald Knuth
next prev parent reply other threads:[~2007-08-01 19:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-30 20:48 Suspend without the freezer Alan Stern
2007-07-31 3:52 ` Dmitry Torokhov
2007-07-31 9:05 ` Rafael J. Wysocki
2007-07-31 15:24 ` Alan Stern
2007-07-31 19:08 ` Rafael J. Wysocki
2007-07-31 20:48 ` [RFC 1/2] PM: merge drivers/base/power/{main, suspend, resume}.c Alan Stern
2007-07-31 22:15 ` Rafael J. Wysocki
2007-07-31 20:51 ` [RFC 2/2] PM: Lock all devices during suspend/hibernate Alan Stern
2007-07-31 22:20 ` Rafael J. Wysocki
2007-08-01 14:11 ` Alan Stern
2007-08-01 15:37 ` Rafael J. Wysocki
2007-08-01 17:58 ` Alan Stern
2007-08-01 18:59 ` Rafael J. Wysocki
2007-08-01 3:50 ` Re: Suspend without the freezer Paul Mackerras
2007-08-01 14:33 ` Alan Stern
2007-08-01 19:08 ` Rafael J. Wysocki [this message]
2007-08-01 20:16 ` Alan Stern
2007-07-31 14:58 ` Alan Stern
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=200708012108.24061.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-pm@lists.linux-foundation.org \
--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