From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: [PATCH] x86/alternatives: Force inline stac() and clac() Date: Mon, 18 Aug 2014 17:08:57 +0100 Message-ID: <1408378137-16138-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Jan Beulich List-Id: xen-devel@lists.xenproject.org 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 ":" 6 $ objdump -d xen-syms | grep -o "callq [0-9a-f]\+ " | uniq -c 5 callq ffff82d0801166c9 20 callq ffff82d08015ef99 4 callq ffff82d080165169 8 callq ffff82d080188cb9 3 callq ffff82d080228779 4 callq ffff82d08022c5c9 Forcing always_inline removes these functions, and replaces each of the callqs with the expected 3byte nops. Signed-off-by: Andrew Cooper CC: Jan Beulich --- xen/include/asm-x86/asm_defns.h | 4 ++-- 1 file 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); -- 1.7.10.4