> On Mon, 7 Jan 2008, Rafael J. Wysocki wrote:
>
> > On Monday, 7 of January 2008, Alan Stern wrote:
> > > On Mon, 7 Jan 2008, Rafael J. Wysocki wrote:
> > >
> > > > Please see the patch at:
http://lkml.org/lkml/2008/1/6/298 . It represents my
> > > > current idea about how to do that.
> > >
> > > It has some problems.
> > >
> > > First, note that the list manipulations in dpm_suspend(),
> > > device_power_down(), and so on aren't protected by dpm_list_mtx. So
> > > your patch could corrupt the list pointers.
> >
> > Yes, they need the locking. I have overlooked that, mostly because the locking
> > was removed by gregkh-driver-pm-acquire-device-locks-prior-to-suspending.patch
> > too (because you assumed there woundn't be any need to remove a device during
> > a suspend, right?).
>
> Right.
>
> > > Are you assuming that no other threads can be running at this time?
> >
> > No, I'm not.
> >
> > > Note also that device_pm_destroy_suspended() does up(&dev->sem), but it
> > > doesn't know whether or not dev->sem was locked to begin with.
> >
> > Do you mean it might have been released already by another thread
> > calling device_pm_destroy_suspended() on the same device?
>
> I was thinking that it might be called before lock_all_devices().