From: Chen Gang <gang.chen@asianux.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Catalin Marinas" <Catalin.Marinas@arm.com>,
"Linux-sh list" <linux-sh@vger.kernel.org>,
"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,
"Russell King - ARM Linux" <linux@arm.linux.org.uk>,
uml-devel <user-mode-linux-devel@lists.sourceforge.net>,
"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>,
"Frederic Weisbecker" <fweisbec@gmail.com>,
"Paul McKenney" <paulmck@linux.vnet.ibm.com>,
"Håvard Skinnemoen" <hskinnemoen@gmail.com>
Subject: Re: [PATCH] arch: configuration, deleting 'CONFIG_BUG' since always need it.
Date: Thu, 23 May 2013 18:05:10 +0800 [thread overview]
Message-ID: <519DE9D6.8000707@asianux.com> (raw)
In-Reply-To: <CAMuHMdWez-j1Maa3BD7ucmzv0_zFJnChERQiHFmkCaZUzG0_AA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1893 bytes --]
On 05/23/2013 05:12 PM, Geert Uytterhoeven wrote:
> On Thu, May 23, 2013 at 11:05 AM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>> > On Thu, May 23, 2013 at 10:40:29AM +0200, Geert Uytterhoeven wrote:
>>> >> On Thu, May 23, 2013 at 9:57 AM, Chen Gang <gang.chen@asianux.com> wrote:
>>>> >> > -config BUG
>>>> >> > - bool "BUG() support" if EXPERT
>>>> >> > - default y
>>>> >> > - help
>>>> >> > - 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.
>>> >>
>>> >> ... It's about reducing memory size on devices where you can't show bug or
>>> >> warning messages.
>> >
>> > And turning off CONFIG_BUG causes lots of warning messages at compile time
>> > about functions which are returning nothing which shouldn't.
>> >
>> > 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?
In fact, using __builtin_unreachable() is a standard way for
architectures to implemented their own BUG() (e.g. x86, s390, powerpc,
arm ...)
Before __builtin_unreachable(), must need an inline asm instruction
which architecture specific.
I have test using __builtin_unreachable() without an related asm
instruction before, it prints many unexpected things (please see the
attachment).
So I think, it is not suitable to use it in "asm-generic/bug.h"
Thanks.
--
Chen Gang
Asianux Corporation
[-- Attachment #2: test0.c --]
[-- Type: text/plain, Size: 1234 bytes --]
#include <stdio.h>
#include <sys/types.h>
#include <error.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
int main()
{
int file;
int ret;
char buf[0x100];
file = open("/tmp/work.c", O_RDONLY);
if (file == -1) {
printf("\nopen file failed. errno = %d\n", errno);
goto err;
} else
printf("\nopen file succeed.\n");
printf("before unreachable\n");
__builtin_unreachable();
printf("after unreachable\n");
if (lseek(file, 10, SEEK_END) < 0) {
printf("\nlseek file failed. errno = %d\n", errno);
goto err;
}
ret = read(file, buf, 0x100);
if (ret < 0) {
printf("\n1st read file failed. errno = %d, ret = %d\n", errno, ret);
goto err;
} else
printf("\n1st read file succeed. errno = %d, ret = %d\n", errno, ret);
ret = read(file, buf, 0x100);
if (ret < 0) {
printf("\n2nd read file failed. errno = %d, ret = %d\n", errno, ret);
goto err;
} else
printf("\n2nd read file succeed. errno = %d, ret = %d\n", errno, ret);
ret = read(file, buf, 0x100);
if (ret < 0) {
printf("\n2rd read file failed. errno = %d, ret = %d\n", errno, ret);
goto err;
} else
printf("\n3rd read file succeed. errno = %d, ret = %d\n", errno, ret);
return 0;
err:
return -1;
}
[-- Attachment #3: Type: text/plain, Size: 150 bytes --]
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev
next prev parent reply other threads:[~2013-05-23 10:05 UTC|newest]
Thread overview: 29+ 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 7:57 ` Chen Gang
2013-05-23 8:40 ` Geert Uytterhoeven
2013-05-23 8:54 ` Arnd Bergmann
[not found] ` <CAMuHMdU7QuzgmWCH145p8PVebBzPo8DBAvbY+0AZa2cmGXmRHw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-23 9:05 ` Russell King - ARM Linux
2013-05-23 9:12 ` Geert Uytterhoeven
2013-05-23 9:39 ` Arnd Bergmann
[not found] ` <201305231139.38233.arnd-r2nGTMty4D4@public.gmane.org>
2013-05-23 10:04 ` Russell King - ARM Linux
2013-05-23 10:41 ` Chen Gang
2013-05-23 10:59 ` Arnd Bergmann
[not found] ` <201305231259.43750.arnd-r2nGTMty4D4@public.gmane.org>
2013-05-23 11:19 ` Chen Gang
2013-05-23 11:24 ` Russell King - ARM Linux
[not found] ` <20130523112401.GO18614-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
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
[not found] ` <20130528081910.GA29557-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-28 14:55 ` H. Peter Anvin
2013-05-28 15:43 ` Arnd Bergmann
[not found] ` <201305281743.52649.arnd-r2nGTMty4D4@public.gmane.org>
2013-05-28 16:06 ` H. Peter Anvin
[not found] ` <51A4D618.3080208-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2013-05-28 17:20 ` Arnd Bergmann
2013-05-23 10:09 ` Eric W. Biederman
[not found] ` <878v369fdd.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-05-23 10:29 ` Russell King - ARM Linux
2013-05-23 10:05 ` Chen Gang [this message]
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=519DE9D6.8000707@asianux.com \
--to=gang.chen@asianux.com \
--cc=Catalin.Marinas@arm.com \
--cc=deller@gmx.de \
--cc=egtvedt@samfundet.no \
--cc=fweisbec@gmail.com \
--cc=geert@linux-m68k.org \
--cc=heiko.carstens@de.ibm.com \
--cc=hpa@zytor.com \
--cc=hskinnemoen@gmail.com \
--cc=jejb@parisc-linux.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=richard@nod.at \
--cc=user-mode-linux-devel@lists.sourceforge.net \
--cc=walken@google.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