From: Peter Zijlstra <peterz@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Michael Buesch <mb@bu3sch.de>,
David Ellingsworth <david@identd.dyndns.org>,
linux-wireless <linux-wireless@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH/RFC] remove irqs_disabled warning from local_bh_enable
Date: Wed, 18 Jun 2008 09:01:54 +0200 [thread overview]
Message-ID: <1213772514.16944.197.camel@twins> (raw)
In-Reply-To: <alpine.LFD.1.10.0806171648330.2907@woody.linux-foundation.org>
On Tue, 2008-06-17 at 16:55 -0700, Linus Torvalds wrote:
>
> On Tue, 17 Jun 2008, Johannes Berg wrote:
> >
> > This warning has started to trigger with mac80211 because it can, under
> > some circumstances, use spin_lock_bh() protected sections within
> > irq-disabled sections. Is that a bug?
>
> Yes, it's a bug.
>
> Why? Not because of the "spin_lock_bh()" itself, but because of the
> _unlock_, which does a "local_bh_enable_ip()", which in turn will check
> the whole "do_softirq()" if it was the last softirq_count.
>
> And you must not do softirq's when hard-irq's were disabled!
>
> So it should in theory be ok (but perhaps a bit odd) to do something like
>
> spin_lock_irq(&irq_lock);
> ..do something..
> spin_lock_bh(&bh_lock);
> spin_unlock_irq(&irq_lock);
> .. do something else ..
> spin_unlock_bh(&bh_lock);
>
> where the "spin_lock_bh()" itself is in an irq-locked context - as long as
> the "spin_unlock_bh()" is *not*.
I would suggest discouraging such madne^Wcreativity, its gains are
dubious at best and it doesn't make the locking any more obvious and
could be an indication of messy locking to begin with.
So I would like to see Johannes' other patch that allows all of us to
enjoy the warning he ran into ;-)
Peter
next prev parent reply other threads:[~2008-06-18 7:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-17 21:57 [PATCH/RFC] remove irqs_disabled warning from local_bh_enable Johannes Berg
2008-06-17 23:08 ` David Miller
2008-06-17 23:55 ` Linus Torvalds
2008-06-18 7:01 ` Peter Zijlstra [this message]
2008-06-18 7:29 ` Johannes Berg
2008-06-20 13:46 ` Ingo Molnar
2008-06-20 15:27 ` Ingo Molnar
2008-06-20 15:36 ` Michael Buesch
2008-06-20 15:55 ` Ingo Molnar
2008-06-20 16:01 ` Michael Buesch
2008-06-20 16:18 ` Michael Buesch
2008-06-23 8:41 ` Ingo Molnar
2008-06-23 8:41 ` Ingo Molnar
2008-06-23 9:22 ` Michael Buesch
2008-06-27 5:33 ` Jeff Garzik
2008-06-27 10:53 ` Ingo Molnar
2008-06-27 10:56 ` Johannes Berg
2008-06-27 10:56 ` Johannes Berg
2008-06-20 15:43 ` Johannes Berg
2008-06-20 15:46 ` Johannes Berg
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=1213772514.16944.197.camel@twins \
--to=peterz@infradead.org \
--cc=david@identd.dyndns.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mb@bu3sch.de \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.org \
/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.