ia64/xen-unstable

changeset 19473:2fa1d38097da

Use unlikely() in BUG_ON()/WARN_ON()

-fno-reorder-blocks was added in c/s 1712, when x86-64 just started to
become enabled. The reason it got added is entirely unclear to me, and
it prevents the intended effect of unlikely() constructs (in
particular
the ones added here) of moving out of line code which is expected to
never get executed, as well as using forward branches (which are
statically predicted taken by various processors' branch prediction
units) preferably to reach infrequently executed code.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 31 13:22:12 2009 +0100 (2009-03-31)
parents 4b602fff137b
children 69108560c7eb
files xen/arch/x86/Rules.mk xen/include/xen/lib.h
line diff
     1.1 --- a/xen/arch/x86/Rules.mk	Tue Mar 31 13:21:36 2009 +0100
     1.2 +++ b/xen/arch/x86/Rules.mk	Tue Mar 31 13:22:12 2009 +0100
     1.3 @@ -42,7 +42,7 @@ x86_64 := n
     1.4  endif
     1.5  
     1.6  ifeq ($(TARGET_SUBARCH),x86_64)
     1.7 -CFLAGS += -mno-red-zone -fpic -fno-reorder-blocks
     1.8 +CFLAGS += -mno-red-zone -fpic
     1.9  CFLAGS += -fno-asynchronous-unwind-tables
    1.10  # -fvisibility=hidden reduces -fpic cost, if it's available
    1.11  ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n)
     2.1 --- a/xen/include/xen/lib.h	Tue Mar 31 13:21:36 2009 +0100
     2.2 +++ b/xen/include/xen/lib.h	Tue Mar 31 13:22:12 2009 +0100
     2.3 @@ -12,8 +12,8 @@
     2.4  void __bug(char *file, int line) __attribute__((noreturn));
     2.5  void __warn(char *file, int line);
     2.6  
     2.7 -#define BUG_ON(p)  do { if (p) BUG();  } while (0)
     2.8 -#define WARN_ON(p) do { if (p) WARN(); } while (0)
     2.9 +#define BUG_ON(p)  do { if (unlikely(p)) BUG();  } while (0)
    2.10 +#define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
    2.11  
    2.12  /* Force a compilation error if condition is true */
    2.13  #define BUILD_BUG_ON(condition) ((void)sizeof(struct { int:-!!(condition); }))