USB2 patches
M. Warner Losh
imp at bsdimp.com
Sun Feb 1 10:33:30 PST 2009
In message: <20090201.112459.717301987.imp at bsdimp.com>
"M. Warner Losh" <imp at bsdimp.com> writes:
: In message: <20090201175021.GA32503 at citylink.fud.org.nz>
: Andrew Thompson <thompsa at freebsd.org> writes:
: : > 3)
: : > In general avoid more than a few synchronous USB transfer inside
: : > attach/detach. Always defer! Else there are corner cases where the device can
: : > hang waiting for the transfer timeout 1-5 seconds for every USB transfer, and
: : > that is unacceptable.
: :
: : I disagree. It hugely simplifies drivers to know all the resources are
: : allocated after attach, you dont need to check for null pointers
: : throughout the code. If programming commands fail/timeout in the attach routine
: : then the driver needs to check this and abort the attach. You will wait
: : one or two timeouts max.
:
: The only way that a 'deferred attach' makes sense is if the ifnet and
: other external resources are setup as part of that deferred attach.
: That way, you don't have the NULL pointer issue.
:
: However, doing that introduces races with devd, which are a pita to
: cope with... Even without deferring the setting up if ifnet, you have
: races with devd if you defer things in attach that can be hard to cope
: with in the code.
Scratch that. The race with devd is already closed since we use ifnet
events and not newbus events to configure dynamic devices.
There's still a small race on boot with deferring registration of
ifnet if you want to synchronously boot.... But I think the default
route script closes this race...
Warner
More information about the freebsd-usb
mailing list