[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0906262106490.2995-100000@netrider.rowland.org>
Date: Fri, 26 Jun 2009 21:25:49 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: "Rafael J. Wysocki" <rjw@...k.pl>
cc: Greg KH <gregkh@...e.de>, LKML <linux-kernel@...r.kernel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Linux-pm mailing list <linux-pm@...ts.linux-foundation.org>,
Ingo Molnar <mingo@...e.hu>,
Arjan van de Ven <arjan@...radead.org>
Subject: Re: [patch update] PM: Introduce core framework for run-time PM of
I/O devices (rev. 6)
On Sat, 27 Jun 2009, Rafael J. Wysocki wrote:
> > Speaking of races, have you noticed that the way power.work_done gets
> > used is racy?
>
> Not really. :-)
>
> > You can't wait for the completion before releasing the
> > lock, but then anything could happen.
> >
> > A safer approach would be to use a wait_queue.
>
> I'm not sure what you mean exactly. What's the race?
Somebody calls pm_runtime_suspend when a suspend is already in
progress. The routine sees that the status is RPM_SUSPENDING, so it
prepares to wait until the suspend is finished. It drops the lock and
calls wait_for_completion.
But in between those last two steps, the suspend could finish and
a resume could start up. Then the wait_for_completion wouldn't return
until the device was fully resumed!
Now I admit this isn't as bad as it sounds. The same sort of thing
could happen even if there weren't two suspends going on at the same
time; a resume could occur between when the routine drops the lock and
when it returns. So okay, forget I mentioned it.
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