From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from intranet.asianux.com (intranet.asianux.com [58.214.24.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 433A02C008A for ; Thu, 23 May 2013 20:06:14 +1000 (EST) Message-ID: <519DE9D6.8000707@asianux.com> Date: Thu, 23 May 2013 18:05:10 +0800 From: Chen Gang MIME-Version: 1.0 To: Geert Uytterhoeven Subject: Re: [PATCH] arch: configuration, deleting 'CONFIG_BUG' since always need it. References: <519DCBEF.3090208@asianux.com> <20130523090534.GJ18614@n2100.arm.linux.org.uk> In-Reply-To: Content-Type: multipart/mixed; boundary="------------060108040408020204060404" Cc: Catalin Marinas , Linux-sh list , Heiko Carstens , "paulus@samba.org" , "H. Peter Anvin" , Michel Lespinasse , Hans-Christian Egtvedt , Linux-Arch , linux-s390@vger.kernel.org, Russell King - ARM Linux , uml-devel , Yoshinori Sato , Richard Weinberger , Helge Deller , the arch/x86 maintainers , "James E.J. Bottomley" , "mingo@redhat.com" , Frederic Weisbecker , Paul McKenney , =?UTF-8?B?SMOldmFy?= =?UTF-8?B?ZCBTa2lubmVtb2Vu?= , Serge Hallyn , Mike Frysinger , Arnd Bergmann , Will Deacon , Jeff Dike , Akinobu Mita , uml-user , "uclinux-dist-devel@blackfin.uclinux.org" , Thomas Gleixner , "linux-arm-kernel@lists.infradead.org" , Parisc List , "linux-kernel@vger.kernel.org" , Richard Kuo , Paul Mundt , "Eric W. Biederman" , linux-hexagon@vger.kernel.org, Martin Schwidefsky , linux390@de.ibm.com, Andrew Morton , "linuxppc-dev@lists.ozlabs.org" , David Miller List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , This is a multi-part message in MIME format. --------------060108040408020204060404 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 05/23/2013 05:12 PM, Geert Uytterhoeven wrote: > On Thu, May 23, 2013 at 11:05 AM, Russell King - ARM Linux > 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 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 --------------060108040408020204060404 Content-Type: text/plain; charset=UTF-8; name="test0.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test0.c" I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzeXMvdHlwZXMuaD4KI2luY2x1ZGUgPGVy cm9yLmg+CiNpbmNsdWRlIDxlcnJuby5oPgojaW5jbHVkZSA8ZmNudGwuaD4KI2luY2x1ZGUg PHVuaXN0ZC5oPgojaW5jbHVkZSA8c3lzL3N0YXQuaD4KCmludCBtYWluKCkKewoJaW50IGZp bGU7CglpbnQgcmV0OwoJY2hhciBidWZbMHgxMDBdOwoKCWZpbGUgPSBvcGVuKCIvdG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