[RFC PATCH 0/4] USB: HCD/EHCI: giveback of URB in tasklet context
Ming Lei
ming.lei at canonical.com
Wed Jun 12 02:41:16 EDT 2013
On Wed, Jun 12, 2013 at 10:43 AM, Ming Lei <ming.lei at canonical.com> wrote:
> On Wed, Jun 12, 2013 at 3:10 AM, Alan Stern <stern at rowland.harvard.edu> wrote:
>>
>> I don't follow your reasoning. Consider the following situation, where
>> the same spinlock is used in both a URB completion handler and an
>> interrupt handler:
>>
>> URB completes
>> A tasklet calls the completion handler, with interrupts enabled
>> The completion handler does
>> spin_lock(&lock);
>> An interrupt occurs
>> The interrupt handler does
>> spin_lock(&lock); // Deadlock!
>
> If you mean the interrupt handler is HCD irq handler of the device, no
> such problem since all complete() will run in tasklet context.
>
> If not, I am wondering why one USB driver need register another hard
> interrupt handler? Could you share such examples? I understand the
> case only exists with timer handler as discussed with Oliver, don't I?
In fact, timer funtion is still run in softirq context, so the deadlock won't
be caused with acquiring same lock(spin_lock) in both timer function
and complete() from tasklet.
Thanks,
--
Ming Lei
More information about the linux-arm-kernel
mailing list