From: Matt Mackall <mpm@selenic.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dave Jones <davej@redhat.com>
Subject: Re: [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
Date: Sat, 15 Dec 2007 11:54:43 -0600 [thread overview]
Message-ID: <20071215175443.GU19691@waste.org> (raw)
In-Reply-To: <20071215065211.GA26579@gondor.apana.org.au>
On Sat, Dec 15, 2007 at 02:52:11PM +0800, Herbert Xu wrote:
> On Sat, Dec 15, 2007 at 02:04:49PM +0800, Herbert Xu wrote:
> >
> > I suppose we'll have to either introduce a new primitive or just
> > go back to using BUG_ON.
>
> Let's do the conservative thing and add a new primitive.
>
> [PATCH] Added BARF_ON/BARF_ON_ONCE
>
> The description of CONFIG_BUG clearly states that both BUG and
> WARN_ON may be skipped. However, our actual implementation still
> checks the condition on WARN_ON if it's used as part of an if
> statement or such.
>
> I tried to compile it away but Matt Mackall pointed out that
> people may already be using it in ways that were not intended.
> In particular, it may have been used for conditions that are
> thought to be possible.
>
> So this patch adds a new pair of macros BARF_ON and BARF_ON_ONCE
> that are clearly marked as such to prevent abuse. The intended
> usage model is identical to WARN_ON except that they should only
> be used for conditions that are thought to be impossible. In
> other words, only use them to replace BUG_ON's that may be called
> by an IRQ handler or within locks.
Egads, this just makes the whole bad BUG_ON vs WARN_ON situation
worse. This adds yet another non-distinction, because the difference
between BUG_ON and WARN_ON has absolutely nothing to do with the
(perceived or actual) probability of the condition.
We've got plenty of evidence that BUG_ON and WARN_ON conditions -do-
happen. So choosing between BUG_ON and WARN_ON is choosing whether a
box should be forcibly killed or not and nothing more.
You've clearly got a use-case in mind where WARN_ON + !CONFIG_BUG
isn't doing what you want, please share it with us.
--
Mathematics is the supreme nostalgia of our time.
next prev parent reply other threads:[~2007-12-15 17:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-14 13:27 [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off Herbert Xu
2007-12-14 18:02 ` Matt Mackall
2007-12-15 4:16 ` Herbert Xu
2007-12-15 5:52 ` Matt Mackall
2007-12-15 6:04 ` Herbert Xu
2007-12-15 6:12 ` Matt Mackall
2007-12-15 6:31 ` Herbert Xu
2007-12-15 6:52 ` Herbert Xu
2007-12-15 17:54 ` Matt Mackall [this message]
2007-12-15 6:45 ` Dave Jones
2007-12-15 6:22 ` Benjamin Herrenschmidt
2007-12-15 6:31 ` Benjamin Herrenschmidt
2007-12-15 6:34 ` Herbert Xu
2007-12-15 18:12 ` Matt Mackall
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=20071215175443.GU19691@waste.org \
--to=mpm@selenic.com \
--cc=akpm@linux-foundation.org \
--cc=davej@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.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.