From: Jeremy Fitzhardinge Date: Wed, 25 Jun 2008 04:19:14 +0000 (-0400) Subject: x86/paravirt: add debugging for missing operations X-Git-Tag: v2.6.27-rc1~1106^2~138 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97349135fea7f0ba8464534433df3bfd1dc0e9a6;p=linux-2.6 x86/paravirt: add debugging for missing operations Rather than just jumping to 0 when there's a missing operation, raise a BUG. Signed-off-by: Jeremy Fitzhardinge Cc: xen-devel Cc: Stephen Tweedie Cc: Eduardo Habkost Cc: Mark McLoughlin Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 9441e46cb4..67e5275f03 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -435,6 +435,13 @@ config PARAVIRT_CLOCK endif +config PARAVIRT_DEBUG + bool "paravirt-ops debugging" + depends on PARAVIRT && DEBUG_KERNEL + help + Enable to debug paravirt_ops internals. Specifically, BUG if + a paravirt_op is missing when it is called. + config MEMTEST bool "Memtest" depends on X86_64 diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h index 5467e2cff4..198293bed4 100644 --- a/include/asm-x86/paravirt.h +++ b/include/asm-x86/paravirt.h @@ -459,10 +459,17 @@ int paravirt_disable_iospace(void); #define VEXTRA_CLOBBERS , "rax", "r8", "r9", "r10", "r11" #endif +#ifdef CONFIG_PARAVIRT_DEBUG +#define PVOP_TEST_NULL(op) BUG_ON(op == NULL) +#else +#define PVOP_TEST_NULL(op) ((void)op) +#endif + #define __PVOP_CALL(rettype, op, pre, post, ...) \ ({ \ rettype __ret; \ PVOP_CALL_ARGS; \ + PVOP_TEST_NULL(op); \ /* This is 32-bit specific, but is okay in 64-bit */ \ /* since this condition will never hold */ \ if (sizeof(rettype) > sizeof(unsigned long)) { \ @@ -491,6 +498,7 @@ int paravirt_disable_iospace(void); #define __PVOP_VCALL(op, pre, post, ...) \ ({ \ PVOP_VCALL_ARGS; \ + PVOP_TEST_NULL(op); \ asm volatile(pre \ paravirt_alt(PARAVIRT_CALL) \ post \