lkml.org 
[lkml]   [2011]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/3] PM / Runtime: Don't run callbacks under lock for power.irq_safe set
Date
On Tuesday, September 27, 2011, Kevin Hilman wrote:
> "Rafael J. Wysocki" <rjw@sisk.pl> writes:
>
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> >
> > The rpm_suspend() and rpm_resume() routines execute subsystem or PM
> > domain callbacks under power.lock if power.irq_safe is set for the
> > given device. This is inconsistent with that rpm_idle() does after
> > commit 02b2677 (PM / Runtime: Allow _put_sync() from
> > interrupts-disabled context) and is problematic for subsystems and PM
> > domains wanting to use power.lock for synchronization in their
> > runtime PM callbacks.
> >
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
>
> The part described here looks right, and is much better for consistency.
>
> Reviewed-by: Kevin Hilman <khilman@ti.com>
>
> but...
>
> [...]
>
> > @@ -347,6 +353,15 @@ static int rpm_suspend(struct device *de
> > goto out;
> > }
> >
> > + if (dev->power.irq_safe) {
> > + spin_unlock(&dev->power.lock);
> > +
> > + cpu_relax();
> > +
> > + spin_lock(&dev->power.lock);
> > + goto repeat;
> > + }
> > +
>
>
> ... AFAICT, this isn't directly related to the problem described in the
> changelog (or at least I didn't find it obvious),

It is related. Whether or not it's obvious, I'm not sure. :-)

The problem is that after the changes in __rpm_callback() another CPU may start
executing the same routine for the same device if dev->power.irq_safe is set
(previously, it would block on the dev's power.lock) and it may see
dev->power.runtime_status == RPM_RESUMING or
dev->power.runtime_status == RPM_SUSPENDING, while previously, it wouldn't
reach the relevant code. Thus we have to modify that code to take
the dev->power.irq_safe case into account.

> and probably deserves a comment in the code as well.

Well, the comment in the code would explain why the commit did what it did,
but it wouldn't be very useful afterwards IMHO.

Perhaps I'll simply add some explanation to the changelog.

Thanks,
Rafael


\
 
 \ /
  Last update: 2011-09-27 19:17    [W:0.089 / U:7.460 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site