From: Andrew Cooper Date: Fri, 15 Mar 2019 13:18:04 +0000 (+0000) Subject: xen: drop the nop() macro X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~2458 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3d5adba2ffbb273a7454614189ebbe696ba3aa9a;p=xen.git xen: drop the nop() macro There isn't a plausible reason to insert nops into code in this manner. The sole use is in do_debug_key(), and exists to prevent the compiler optimising the tail of the function with 'jmp debugger_trap_fatal' In practice, a compiler barrier suffices just as well to prevent the tailcall, and doesn't involve inserting unnecessary instructions. Signed-off-by: Andrew Cooper Reviewed-by: Wei Liu Acked-by: Jan Beulich Acked-by: Julien Grall --- diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index c25a30ed13..4f4a660b0c 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -480,9 +480,9 @@ static void do_debug_key(unsigned char key, struct cpu_user_regs *regs) { printk("'%c' pressed -> trapping into debugger\n", key); (void)debugger_trap_fatal(0xf001, regs); - nop(); /* Prevent the compiler doing tail call - optimisation, as that confuses xendbg a - bit. */ + + /* Prevent tail call optimisation, which confuses xendbg. */ + barrier(); } static void do_toggle_alt_key(unsigned char key, struct cpu_user_regs *regs) diff --git a/xen/include/asm-arm/system.h b/xen/include/asm-arm/system.h index b94e56fe26..e5d062667d 100644 --- a/xen/include/asm-arm/system.h +++ b/xen/include/asm-arm/system.h @@ -5,9 +5,6 @@ #include #include -#define nop() \ - asm volatile ( "nop" ) - #define sev() asm volatile("sev" : : : "memory") #define wfe() asm volatile("wfe" : : : "memory") #define wfi() asm volatile("wfi" : : : "memory") diff --git a/xen/include/asm-x86/system.h b/xen/include/asm-x86/system.h index 483cd20afd..c665499e36 100644 --- a/xen/include/asm-x86/system.h +++ b/xen/include/asm-x86/system.h @@ -17,9 +17,6 @@ #define clflush(a) \ asm volatile ( "clflush (%0)" : : "r"(a) ) -#define nop() \ - asm volatile ( "nop" ) - #define xchg(ptr,v) \ ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))