Message ID | 20180910092000.14693-4-bigeasy@linutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: use irqsave() in USB's complete callback + remove local_irq_save | expand |
On Mon, 10 Sep 2018, Sebastian Andrzej Siewior wrote: > The core disabled interrupts before invocation the ->complete handler > because the handler might have expected that interrupts are disabled. > > All handlers were audited and use proper locking now. With it, the core > code no longer needs to disable interrupts before invoking the > ->complete handler. > Remove local_irq_save() statement before invoking the ->complete > handler. > > Cc: Alan Stern <stern@rowland.harvard.edu> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > --- > drivers/usb/core/hcd.c | 13 ------------- > 1 file changed, 13 deletions(-) > > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c > index 1c21955fe7c00..f985d2303095c 100644 > --- a/drivers/usb/core/hcd.c > +++ b/drivers/usb/core/hcd.c > @@ -1755,20 +1755,7 @@ static void __usb_hcd_giveback_urb(struct urb *urb) > > /* pass ownership to the completion handler */ > urb->status = status; > - > - /* > - * We disable local IRQs here avoid possible deadlock because > - * drivers may call spin_lock() to hold lock which might be > - * acquired in one hard interrupt handler. > - * > - * The local_irq_save()/local_irq_restore() around complete() > - * will be removed if current USB drivers have been cleaned up > - * and no one may trigger the above deadlock situation when > - * running complete() in tasklet. > - */ > - local_irq_save(flags); > urb->complete(urb); > - local_irq_restore(flags); > > usb_anchor_resume_wakeups(anchor); > atomic_dec(&urb->use_count); Acked-by: Alan Stern <stern@rowland.harvard.edu>
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 1c21955fe7c00..f985d2303095c 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1755,20 +1755,7 @@ static void __usb_hcd_giveback_urb(struct urb *urb) /* pass ownership to the completion handler */ urb->status = status; - - /* - * We disable local IRQs here avoid possible deadlock because - * drivers may call spin_lock() to hold lock which might be - * acquired in one hard interrupt handler. - * - * The local_irq_save()/local_irq_restore() around complete() - * will be removed if current USB drivers have been cleaned up - * and no one may trigger the above deadlock situation when - * running complete() in tasklet. - */ - local_irq_save(flags); urb->complete(urb); - local_irq_restore(flags); usb_anchor_resume_wakeups(anchor); atomic_dec(&urb->use_count);
The core disabled interrupts before invocation the ->complete handler because the handler might have expected that interrupts are disabled. All handlers were audited and use proper locking now. With it, the core code no longer needs to disable interrupts before invoking the ->complete handler. Remove local_irq_save() statement before invoking the ->complete handler. Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/usb/core/hcd.c | 13 ------------- 1 file changed, 13 deletions(-)