public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: kvm@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	llvm@lists.linux.dev
Subject: Re: [PATCH 2/2] KVM: VMX: Use ASM_INPUT_RM in __vmcs_writel
Date: Wed, 25 Feb 2026 12:02:13 -0700	[thread overview]
Message-ID: <20260225190213.GA2755431@ax162> (raw)
In-Reply-To: <20260211102928.100944-2-ubizjak@gmail.com>

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
> 

  reply	other threads:[~2026-02-25 19:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260225190213.GA2755431@ax162 \
    --to=nathan@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@kernel.org \
    --cc=ubizjak@gmail.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox