USB HCD: avoid duplicate local_irq_disable()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <gregkh@...>
Cc: Andrew Morton <akpm@...>, Linus Torvalds <torvalds@...>, <matthew@...>, <ralf@...>, <adobriyan@...>, <viro@...>, <viro@...>, LKML <linux-kernel@...>, <linux-arch@...>, Ingo Molnar <mingo@...>, Peter Zijlstra <peterz@...>, Thomas Gleixner <tglx@...>, <linux-usb-devel@...>
Date: Monday, October 22, 2007 - 9:28 pm

usb_hcd_flush_endpoint() has a retry loop that starts with a spin_lock_irq(),
but only gives up the spinlock, not the irq_disable before jumping to the
rescan label.

Split the spin_lock_irq into the retryable part and the local_irq_disable()
that is only done once as a micro-optimization and slight cleanup.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---

On Tuesday 23 October 2007, I wrote:

One more such example that was not found by lockdep. I guess this counts
as a false positive, as it is clearly harmless, but working around
it is a small optimization for the case where local_irq_disable()
is a hypervisor call.

Should we try to fix this class of (non-)problem in other places?
Will this patch cause a different warning with lockdep since now we
are pairing spin_lock() with spin_unlock_irq()?

--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1312,8 +1312,9 @@ void usb_hcd_flush_endpoint(struct usb_device *udev,
 	hcd = bus_to_hcd(udev->bus);
 
 	/* No more submits can occur */
+	local_irq_disable();
 rescan:
-	spin_lock_irq(&hcd_urb_list_lock);
+	spin_lock(&hcd_urb_list_lock);
 	list_for_each_entry (urb, &ep->urb_list, urb_list) {
 		int	is_in;
 
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/2] irq_flags_t: intro and core annotations, Alexey Dobriyan, (Sat Oct 20, 7:55 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Roman Zippel, (Sat Oct 27, 3:20 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Alexey Dobriyan, (Sat Oct 27, 4:14 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Roman Zippel, (Sat Oct 27, 5:22 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Peter Zijlstra, (Sat Oct 27, 5:07 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Jan Engelhardt, (Thu Oct 25, 11:40 am)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Alexey Dobriyan, (Sat Oct 27, 4:24 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Jan Engelhardt, (Sat Oct 27, 4:32 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Alexey Dobriyan, (Sun Oct 21, 5:30 am)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Ralf Baechle, (Mon Oct 22, 11:29 am)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Andrew Morton, (Mon Oct 22, 2:21 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Arnd Bergmann, (Mon Oct 22, 3:10 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Matthew Wilcox, (Mon Oct 22, 3:47 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Linus Torvalds, (Mon Oct 22, 3:56 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Jeff Garzik, (Tue Oct 23, 10:11 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Arnd Bergmann, (Wed Oct 24, 4:55 am)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, David Miller, (Mon Oct 22, 8:21 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Andrew Morton, (Mon Oct 22, 4:02 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Arnd Bergmann, (Mon Oct 22, 5:34 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Thomas Gleixner, (Mon Oct 22, 5:46 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Arnd Bergmann, (Mon Oct 22, 9:06 pm)
USB HCD: avoid duplicate local_irq_disable(), Arnd Bergmann, (Mon Oct 22, 9:28 pm)
Re: [PATCH 1/2] irq_flags_t: intro and core annotations, Geert Uytterhoeven, (Mon Oct 22, 2:50 pm)