From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Catalin Marinas" <Catalin.Marinas@arm.com>,
"Linux-sh list" <linux-sh@vger.kernel.org>,
"Chen Gang" <gang.chen@asianux.com>,
"Heiko Carstens" <heiko.carstens@de.ibm.com>,
"paulus@samba.org" <paulus@samba.org>,
"H. Peter Anvin" <hpa@zytor.com>,
"Michel Lespinasse" <walken@google.com>,
"Hans-Christian Egtvedt" <egtvedt@samfundet.no>,
Linux-Arch <linux-arch@vger.kernel.org>,
linux-s390@vger.kernel.org,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Richard Weinberger" <richard@nod.at>,
"Helge Deller" <deller@gmx.de>,
"the arch/x86 maintainers" <x86@kernel.org>,
"James E.J. Bottomley" <jejb@parisc-linux.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Frederic Weisbecker" <fweisbec@gmail.com>,
"Paul McKenney" <paulmck@linux.vnet.ibm.com>,
"Håvard Skinnemoen" <hskinnemoen@gmail.com>,
"Serge Hallyn" <serge.hallyn@canonical.com>,
"Mike Frysinger" <vapier@gentoo.org>,
uml-devel <user-mode-linux-devel@lists.sourceforge.net>,
"Will Deacon" <will.deacon@arm.com>,
"Jeff Dike" <jdike@addtoit.com>,
"Akinobu Mita" <akinobu.mita@gmail.com>,
uml-user <user-mode-linux-user@lists.sourceforge.net>,
"uclinux-dist-devel@blackfin.uclinux.org"
<uclinux-dist-devel@blackfin.uclinux.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"Parisc List" <linux-parisc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Richard Kuo" <rkuo@codeaurora.org>,
"Paul Mundt" <lethal@linux-sh.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
linux-hexagon@vger.kernel.org,
"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
linux390@de.ibm.com, "Andrew Morton" <akpm@linux-foundation.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"David Miller" <davem@davemloft.net>
Subject: Re: [PATCH] arch: configuration, deleting 'CONFIG_BUG' since always need it.
Date: Thu, 23 May 2013 11:04:09 +0100 [thread overview]
Message-ID: <20130523100409.GK18614@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <201305231139.38233.arnd@arndb.de>
On Thu, May 23, 2013 at 11:39:37AM +0200, Arnd Bergmann wrote:
> On Thursday 23 May 2013, Geert Uytterhoeven wrote:
> > > The problem is: trying to fix that will mean the result is a larger
> > > kernel than if you just do the usual arch-implemented thing of placing
> > > an defined faulting instruction at the BUG() site - which defeats the
> > > purpose of turning off CONFIG_BUG.
> >
> > Is __builtin_unreachable() working well these days?
> >
>
> Hmm, I just tried the trivial patch below, which seemed to do the right thing.
> Needs a little more investigation, but that might actually be the correct
> solution. I thought that at some point __builtin_unreachable() was the same
> as "do {} while (1)", but this is not the case with the gcc I was using --
> it just tells gcc that we don't expect to ever get here.
All this is doing is hiding the warning, nothing more.
What the compiler does is this:
beq 1f
... some asm code ...
__builtin_reachable() point
maybe a literal table
1: ... some asm code doing some other part of the function ...
and what will happen is that the first block of asm will fall through the
(possibly present) literal table into the following asm code. So, as
specified in the gcc manual, if you ever hit a __builtin_unreachable()
point, your program is undefined (as in, the behaviour of it can no longer
be known.)
We can't make that guarantee with BUG() - because sometimes they do fire
and sometimes in the most unlikely scenarios, particularly if you're not
looking, or at the most inconvenient time.
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".
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?
next prev parent reply other threads:[~2013-05-23 10:07 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 [this message]
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 ` [PATCH] arch: configuration, deleting 'CONFIG_BUG' since always need it Ingo Molnar
2013-05-28 10:25 ` 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=20130523100409.GK18614@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=Catalin.Marinas@arm.com \
--cc=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=deller@gmx.de \
--cc=ebiederm@xmission.com \
--cc=egtvedt@samfundet.no \
--cc=fweisbec@gmail.com \
--cc=gang.chen@asianux.com \
--cc=geert@linux-m68k.org \
--cc=heiko.carstens@de.ibm.com \
--cc=hpa@zytor.com \
--cc=hskinnemoen@gmail.com \
--cc=jdike@addtoit.com \
--cc=jejb@parisc-linux.org \
--cc=lethal@linux-sh.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hexagon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux390@de.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=richard@nod.at \
--cc=rkuo@codeaurora.org \
--cc=schwidefsky@de.ibm.com \
--cc=serge.hallyn@canonical.com \
--cc=tglx@linutronix.de \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
--cc=user-mode-linux-user@lists.sourceforge.net \
--cc=vapier@gentoo.org \
--cc=walken@google.com \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
--cc=ysato@users.sourceforge.jp \
/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).