From patchwork Sun May 26 04:43:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 2614571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 6D869DFB79 for ; Sun, 26 May 2013 04:45:04 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UgSpG-0003Co-Ag; Sun, 26 May 2013 04:44:58 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UgSpD-0000ot-IM; Sun, 26 May 2013 04:44:55 +0000 Received: from intranet.asianux.com ([58.214.24.6]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UgSp6-0000nw-L2 for linux-arm-kernel@lists.infradead.org; Sun, 26 May 2013 04:44:51 +0000 Received: by intranet.asianux.com (Postfix, from userid 103) id 5483018402BC; Sun, 26 May 2013 12:44:14 +0800 (CST) X-Spam-Score: -100.8 X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on intranet.asianux.com X-Spam-Level: X-Spam-Status: No, score=-100.8 required=5.0 tests=AWL,BAYES_00, RATWARE_GECKO_BUILD,USER_IN_WHITELIST autolearn=no version=3.1.9 Received: from [10.1.0.143] (unknown [219.143.36.82]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by intranet.asianux.com (Postfix) with ESMTP id 59B8D1840257; Sun, 26 May 2013 12:44:12 +0800 (CST) Message-ID: <51A192EA.4010607@asianux.com> Date: Sun, 26 May 2013 12:43:22 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Geert Uytterhoeven , Russell King - ARM Linux , Arnd Bergmann Subject: [PATCH v2] arch: configuration issue, random return value when disable 'CONFIG_BUG' References: <519DCBEF.3090208@asianux.com> <201305231259.43750.arnd@arndb.de> <20130523112401.GO18614@n2100.arm.linux.org.uk> <201305231409.02359.arnd@arndb.de> <20130523125033.GP18614@n2100.arm.linux.org.uk> <519ECCCF.8090909@asianux.com> <519EE9D6.9010707@asianux.com> In-Reply-To: <519EE9D6.9010707@asianux.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130526_004449_304874_B3D76077 X-CRM114-Status: GOOD ( 21.91 ) X-Spam-Score: -3.0 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Catalin Marinas , Linux-sh list , Peter Zijlstra , Benjamin Herrenschmidt , Heiko Carstens , "paulus@samba.org" , "H. Peter Anvin" , Michel Lespinasse , Hans-Christian Egtvedt , Linux-Arch , linux-s390@vger.kernel.org, Yoshinori Sato , Richard Weinberger , Helge Deller , the arch/x86 maintainers , "James E.J. Bottomley" , "mingo@redhat.com" , Frederic Weisbecker , Paul McKenney , =?UTF-8?B?SMOldmFyZCBTa2lubmVtb2Vu?= , Serge Hallyn , Mike Frysinger , uml-devel , 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 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org If user disable 'CONFIG_BUG' in menuconfig, many areas not only will report compiling warnings, but also may return a random value from the function when BUG(). In fact, most of architectures need always let 'CONFIG_BUG' enabled, so '#ifdef CONFIG_BUG' is already not 'generic' enough in "include/asm- generic/". Also kernel has already provided the 'generic' implementation in "include/asm-generic" when 'CONFIG_BUG' enabled. Even if we disable 'CONFIG_BUG', we also shall have to implement the BUG() in "include/asm- generic", just like when 'CONFIG_BUG' enabled (at least, it is not the minimal size implementation). So need remove 'CONFIG_BUG', and let it always enabled everywhere, then fix this issue. The architectures which need their own architecture specific features (e.g. minimal size implementation), can customize their own BUG() and __WARN_TAINT() to give a better fix (e.g. use one inline asm code, then followed by 'unreachable' function, or another more better fix ways). Signed-off-by: Chen Gang --- arch/arm/Kconfig | 1 - arch/avr32/Kconfig | 1 - arch/blackfin/Kconfig | 1 - arch/h8300/Kconfig | 1 - arch/hexagon/Kconfig | 1 - arch/parisc/Kconfig | 2 -- arch/powerpc/Kconfig | 1 - arch/s390/Kconfig | 2 +- arch/sh/Kconfig | 2 +- arch/um/Kconfig.common | 1 - arch/x86/Kconfig | 1 - include/asm-generic/bug.h | 29 ----------------------------- init/Kconfig | 10 ---------- lib/Kconfig.debug | 2 +- 14 files changed, 3 insertions(+), 52 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a7fc5ea..ea4a146 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -265,7 +265,6 @@ config PHYS_OFFSET config GENERIC_BUG def_bool y - depends on BUG source "init/Kconfig" diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index bdc3558..7c9005a 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig @@ -55,7 +55,6 @@ config GENERIC_CALIBRATE_DELAY config GENERIC_BUG def_bool y - depends on BUG source "init/Kconfig" diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index a117652..637dc42 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig @@ -47,7 +47,6 @@ config GENERIC_CSUM config GENERIC_BUG def_bool y - depends on BUG config ZONE_DMA def_bool y diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 303e4f9..88848da 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -56,7 +56,6 @@ config GENERIC_CALIBRATE_DELAY config GENERIC_BUG bool - depends on BUG config TIME_LOW_RES bool diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index 33a9792..f50cc8f 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -84,7 +84,6 @@ config STACKTRACE_SUPPORT config GENERIC_BUG def_bool y - depends on BUG menu "Machine selection" diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 6507dab..5de1f8c 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -10,7 +10,6 @@ config PARISC select RTC_CLASS select RTC_DRV_GENERIC select INIT_ALL_POSSIBLE - select BUG select HAVE_PERF_EVENTS select GENERIC_ATOMIC64 if !64BIT select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE @@ -62,7 +61,6 @@ config ARCH_HAS_ILOG2_U64 config GENERIC_BUG bool default y - depends on BUG config GENERIC_HWEIGHT bool diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c33e3ad..34f4ca9 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -187,7 +187,6 @@ config AUDIT_ARCH config GENERIC_BUG bool default y - depends on BUG config SYS_SUPPORTS_APM_EMULATION default y if PMAC_APM_EMU diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index da183c5..5d7b3db 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -29,7 +29,7 @@ config GENERIC_HWEIGHT def_bool y config GENERIC_BUG - def_bool y if BUG + def_bool y config GENERIC_BUG_RELATIVE_POINTERS def_bool y diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 8c868cf..d555e7f 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -84,7 +84,7 @@ config RWSEM_XCHGADD_ALGORITHM config GENERIC_BUG def_bool y - depends on BUG && SUPERH32 + depends on SUPERH32 config GENERIC_CSUM def_bool y diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common index bceee66..7aae42a 100644 --- a/arch/um/Kconfig.common +++ b/arch/um/Kconfig.common @@ -53,7 +53,6 @@ config GENERIC_CALIBRATE_DELAY config GENERIC_BUG bool default y - depends on BUG config HZ int diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 723e42e..a36e1b4 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -166,7 +166,6 @@ config GENERIC_ISA_DMA config GENERIC_BUG def_bool y - depends on BUG select GENERIC_BUG_RELATIVE_POINTERS if X86_64 config GENERIC_BUG_RELATIVE_POINTERS diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 7d10f96..5d50903 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -12,8 +12,6 @@ #ifndef __ASSEMBLY__ #include -#ifdef CONFIG_BUG - #ifdef CONFIG_GENERIC_BUG struct bug_entry { #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS @@ -106,33 +104,6 @@ extern void warn_slowpath_null(const char *file, const int line); unlikely(__ret_warn_on); \ }) -#else /* !CONFIG_BUG */ -#ifndef HAVE_ARCH_BUG -#define BUG() do {} while(0) -#endif - -#ifndef HAVE_ARCH_BUG_ON -#define BUG_ON(condition) do { if (condition) ; } while(0) -#endif - -#ifndef HAVE_ARCH_WARN_ON -#define WARN_ON(condition) ({ \ - int __ret_warn_on = !!(condition); \ - unlikely(__ret_warn_on); \ -}) -#endif - -#ifndef WARN -#define WARN(condition, format...) ({ \ - int __ret_warn_on = !!(condition); \ - unlikely(__ret_warn_on); \ -}) -#endif - -#define WARN_TAINT(condition, taint, format...) WARN_ON(condition) - -#endif - #define WARN_ON_ONCE(condition) ({ \ static bool __section(.data.unlikely) __warned; \ int __ret_warn_once = !!(condition); \ diff --git a/init/Kconfig b/init/Kconfig index 7fb26a6..bc1dd49 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1360,16 +1360,6 @@ config PRINTK very difficult to diagnose system problems, saying N here is strongly discouraged. -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. - config ELF_CORE depends on COREDUMP default y diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 566cf2b..54b3251 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -700,7 +700,7 @@ config HAVE_DEBUG_BUGVERBOSE config DEBUG_BUGVERBOSE bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT - depends on BUG && (GENERIC_BUG || HAVE_DEBUG_BUGVERBOSE) + depends on GENERIC_BUG || HAVE_DEBUG_BUGVERBOSE default y help Say Y here to make BUG() panics output the file name and line number