From: mingo@kernel.org (Ingo Molnar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arch: configuration, deleting 'CONFIG_BUG' since always need it.
Date: Tue, 28 May 2013 10:19:10 +0200 [thread overview]
Message-ID: <20130528081910.GA29557@gmail.com> (raw)
In-Reply-To: <20130523100409.GK18614@n2100.arm.linux.org.uk>
* Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> So, if you want to use this, then you should update the CONFIG_BUG text
> to include a warning to this effect:
>
> Warning: if CONFIG_BUG is turned off, and control flow reaches
> a BUG(), the system behaviour will be undefined.
>
> so that people can make an informed choice about this, because at the
> moment:
>
> Disabling this option eliminates support for BUG and WARN, reducing
> the size of your kernel image and potentially quietly ignoring
> numerous fatal conditions. You should only consider disabling this
> option for embedded systems with no facilities for reporting errors.
> Just say Y.
>
> will become completely misleading. Turning this option off will _not_
> result in "quietly ignoring numerous fatal conditions".
I'm fine with adding your text as a clarification - but I think 'quietly
ignoring fatal conditions' very much implies an undefined outcome if that
unexpected condition does occur: the code might crash, it might corrupt
memory or it might do some other unexpected thing.
There are many other places that do a BUG_ON() of a NULL pointer or so, or
of a zero refcount, or a not held lock - and turning the BUG_ON() off
makes the code unpredictable _anyway_ - even if the compiler does not
notice an uninitialized variable.
So pretty much any weakening of BUG_ON() _will_ make the kernel more
unpredictable.
> And I come back to one of my previous arguments - is it not better to
> panic() if we hit one of these conditions so that the system can try to
> do a panic-reboot rather than continue blindly into the unknown?
It will often continue blindly into the unknown even if the compiler is
happy ...
The only difference is that it's "unpredictable" in a way not visible from
the C code: the code won't necessarily fall through the BUG() when hitting
that condition - although in practice it probably will.
So I think the same principle applies to it as to any other debugging
code: it's fine to be able to turn debugging off. It's a performance
versus kernel robustness/determinism trade-off.
Thanks,
Ingo
next prev parent reply other threads:[~2013-05-28 8:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-23 7:57 [PATCH] arch: configuration, deleting 'CONFIG_BUG' since always need it Chen Gang
2013-05-23 8:40 ` Geert Uytterhoeven
2013-05-23 8:54 ` Arnd Bergmann
2013-05-23 9:05 ` Russell King - ARM Linux
2013-05-23 9:12 ` Geert Uytterhoeven
2013-05-23 9:39 ` Arnd Bergmann
2013-05-23 10:04 ` Russell King - ARM Linux
2013-05-23 10:41 ` Chen Gang
2013-05-23 10:59 ` Arnd Bergmann
2013-05-23 11:19 ` Chen Gang
2013-05-23 11:24 ` Russell King - ARM Linux
2013-05-23 12:09 ` Arnd Bergmann
2013-05-23 12:50 ` Russell King - ARM Linux
2013-05-23 14:10 ` Geert Uytterhoeven
2013-05-24 2:13 ` Chen Gang
2013-05-24 4:17 ` Chen Gang
2013-05-26 4:43 ` [PATCH v2] arch: configuration issue, random return value when disable 'CONFIG_BUG' Chen Gang
2013-05-28 8:19 ` Ingo Molnar [this message]
2013-05-28 10:25 ` [PATCH] arch: configuration, deleting 'CONFIG_BUG' since always need it Chen Gang
2013-05-28 14:49 ` Arnd Bergmann
2013-05-28 14:55 ` H. Peter Anvin
2013-05-28 15:43 ` Arnd Bergmann
2013-05-28 16:06 ` H. Peter Anvin
2013-05-28 17:20 ` Arnd Bergmann
2013-05-23 10:09 ` Eric W. Biederman
2013-05-23 10:29 ` Russell King - ARM Linux
2013-05-23 10:05 ` Chen Gang
2013-05-24 5:59 ` Eric W. Biederman
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=20130528081910.GA29557@gmail.com \
--to=mingo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).