Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] KVM: VMX: Use ASM_INPUT_RM in __vmcs_writel
       [not found] ` <20260211102928.100944-2-ubizjak@gmail.com>
@ 2026-02-25 19:02   ` Nathan Chancellor
  0 siblings, 0 replies; only message in thread
From: Nathan Chancellor @ 2026-02-25 19:02 UTC (permalink / raw)
  To: Uros Bizjak
  Cc: kvm, x86, linux-kernel, Sean Christopherson, Paolo Bonzini,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, llvm

On Wed, Feb 11, 2026 at 11:28:50AM +0100, Uros Bizjak wrote:
> Use the ASM_INPUT_RM macro for VMCS write operation in vmx_ops.h to
> work around clang problems with "rm" asm constraint. clang seems to
> always chose the memory input, while it is almost always the worst
> choice.
> 
> 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>

Acked-by: Nathan Chancellor <nathan@kernel.org>

FWIW, I hope this issue will soon be fixed in clang properly so we can
add a version check to this workaround:

  https://github.com/llvm/llvm-project/pull/181973

> ---
>  arch/x86/kvm/vmx/vmx_ops.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/vmx/vmx_ops.h b/arch/x86/kvm/vmx/vmx_ops.h
> index 1000d37f5b0c..81784befaaf4 100644
> --- a/arch/x86/kvm/vmx/vmx_ops.h
> +++ b/arch/x86/kvm/vmx/vmx_ops.h
> @@ -221,7 +221,7 @@ fault:									\
>  
>  static __always_inline void __vmcs_writel(unsigned long field, unsigned long value)
>  {
> -	vmx_asm2(vmwrite, "r"(field), "rm"(value), field, value);
> +	vmx_asm2(vmwrite, "r" (field), ASM_INPUT_RM (value), field, value);
>  }
>  
>  static __always_inline void vmcs_write16(unsigned long field, u16 value)
> -- 
> 2.53.0
> 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-25 19:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260211102928.100944-1-ubizjak@gmail.com>
     [not found] ` <20260211102928.100944-2-ubizjak@gmail.com>
2026-02-25 19:02   ` [PATCH 2/2] KVM: VMX: Use ASM_INPUT_RM in __vmcs_writel Nathan Chancellor

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