All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] Add support for GCC's __builtin_unreachable() and use it in BUG.
@ 2009-09-10 23:54 ` David Daney
  0 siblings, 0 replies; 50+ messages in thread
From: David Daney @ 2009-09-10 23:54 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, ralf,
	linux-mips, Martin Schwidefsky, Heiko Carstens, linux390,
	linux-s390, David Howells, Koichi Yasutake, linux-am33-list,
	Kyle McMartin, Helge Deller, linux-parisc,
	Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Richard Henderson, Ivan Kokshaysky, linux-alpha,
	Haavard Skinnemoen, Mike Frysinger, uclinux-dist-devel

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 allyesconfig 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.

01/10 adds the compiler.h support, the rest of the patches retrofit
the various architecture BUG macros to use it instead of for(;;) or
while(1) loops.

I will reply with the 10 patches.

The architecture specific patches I will send to a smaller set of
people.

David Daney (10):
   Add support for GCC-4.5's __builtin_unreachable() to compiler.h
   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()

  arch/alpha/include/asm/bug.h    |    2 +-
  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/linux/compiler-gcc4.h   |   14 ++++++++++++++
  include/linux/compiler.h        |    5 +++++
  11 files changed, 31 insertions(+), 13 deletions(-)


^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2009-09-28  3:20 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-10 23:54 [PATCH 00/10] Add support for GCC's __builtin_unreachable() and use it in BUG David Daney
2009-09-10 23:54 ` David Daney
2009-09-10 23:56 ` [PATCH 01/10] Add support for GCC-4.5's __builtin_unreachable() to compiler.h David Daney
2009-09-10 23:56   ` David Daney
2009-09-10 23:56   ` David Daney
2009-09-10 23:56   ` David Daney
2009-09-11  0:14   ` Richard Henderson
2009-09-11  0:14     ` Richard Henderson
2009-09-11  0:14     ` Richard Henderson
2009-09-11 14:32   ` Michael Buesch
2009-09-11 14:32     ` Michael Buesch
2009-09-11 14:32     ` Michael Buesch
2009-09-11 15:58     ` David Daney
2009-09-11 15:58       ` David Daney
2009-09-11 15:58       ` David Daney
2009-09-11 15:58       ` David Daney
2009-09-12  7:22       ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-14 15:40         ` David Daney
2009-09-14 15:40           ` David Daney
2009-09-14 15:40           ` David Daney
2009-09-14 15:40           ` David Daney
2009-09-10 23:56 ` [PATCH 02/10] x86: Convert BUG() to use unreachable() David Daney
2009-09-11  0:56   ` H. Peter Anvin
2009-09-11  1:09     ` Roland McGrath
2009-09-11  1:13     ` Linus Torvalds
2009-09-11  1:33       ` H. Peter Anvin
2009-09-11  1:37       ` Roland McGrath
2009-09-11  1:42         ` H. Peter Anvin
2009-09-11  6:07       ` Ingo Molnar
2009-09-11 15:55         ` David Daney
2009-09-13 20:12           ` H. Peter Anvin
2009-09-10 23:56 ` [PATCH 03/10] MIPS: " David Daney
2009-09-10 23:56 ` [PATCH 04/10] s390: " David Daney
2009-09-11 12:18   ` Martin Schwidefsky
2009-09-11 12:18     ` Martin Schwidefsky
2009-09-10 23:56 ` [PATCH 05/10] mn10300: " David Daney
2009-09-10 23:56 ` [PATCH 06/10] parisc: " David Daney
2009-09-28  3:20   ` Kyle McMartin
2009-09-10 23:56 ` [PATCH 07/10] powerpc: " David Daney
2009-09-10 23:56   ` David Daney
2009-09-10 23:56 ` [PATCH 08/10] alpha: " David Daney
2009-09-10 23:56 ` [PATCH 09/10] avr32: " David Daney
2009-09-11  7:31   ` Haavard Skinnemoen
2009-09-10 23:56 ` [PATCH 10/10] blackfin: " David Daney
2009-09-24  3:37 ` [PATCH 00/10] Add support for GCC's __builtin_unreachable() and use it in BUG Benjamin Herrenschmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.