[xen staging] xen: drop the nop() macro

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen staging] xen: drop the nop() macro

patchbot
commit 3d5adba2ffbb273a7454614189ebbe696ba3aa9a
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Fri Mar 15 13:18:04 2019 +0000
Commit:     Andrew Cooper <[hidden email]>
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 <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
    Acked-by: Jan Beulich <[hidden email]>
    Acked-by: Julien Grall <[hidden email]>
---
 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#staging

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog