Re: [PATCH/RFC] remove irqs_disabled warning from local_bh_enable





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*.

See?

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [PATCH/RFC] remove irqs_disabled warning from local_bh_enable
    ... On Tue, 17 Jun 2008, Johannes Berg wrote: ... This warning has started to trigger with mac80211 because it can, ... Yes, it's a bug. ... could be an indication of messy locking to begin with. ...
    (Linux-Kernel)
  • [PATCH/RFC] remove irqs_disabled warning from local_bh_enable
    ... This warning has started to trigger with mac80211 because it can, ... the warning was never noticed until somebody ran the code ... because softirq disabling is refcounted (via the preempt ... Also, if you're going to treat IRQs being enabled as a bug, there's no ...
    (Linux-Kernel)
  • Re: use assert and defensive together
    ... These are often HW devices that trigger when the SW has crashed and stops keeping them happy. ... Or if it is an interactive program add in the code to report the problem to the user. ... Also the logging would still be available in the released code as will the reports to the user. ... There is a bug in the image processing software. ...
    (comp.lang.c)
  • Re: A critique of cgi.escape
    ... considered a bug. ... It isn't like there have never been backwards _in_compatible changes to ... unit tests which include specific tests for that behaviour, ... it doesn't need to be fixed *immediately* without warning; ...
    (comp.lang.python)
  • Re: SMTP and IIS Admin Service terminated unexpectly
    ... Understood about this bug being something obscure and hard to trigger ... experiencing this problem (on a Win2003 Server box without Exchange) ...
    (microsoft.public.exchange.admin)