public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] KVM: VMX: Drop obsolete branch hint prefixes from inline asm
@ 2026-02-11 10:28 Uros Bizjak
  2026-02-11 10:28 ` [PATCH 2/2] KVM: VMX: Use ASM_INPUT_RM in __vmcs_writel Uros Bizjak
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Uros Bizjak @ 2026-02-11 10:28 UTC (permalink / raw)
  To: kvm, x86, linux-kernel
  Cc: Uros Bizjak, Sean Christopherson, Paolo Bonzini, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin

Remove explicit branch hint prefixes (.byte 0x2e / 0x3e) from VMX
inline assembly sequences.

These prefixes (CS/DS segment overrides used as branch hints on
very old x86 CPUs) have been ignored by modern processors for a
long time. Keeping them provides no measurable benefit and only
enlarges the generated code.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
 arch/x86/kvm/vmx/vmx_ops.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx_ops.h b/arch/x86/kvm/vmx/vmx_ops.h
index 96677576c836..1000d37f5b0c 100644
--- a/arch/x86/kvm/vmx/vmx_ops.h
+++ b/arch/x86/kvm/vmx/vmx_ops.h
@@ -119,7 +119,6 @@ static __always_inline unsigned long __vmcs_readl(unsigned long field)
 #else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */
 
 	asm volatile("1: vmread %[field], %[output]\n\t"
-		     ".byte 0x3e\n\t" /* branch taken hint */
 		     "ja 3f\n\t"
 
 		     /*
@@ -191,7 +190,6 @@ static __always_inline unsigned long vmcs_readl(unsigned long field)
 #define vmx_asm1(insn, op1, error_args...)				\
 do {									\
 	asm goto("1: " __stringify(insn) " %0\n\t"			\
-			  ".byte 0x2e\n\t" /* branch not taken hint */	\
 			  "jna %l[error]\n\t"				\
 			  _ASM_EXTABLE(1b, %l[fault])			\
 			  : : op1 : "cc" : error, fault);		\
@@ -208,7 +206,6 @@ fault:									\
 #define vmx_asm2(insn, op1, op2, error_args...)				\
 do {									\
 	asm goto("1: "  __stringify(insn) " %1, %0\n\t"			\
-			  ".byte 0x2e\n\t" /* branch not taken hint */	\
 			  "jna %l[error]\n\t"				\
 			  _ASM_EXTABLE(1b, %l[fault])			\
 			  : : op1, op2 : "cc" : error, fault);		\
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* Re: [PATCH 1/2] KVM: VMX: Drop obsolete branch hint prefixes from inline asm
@ 2026-02-12  5:33 Christian Ludloff
  2026-02-12 16:18 ` Andrew Cooper
  0 siblings, 1 reply; 16+ messages in thread
From: Christian Ludloff @ 2026-02-12  5:33 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: bp, dave.hansen, hpa, kvm, linux-kernel, mingo, pbonzini, seanjc,
	tglx, x86, ubizjak

Andrew Cooper wrote:
> The branch-taken hint has new meaning in Lion Cove cores and later,
> along with a warning saying "performance penalty for misuse".

Make that Redwood Cove. For details, see the
Intel ORM Vol1 #248966-050 Section 2.1.1.1.

Also, for the sake of completeness, the officially
undocumented old "Alternate Taken/Not Taken"
hint on the P4 (prefix 0x64) is covered in Agner
Vol3 Section 3.4; in the 2025-12-14 pdf you can
find it in the top half of page 26 of 277.

--
C.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-03-05 17:13 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-11 10:28 [PATCH 1/2] KVM: VMX: Drop obsolete branch hint prefixes from inline asm Uros Bizjak
2026-02-11 10:28 ` [PATCH 2/2] KVM: VMX: Use ASM_INPUT_RM in __vmcs_writel Uros Bizjak
2026-02-25 19:02   ` Nathan Chancellor
2026-02-11 10:57 ` [PATCH 1/2] KVM: VMX: Drop obsolete branch hint prefixes from inline asm Andrew Cooper
2026-02-11 13:36   ` Sean Christopherson
2026-02-11 13:43   ` David Laight
2026-02-11 13:55     ` Andrew Cooper
2026-02-11 15:44       ` Sean Christopherson
2026-02-11 16:11         ` Andrew Cooper
2026-02-11 16:17           ` Sean Christopherson
2026-02-11 16:46             ` Andrew Cooper
2026-02-11 16:49               ` Sean Christopherson
2026-02-11 21:35       ` David Laight
2026-03-05 17:08 ` Sean Christopherson
  -- strict thread matches above, loose matches on Subject: below --
2026-02-12  5:33 Christian Ludloff
2026-02-12 16:18 ` Andrew Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox