On Wed, Mar 22, 2000 at 01:14:31PM +0000, Matthew Dharm wrote:
> So, I was sitting here, slamming down large amounts of caffine, and I
> suddenly realized that my code might be full of race conditions which are
> caused by the behavior of probes, disconnects, and suspends.
>
> So, I think I need to ask some questions of the HCD gurus. Here they are,
> in no particular order. When answering these, please keep in mind that
> some people have multiple host controllers, possibly of multiple types.
All probing/connecting/disconnecting is done in the one and only
khub-thread. HCDs deliver their connect/disconnect-status only via the
virtual root hub to khub, actually all other HCD stuff has no
knowledge that a device was disconnected (thus the Stalled/CRC/Timeout
messages when unplugging a 'hot' device). So all connections changes are
serialized over all host controllers (if khub does it right, which I
assume).
> (1) Are probing functions required to be re-entrant?
> (2) Are disconnect functions required to be re-entrant?
1+2:No.
> (3) What happens if a probe or disconnect function blocks for a little
> while while waiting to acquire a lock?
The whole probing gets delayed.
> (4) What happens during a suspend? Are all devices disconnected and then
> re-connected? If not, what happens if the system is suspended,
> devices are added/removed, and then the system resumes?
Good question. Is there a defined behavior all HCDs should have? usb-uhci
simply stops the HC (switching off the frame sync) and restarts it.
I haven't tried adding devices during suspend, so I don't know what the HC
will do..
> (5) Once I return from a call to usb_deregister(), can I be _assured_ that
> my probe and disconnect functions will never be called again?
Not my working area, but I assume that's how it is supposed to work ;-)
> (6) What happens if, while my probe function is attempting to communicate
> with a device, the device is removed?
usb-uhci: Stalled/CRC/Timeout (ie. a hard timeout on the USB detected by the
HC, -ETIMEDOUT/-EILSEQ). You should draw the right conclusions out of that.
--
Bye
Georg Acher, [EMAIL PROTECTED]
http://www.in.tum.de/~acher/
"Oh no, not again !" The bowl of petunias
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]