Everyone has convinced me that there's no point in making 
usbdev->serialize an rw-semaphore, so that's out.  A big relief to some 
people, no doubt :-)

I still have a problem with marking devices as soon as we know they are
unplugged.  Even using David's scheme where this is done using a separate
unprotected flag in struct usb_device, I can't see any way to make it work
without introducing a new lock.

The problem is that when the "unplugged" flag is set for a hub, it must be
set recursively for all the children as well.  This requires reading
through the list of the hub's children, but it takes place asynchronously
with respect to other tasks that may be updating the list.  It's not
enough to say those other tasks should check the hub's unplugged flag
before they update anything; setting and checking a flag does not
constitute a true synchronization operation.  Either a spinlock or a
semaphore is required.

Basically the new lock would have to be held while adding or removing a
device from a hub's list of children and while the recursive
set-the-unplugged-flag takes place.  This doesn't seem likely to create a
lot of contention, but still, if anyone can think of a way to do this
without a lock I would be pleased to hear it.

Alan Stern



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to