From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Daney Subject: [PATCH 00/11] Add support for GCC's __builtin_unreachable() and use it in BUG (v2). Date: Mon, 14 Sep 2009 14:50:58 -0700 Message-ID: <4AAEBAC2.1050905@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, ralf@linux-mips.org, linux-mips@linux-mips.org, Martin Schwidefsky , Heiko Carstens , linux390@de.ibm.com, linux-s390@vger.kernel.org, David Howells , Koichi Yasutake , linux-am33-list@redhat.com, Kyle McMartin , Helge Deller , linux-parisc@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@ozlabs.org, Richard Henderson , Ivan Kokshaysky , linux-alpha@vger.kernel.org, Haavard Skinnemoen , Mike Frysinger , uclinux-dist-devel@blackfin.uclinux.org, Linux Kernel Maili To: Linus Torvalds , Andrew Morton Return-path: List-ID: List-Id: linux-parisc.vger.kernel.org When I sent the first version, I had not realized that Roland McGrath had only a day or two earlier submitted a very similar patch (although one that only fixed up the x86 case). I have been working on this quite a while now, starting with adding the required support to GCC, so with an eye towards finishing it up I have this new version. From the announcement of the first version: Starting with version 4.5, GCC has a new built-in function called __builtin_unreachable(). The function tells the compiler that control flow will never reach that point. Currently we trick the compiler by putting in for(;;); but this has the disadvantage that extra code is emitted for an endless loop. For an i386 kernel using __builtin_unreachable() results in an defaultconfig that is nearly 4000 bytes smaller. This patch set adds support to compiler.h creating a new macro usable in the kernel called unreachable(). If the compiler lacks __builtin_unreachable(), it just expands to for(;;). The x86 and MIPS patches I actually tested with a GCC-4.5 snapshot. Lacking the ability to test the rest of the architectures, I just did what seemed right without even trying to compile the kernel. For version 2: I fixed a couple of checkpatch issues, and simplified the unreachable() macro for the pre-GCC-4.5 case (as suggested by Richard Henderson). Also several Acked-by: were added. New in this version (as suggested by Ingo Molnar) I added 11/11 which uses unreachable() in asm-generic/bug.h for !CONFIG_BUG case. This one may be a little controversial as it will end up making code slightly larger when !CONFIG_BUG and you are using a pre-GCC-4.5 compiler. I will reply with the 11 patches. David Daney (11): Add support for GCC-4.5's __builtin_unreachable() to compiler.h (v2) x86: Convert BUG() to use unreachable() MIPS: Convert BUG() to use unreachable() s390: Convert BUG() to use unreachable() mn10300: Convert BUG() to use unreachable() parisc: Convert BUG() to use unreachable() powerpc: Convert BUG() to use unreachable() alpha: Convert BUG() to use unreachable() avr32: Convert BUG() to use unreachable() blackfin: Convert BUG() to use unreachable() Use unreachable() in asm-generic/bug.h for !CONFIG_BUG case. arch/alpha/include/asm/bug.h | 3 ++- arch/avr32/include/asm/bug.h | 2 +- arch/blackfin/include/asm/bug.h | 2 +- arch/mips/include/asm/bug.h | 4 +--- arch/mn10300/include/asm/bug.h | 3 ++- arch/parisc/include/asm/bug.h | 4 ++-- arch/powerpc/include/asm/bug.h | 2 +- arch/s390/include/asm/bug.h | 2 +- arch/x86/include/asm/bug.h | 4 ++-- include/asm-generic/bug.h | 4 ++-- include/linux/compiler-gcc4.h | 14 ++++++++++++++ include/linux/compiler.h | 5 +++++ 12 files changed, 34 insertions(+), 15 deletions(-) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757302AbZINVvU (ORCPT ); Mon, 14 Sep 2009 17:51:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757287AbZINVvR (ORCPT ); Mon, 14 Sep 2009 17:51:17 -0400 Received: from mail3.caviumnetworks.com ([12.108.191.235]:9298 "EHLO mail3.caviumnetworks.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755780AbZINVvO (ORCPT ); Mon, 14 Sep 2009 17:51:14 -0400 Message-ID: <4AAEBAC2.1050905@caviumnetworks.com> Date: Mon, 14 Sep 2009 14:50:58 -0700 From: David Daney User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Linus Torvalds , Andrew Morton CC: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, ralf@linux-mips.org, linux-mips@linux-mips.org, Martin Schwidefsky , Heiko Carstens , linux390@de.ibm.com, linux-s390@vger.kernel.org, David Howells , Koichi Yasutake , linux-am33-list@redhat.com, Kyle McMartin , Helge Deller , linux-parisc@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@ozlabs.org, Richard Henderson , Ivan Kokshaysky , linux-alpha@vger.kernel.org, Haavard Skinnemoen , Mike Frysinger , uclinux-dist-devel@blackfin.uclinux.org, Linux Kernel Mailing List , linux-arch@vger.kernel.org, Roland McGrath Subject: [PATCH 00/11] Add support for GCC's __builtin_unreachable() and use it in BUG (v2). Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 14 Sep 2009 21:50:59.0414 (UTC) FILETIME=[72114F60:01CA3585] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When I sent the first version, I had not realized that Roland McGrath had only a day or two earlier submitted a very similar patch (although one that only fixed up the x86 case). I have been working on this quite a while now, starting with adding the required support to GCC, so with an eye towards finishing it up I have this new version. From the announcement of the first version: Starting with version 4.5, GCC has a new built-in function called __builtin_unreachable(). The function tells the compiler that control flow will never reach that point. Currently we trick the compiler by putting in for(;;); but this has the disadvantage that extra code is emitted for an endless loop. For an i386 kernel using __builtin_unreachable() results in an defaultconfig that is nearly 4000 bytes smaller. This patch set adds support to compiler.h creating a new macro usable in the kernel called unreachable(). If the compiler lacks __builtin_unreachable(), it just expands to for(;;). The x86 and MIPS patches I actually tested with a GCC-4.5 snapshot. Lacking the ability to test the rest of the architectures, I just did what seemed right without even trying to compile the kernel. For version 2: I fixed a couple of checkpatch issues, and simplified the unreachable() macro for the pre-GCC-4.5 case (as suggested by Richard Henderson). Also several Acked-by: were added. New in this version (as suggested by Ingo Molnar) I added 11/11 which uses unreachable() in asm-generic/bug.h for !CONFIG_BUG case. This one may be a little controversial as it will end up making code slightly larger when !CONFIG_BUG and you are using a pre-GCC-4.5 compiler. I will reply with the 11 patches. David Daney (11): Add support for GCC-4.5's __builtin_unreachable() to compiler.h (v2) x86: Convert BUG() to use unreachable() MIPS: Convert BUG() to use unreachable() s390: Convert BUG() to use unreachable() mn10300: Convert BUG() to use unreachable() parisc: Convert BUG() to use unreachable() powerpc: Convert BUG() to use unreachable() alpha: Convert BUG() to use unreachable() avr32: Convert BUG() to use unreachable() blackfin: Convert BUG() to use unreachable() Use unreachable() in asm-generic/bug.h for !CONFIG_BUG case. arch/alpha/include/asm/bug.h | 3 ++- arch/avr32/include/asm/bug.h | 2 +- arch/blackfin/include/asm/bug.h | 2 +- arch/mips/include/asm/bug.h | 4 +--- arch/mn10300/include/asm/bug.h | 3 ++- arch/parisc/include/asm/bug.h | 4 ++-- arch/powerpc/include/asm/bug.h | 2 +- arch/s390/include/asm/bug.h | 2 +- arch/x86/include/asm/bug.h | 4 ++-- include/asm-generic/bug.h | 4 ++-- include/linux/compiler-gcc4.h | 14 ++++++++++++++ include/linux/compiler.h | 5 +++++ 12 files changed, 34 insertions(+), 15 deletions(-) From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Daney Subject: [PATCH 00/11] Add support for GCC's __builtin_unreachable() and use it in BUG (v2). Date: Mon, 14 Sep 2009 14:50:58 -0700 Message-ID: <4AAEBAC2.1050905@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Sender: linux-alpha-owner@vger.kernel.org To: Linus Torvalds , Andrew Morton Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, ralf@linux-mips.org, linux-mips@linux-mips.org, Martin Schwidefsky , Heiko Carstens , linux390@de.ibm.com, linux-s390@vger.kernel.org, David Howells , Koichi Yasutake , linux-am33-list@redhat.com, Kyle McMartin , Helge Deller , linux-parisc@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@ozlabs.org, Richard Henderson , Ivan Kokshaysky , linux-alpha@vger.kernel.org, Haavard Skinnemoen , Mike Frysinger , uclinux-dist-devel@blackfin.uclinux.org, Linux List-Id: linux-arch.vger.kernel.org When I sent the first version, I had not realized that Roland McGrath had only a day or two earlier submitted a very similar patch (although one that only fixed up the x86 case). I have been working on this quite a while now, starting with adding the required support to GCC, so with an eye towards finishing it up I have this new version. From the announcement of the first version: Starting with version 4.5, GCC has a new built-in function called __builtin_unreachable(). The function tells the compiler that control flow will never reach that point. Currently we trick the compiler by putting in for(;;); but this has the disadvantage that extra code is emitted for an endless loop. For an i386 kernel using __builtin_unreachable() results in an defaultconfig that is nearly 4000 bytes smaller. This patch set adds support to compiler.h creating a new macro usable in the kernel called unreachable(). If the compiler lacks __builtin_unreachable(), it just expands to for(;;). The x86 and MIPS patches I actually tested with a GCC-4.5 snapshot. Lacking the ability to test the rest of the architectures, I just did what seemed right without even trying to compile the kernel. For version 2: I fixed a couple of checkpatch issues, and simplified the unreachable() macro for the pre-GCC-4.5 case (as suggested by Richard Henderson). Also several Acked-by: were added. New in this version (as suggested by Ingo Molnar) I added 11/11 which uses unreachable() in asm-generic/bug.h for !CONFIG_BUG case. This one may be a little controversial as it will end up making code slightly larger when !CONFIG_BUG and you are using a pre-GCC-4.5 compiler. I will reply with the 11 patches. David Daney (11): Add support for GCC-4.5's __builtin_unreachable() to compiler.h (v2) x86: Convert BUG() to use unreachable() MIPS: Convert BUG() to use unreachable() s390: Convert BUG() to use unreachable() mn10300: Convert BUG() to use unreachable() parisc: Convert BUG() to use unreachable() powerpc: Convert BUG() to use unreachable() alpha: Convert BUG() to use unreachable() avr32: Convert BUG() to use unreachable() blackfin: Convert BUG() to use unreachable() Use unreachable() in asm-generic/bug.h for !CONFIG_BUG case. arch/alpha/include/asm/bug.h | 3 ++- arch/avr32/include/asm/bug.h | 2 +- arch/blackfin/include/asm/bug.h | 2 +- arch/mips/include/asm/bug.h | 4 +--- arch/mn10300/include/asm/bug.h | 3 ++- arch/parisc/include/asm/bug.h | 4 ++-- arch/powerpc/include/asm/bug.h | 2 +- arch/s390/include/asm/bug.h | 2 +- arch/x86/include/asm/bug.h | 4 ++-- include/asm-generic/bug.h | 4 ++-- include/linux/compiler-gcc4.h | 14 ++++++++++++++ include/linux/compiler.h | 5 +++++ 12 files changed, 34 insertions(+), 15 deletions(-) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 5BF29B6F2B for ; Tue, 15 Sep 2009 07:51:19 +1000 (EST) Received: from mail3.caviumnetworks.com (mail3.caviumnetworks.com [12.108.191.235]) by ozlabs.org (Postfix) with ESMTP id D91B0DDD04 for ; Tue, 15 Sep 2009 07:51:18 +1000 (EST) Message-ID: <4AAEBAC2.1050905@caviumnetworks.com> Date: Mon, 14 Sep 2009 14:50:58 -0700 From: David Daney MIME-Version: 1.0 To: Linus Torvalds , Andrew Morton Subject: [PATCH 00/11] Add support for GCC's __builtin_unreachable() and use it in BUG (v2). Content-Type: text/plain; charset=ISO-8859-1; format=flowed Cc: linux-mips@linux-mips.org, Heiko Carstens , linuxppc-dev@ozlabs.org, Paul Mackerras , "H. Peter Anvin" , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-am33-list@redhat.com, Helge Deller , x86@kernel.org, Ingo Molnar , Mike Frysinger , Ivan Kokshaysky , uclinux-dist-devel@blackfin.uclinux.org, Thomas Gleixner , Roland McGrath , Richard Henderson , Haavard Skinnemoen , linux-parisc@vger.kernel.org, Linux Kernel Mailing List , ralf@linux-mips.org, Kyle McMartin , linux-alpha@vger.kernel.org, Martin Schwidefsky , linux390@de.ibm.com, Koichi Yasutake List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , When I sent the first version, I had not realized that Roland McGrath had only a day or two earlier submitted a very similar patch (although one that only fixed up the x86 case). I have been working on this quite a while now, starting with adding the required support to GCC, so with an eye towards finishing it up I have this new version. From the announcement of the first version: Starting with version 4.5, GCC has a new built-in function called __builtin_unreachable(). The function tells the compiler that control flow will never reach that point. Currently we trick the compiler by putting in for(;;); but this has the disadvantage that extra code is emitted for an endless loop. For an i386 kernel using __builtin_unreachable() results in an defaultconfig that is nearly 4000 bytes smaller. This patch set adds support to compiler.h creating a new macro usable in the kernel called unreachable(). If the compiler lacks __builtin_unreachable(), it just expands to for(;;). The x86 and MIPS patches I actually tested with a GCC-4.5 snapshot. Lacking the ability to test the rest of the architectures, I just did what seemed right without even trying to compile the kernel. For version 2: I fixed a couple of checkpatch issues, and simplified the unreachable() macro for the pre-GCC-4.5 case (as suggested by Richard Henderson). Also several Acked-by: were added. New in this version (as suggested by Ingo Molnar) I added 11/11 which uses unreachable() in asm-generic/bug.h for !CONFIG_BUG case. This one may be a little controversial as it will end up making code slightly larger when !CONFIG_BUG and you are using a pre-GCC-4.5 compiler. I will reply with the 11 patches. David Daney (11): Add support for GCC-4.5's __builtin_unreachable() to compiler.h (v2) x86: Convert BUG() to use unreachable() MIPS: Convert BUG() to use unreachable() s390: Convert BUG() to use unreachable() mn10300: Convert BUG() to use unreachable() parisc: Convert BUG() to use unreachable() powerpc: Convert BUG() to use unreachable() alpha: Convert BUG() to use unreachable() avr32: Convert BUG() to use unreachable() blackfin: Convert BUG() to use unreachable() Use unreachable() in asm-generic/bug.h for !CONFIG_BUG case. arch/alpha/include/asm/bug.h | 3 ++- arch/avr32/include/asm/bug.h | 2 +- arch/blackfin/include/asm/bug.h | 2 +- arch/mips/include/asm/bug.h | 4 +--- arch/mn10300/include/asm/bug.h | 3 ++- arch/parisc/include/asm/bug.h | 4 ++-- arch/powerpc/include/asm/bug.h | 2 +- arch/s390/include/asm/bug.h | 2 +- arch/x86/include/asm/bug.h | 4 ++-- include/asm-generic/bug.h | 4 ++-- include/linux/compiler-gcc4.h | 14 ++++++++++++++ include/linux/compiler.h | 5 +++++ 12 files changed, 34 insertions(+), 15 deletions(-)