[RFC PATCH 0/4] USB: HCD/EHCI: giveback of URB in tasklet context

Ming Lei ming.lei at canonical.com
Tue Jun 11 04:14:25 EDT 2013


On Tue, Jun 11, 2013 at 3:18 PM, Oliver Neukum <oliver at neukum.org> wrote:
> On Tuesday 11 June 2013 13:40:20 Ming Lei wrote:
>> On Tue, Jun 11, 2013 at 1:36 AM, Alan Stern <stern at rowland.harvard.edu> wrote:
>> > On Mon, 10 Jun 2013, Ming Lei wrote:
>
>> If complete() callback runs in one tasklet context, spin_lock() inside
>> complete() is enough, just like hard irq, the tasklet itself is disabled
>> during complete(), if the percpu tasklet is converted to single tasklet.
>> So no problem when the lock is to protect shared resources between
>> complete().
>
> We also have exclusion between complete() and other contexts, i.e. timers.

The patch also converts the complete() called in timers to tasklet context too.

So could you let me know if that eases your concern? If not, could you explain
your concern about other contexts in a bit detail?

>
>> When the lock is to protect shared resources between complete() and
>> non-IRQ context, currently spin_lock_irqsave() is used in non-IRQ
>> context, which is enough to prevent tasklet from being run on the CPU,
>> so no problem for this situation too.
>>
>> When all HCDs support to run URB giveback in tasklet context, we can
>> change all spin_lock_irq*() to spin_lock() in drivers URB->complete(), and
>> in other places, the spin_lock_irq*() can be changed to spin_lock_bh().
>
> Even now we cannot guarantee that all calls to complete() are in irq.
> There is the case of HCD hotunplug and other cases, like timeouts.
> They will have to be verified.

All URBs are completed via usb_hcd_giveback_urb(), so there should
be no differences between these cases and the common one about
introducing the patchset.

Thanks,
--
Ming Lei



More information about the linux-arm-kernel mailing list