lkml.org 
[lkml]   [2008]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH] PM: Acquire device locks on suspend
    Date
    On Sunday, 6 of January 2008, Rafael J. Wysocki wrote:
    > On Sunday, 6 of January 2008, Rafael J. Wysocki wrote:
    > > On Sunday, 6 of January 2008, Alan Stern wrote:
    > > > On Sun, 6 Jan 2008, Rafael J. Wysocki wrote:
    > > >
    > > > > > If you can figure out a way to disable the warning in device_del() for
    > > > > > just the one device being unregistered by
    > > > > > device_pm_destroy_suspended(),
    > > > >
    > > > > Something like this, perhaps:
    > > > >
    > > > > @@ -905,6 +915,18 @@ void device_del(struct device * dev)
    > > > > struct device * parent = dev->parent;
    > > > > struct class_interface *class_intf;
    > > > >
    > > > > + if (down_trylock(&dev->sem)) {
    > > > > + if (pm_sleep_lock()) {
    > > > > + dev_warn(dev, "Illegal %s during suspend\n",
    > > > > + __FUNCTION__);
    > > > > + dump_stack();
    > > > > + } else {
    > > > > + pm_sleep_unlock();
    > > > > + }
    > > > > + } else {
    > > > > + up(&dev->sem);
    > > > > + }
    > > > > +
    > > > > if (parent)
    > > > > klist_del(&dev->knode_parent);
    > > > > if (MAJOR(dev->devt))
    > > >
    > > > Bizarre, but it should work.
    > >
    > > OK
    > >
    > > Still, shouldn't we fail the removal of the device apart from giving the
    > > warning?
    >
    > Actually, having thought about it a bit more, I don't see the point in
    > preventing the removal of the device from the list in device_pm_remove() if
    > we allow all of the operations in device_del() preceding it to be performed.
    >
    > Shouldn't we just take pm_sleep_rwsem in device_del() upfront and block on that
    > if locked?

    Ugh, the $subject patch looks like a city of races. I'm struggling to close
    them all, but it's getting complicated.

    I'll post the result in a new thread.

    Thanks,
    Rafael


    \
     
     \ /
      Last update: 2008-01-06 23:21    [W:4.563 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site