From: Sebastian Andrzej Siewior Date: Fri, 8 Nov 2013 17:34:54 +0100 Subject: usb: Use _nort in giveback function Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.8/older/patches-4.8.14-rt9.tar.xz Since commit 94dfd7ed ("USB: HCD: support giveback of URB in tasklet context") I see |BUG: sleeping function called from invalid context at kernel/rtmutex.c:673 |in_atomic(): 0, irqs_disabled(): 1, pid: 109, name: irq/11-uhci_hcd |no locks held by irq/11-uhci_hcd/109. |irq event stamp: 440 |hardirqs last enabled at (439): [] _raw_spin_unlock_irqrestore+0x75/0x90 |hardirqs last disabled at (440): [] __usb_hcd_giveback_urb+0x46/0xc0 |softirqs last enabled at (0): [] copy_process.part.52+0x511/0x1510 |softirqs last disabled at (0): [< (null)>] (null) |CPU: 3 PID: 109 Comm: irq/11-uhci_hcd Not tainted 3.12.0-rt0-rc1+ #13 |Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 | 0000000000000000 ffff8800db9ffbe0 ffffffff8169f064 0000000000000000 | ffff8800db9ffbf8 ffffffff810b2122 ffff88020f03e888 ffff8800db9ffc18 | ffffffff816a6944 ffffffff810b5748 ffff88020f03c000 ffff8800db9ffc50 |Call Trace: | [] dump_stack+0x4e/0x8f | [] __might_sleep+0x112/0x190 | [] rt_spin_lock+0x24/0x60 | [] hid_ctrl+0x3b/0x190 | [] __usb_hcd_giveback_urb+0x4f/0xc0 | [] usb_hcd_giveback_urb+0x3f/0x140 | [] uhci_giveback_urb+0xaf/0x280 | [] uhci_scan_schedule+0x47a/0xb10 | [] uhci_irq+0xa6/0x1a0 | [] usb_hcd_irq+0x28/0x40 | [] irq_forced_thread_fn+0x23/0x70 | [] irq_thread+0x10f/0x150 | [] kthread+0xcd/0xe0 | [] ret_from_fork+0x7c/0xb0 on -RT we run threaded so no need to disable interrupts. Signed-off-by: Sebastian Andrzej Siewior --- drivers/usb/core/hcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1760,9 +1760,9 @@ static void __usb_hcd_giveback_urb(struc * and no one may trigger the above deadlock situation when * running complete() in tasklet. */ - local_irq_save(flags); + local_irq_save_nort(flags); urb->complete(urb); - local_irq_restore(flags); + local_irq_restore_nort(flags); usb_anchor_resume_wakeups(anchor); atomic_dec(&urb->use_count);