On Friday 15 April 2005 4:08 pm, Oliver Neukum wrote:
> Am Samstag, 16. April 2005 00:53 schrieb David Brownell:
> > > > > Auditing locking in all drivers is not.
> > > > > Switching to tasklets would result in revisting locking in drivers.
> > > >
> > > > Why would switching uhci-hcd over to a tasklet require any change in
> > > > other
> > > > drivers?
> > >
> > > You have to audit all drivers to check them for synchronization between
> > > the callback and other hard irqs. In addition to reap the full benefit
> > > from
> > > a switch to tasklets, you'd have to change the drivers to use
> > > spin_lock_bh().
> >
> > Not many USB device driver use tasklets, but all those would need to be
> > audited/modified.
>
> Not quite so simple. Have a look at this code from message.c:
>
> static void sg_complete (struct urb *urb, struct pt_regs *regs)
> {
> struct usb_sg_request *io = (struct usb_sg_request *) urb->context;
>
> spin_lock (&io->lock);
>
> This is equivalent to spin_lock_irqsave if called from hard irq. In a tasklet
> it is spin_lock_bh. Do you know whether io->lock is ever taken in hard irq?
Can't be. It's taken in URB completion callbacks (with IRQs blocked,
that's a guarantee that can't change easily), and otherwise only in
task context (submitting or canceling the urbs).
- Dave
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel