From: Arnd Bergmann <arnd@arndb.de>
To: gregkh@suse.de
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
matthew@wil.cx, ralf@linux-mips.org, adobriyan@gmail.com,
viro@ftp.linux.org.uk, viro@zeniv.linux.org.uk,
LKML <linux-kernel@vger.kernel.org>,
linux-arch@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-usb-devel@lists.sourceforge.net
Subject: USB HCD: avoid duplicate local_irq_disable()
Date: Tue, 23 Oct 2007 03:28:31 +0200 [thread overview]
Message-ID: <200710230328.33915.arnd@arndb.de> (raw)
In-Reply-To: <200710230306.51606.arnd@arndb.de>
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:
> I tried the trivial annotation below and (with lockdep enabled) got a few
> warnings at boot time, but only one that I could still find in the log
> buffer:
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;
next prev parent reply other threads:[~2007-10-23 1:29 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-20 23:55 [PATCH 1/2] irq_flags_t: intro and core annotations Alexey Dobriyan
2007-10-21 0:54 ` Al Viro
2007-10-21 9:30 ` Alexey Dobriyan
2007-10-22 15:29 ` Ralf Baechle
2007-10-22 18:21 ` Andrew Morton
2007-10-22 18:50 ` Geert Uytterhoeven
2007-10-22 19:10 ` Arnd Bergmann
2007-10-22 19:47 ` Matthew Wilcox
2007-10-22 19:56 ` Linus Torvalds
2007-10-22 20:02 ` Andrew Morton
2007-10-22 21:34 ` Arnd Bergmann
2007-10-22 21:46 ` Thomas Gleixner
2007-10-23 1:06 ` Arnd Bergmann
2007-10-23 1:28 ` Arnd Bergmann [this message]
2007-10-23 4:01 ` [linux-usb-devel] USB HCD: avoid duplicate local_irq_disable() Alan Stern
2007-10-23 4:01 ` Alan Stern
2007-10-25 18:33 ` Greg KH
2007-10-27 19:14 ` Alan Stern
2007-10-27 19:14 ` Alan Stern
2007-10-22 20:47 ` [PATCH 1/2] irq_flags_t: intro and core annotations Jeff Garzik
2007-10-23 0:21 ` David Miller
2007-10-23 3:33 ` Herbert Xu
2007-10-23 3:33 ` Herbert Xu
2007-10-24 2:11 ` Jeff Garzik
2007-10-24 8:55 ` Arnd Bergmann
2007-10-25 15:40 ` Jan Engelhardt
2007-10-27 20:24 ` Alexey Dobriyan
2007-10-27 20:32 ` Jan Engelhardt
2007-10-28 1:24 ` Herbert Xu
2007-10-27 19:20 ` Roman Zippel
2007-10-27 20:14 ` Alexey Dobriyan
2007-10-27 21:07 ` Peter Zijlstra
2007-10-27 21:22 ` Roman Zippel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200710230328.33915.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=matthew@wil.cx \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=ralf@linux-mips.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@ftp.linux.org.uk \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.