USB locking

Bernd Walter ticso at cicely12.cicely.de
Fri Jul 9 14:18:55 PDT 2004


On Fri, Jul 09, 2004 at 05:10:55PM +0200, Lukas Ertl wrote:
> Hello,
> 
> I've prepared a patch that adds some basic locking primitives to parts of 
> the USB stack (usb.c, uhci.c, ehci.c).  Mainly, I've added some mutexes 
> and applied them instead of calls to spl*, wrapped into #ifdef's to stay 
> somewhat compatible with NetBSD.  I'd be happy if I could get some review.
> 
> <http://people.freebsd.org/~le/usb.diff>

Just replacing spl* with locks is not enough to protect code.
spls were only required to protect from interrupts, but whithout GIANT
we need to protect from multiple userland calls as well.

One point that I noticed was that you call usb_transfer_complete with a
lock held - this function will run the upcall function of the xfer
issuer, which is code you don't know anything about.

-- 
B.Walter                   BWCT                http://www.bwct.de
bernd at bwct.de                                  info at bwct.de



More information about the freebsd-arch mailing list