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

[Xen-changelog] [xen master] x86/alternatives: force inline stac() and clac()



commit b050edf7d82a6179bf9d9c4b602484af3ab99c1c
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Aug 22 14:33:14 2014 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Aug 22 14:33:14 2014 +0200

    x86/alternatives: force inline stac() and clac()
    
    In this case, we know better than the compiler.
    
    gcc 4.7 (Debian Wheezy) chooses to create translation-unit-local functions
    (even for non-debug builds) named stac() and clac(), and calls them.
    
    $ objdump -d xen-syms | grep -c "<stac>:"
    6
    
    $ objdump -d xen-syms | grep -o "callq  [0-9a-f]\+ <stac>" | uniq -c
          5 callq  ffff82d0801166c9 <stac>
         20 callq  ffff82d08015ef99 <stac>
          4 callq  ffff82d080165169 <stac>
          8 callq  ffff82d080188cb9 <stac>
          3 callq  ffff82d080228779 <stac>
          4 callq  ffff82d08022c5c9 <stac>
    
    Forcing always_inline removes these functions, and replaces each of the 
callqs
    with the expected 3byte nops.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/include/asm-x86/asm_defns.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h
index f8ef1f8..1674c7c 100644
--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -179,13 +179,13 @@ void ret_from_intr(void);
 #define ASM_STAC ASM_AC(STAC)
 #define ASM_CLAC ASM_AC(CLAC)
 #else
-static inline void clac(void)
+static always_inline void clac(void)
 {
     /* Note: a barrier is implicit in alternative() */
     alternative(ASM_NOP3, __stringify(__ASM_CLAC), X86_FEATURE_SMAP);
 }
 
-static inline void stac(void)
+static always_inline void stac(void)
 {
     /* Note: a barrier is implicit in alternative() */
     alternative(ASM_NOP3, __stringify(__ASM_STAC), X86_FEATURE_SMAP);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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