Commit 97349135fea7f0ba8464534433df3bfd1dc0e9a6

Authored by Jeremy Fitzhardinge
Committed by Ingo Molnar
1 parent d8d5900ef8

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 <jeremy.fitzhardinge@citrix.com>
Cc: xen-devel <xen-devel@lists.xensource.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 2 changed files with 15 additions and 0 deletions Side-by-side Diff

... ... @@ -435,6 +435,13 @@
435 435  
436 436 endif
437 437  
  438 +config PARAVIRT_DEBUG
  439 + bool "paravirt-ops debugging"
  440 + depends on PARAVIRT && DEBUG_KERNEL
  441 + help
  442 + Enable to debug paravirt_ops internals. Specifically, BUG if
  443 + a paravirt_op is missing when it is called.
  444 +
438 445 config MEMTEST
439 446 bool "Memtest"
440 447 depends on X86_64
include/asm-x86/paravirt.h
... ... @@ -459,10 +459,17 @@
459 459 #define VEXTRA_CLOBBERS , "rax", "r8", "r9", "r10", "r11"
460 460 #endif
461 461  
  462 +#ifdef CONFIG_PARAVIRT_DEBUG
  463 +#define PVOP_TEST_NULL(op) BUG_ON(op == NULL)
  464 +#else
  465 +#define PVOP_TEST_NULL(op) ((void)op)
  466 +#endif
  467 +
462 468 #define __PVOP_CALL(rettype, op, pre, post, ...) \
463 469 ({ \
464 470 rettype __ret; \
465 471 PVOP_CALL_ARGS; \
  472 + PVOP_TEST_NULL(op); \
466 473 /* This is 32-bit specific, but is okay in 64-bit */ \
467 474 /* since this condition will never hold */ \
468 475 if (sizeof(rettype) > sizeof(unsigned long)) { \
... ... @@ -491,6 +498,7 @@
491 498 #define __PVOP_VCALL(op, pre, post, ...) \
492 499 ({ \
493 500 PVOP_VCALL_ARGS; \
  501 + PVOP_TEST_NULL(op); \
494 502 asm volatile(pre \
495 503 paravirt_alt(PARAVIRT_CALL) \
496 504 post \