]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
xen: drop the nop() macro
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 15 Mar 2019 13:18:04 +0000 (13:18 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 15 Mar 2019 14:36:07 +0000 (14:36 +0000)
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 <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
xen/common/keyhandler.c
xen/include/asm-arm/system.h
xen/include/asm-x86/system.h

index c25a30ed137a22a60fa65ef7e1d629c9257e6bf7..4f4a660b0cf035e57cdc6b30c8a9e5446ed5ac1a 100644 (file)
@@ -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)
index b94e56fe264aa1db15d2b5d922d2dc21693d599a..e5d062667ddb1076e59a709965d283aaf9331638 100644 (file)
@@ -5,9 +5,6 @@
 #include <xen/lib.h>
 #include <public/arch-arm.h>
 
-#define nop() \
-    asm volatile ( "nop" )
-
 #define sev()           asm volatile("sev" : : : "memory")
 #define wfe()           asm volatile("wfe" : : : "memory")
 #define wfi()           asm volatile("wfi" : : : "memory")
index 483cd20afd6aa75caaa7548c6816aa407600c1ea..c665499e36e897c8fdd0e8aa3bbaa5ae01127039 100644 (file)
@@ -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))))