[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen: drop the nop() macro



commit 3d5adba2ffbb273a7454614189ebbe696ba3aa9a
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Mar 15 13:18:04 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Mar 15 14:36:07 2019 +0000

    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 <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Julien Grall <julien.grall@xxxxxxx>
---
 xen/common/keyhandler.c      | 6 +++---
 xen/include/asm-arm/system.h | 3 ---
 xen/include/asm-x86/system.h | 3 ---
 3 files changed, 3 insertions(+), 9 deletions(-)

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 <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")
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))))
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.