Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 2/4] KVM: nVMX: Make VMPTRST return eVMCS GPA when it is used
Date: Fri, 14 Aug 2026 09:44:36 -0700	[thread overview]
Message-ID: <an9F9EJj4yLkc8Op@google.com> (raw)
In-Reply-To: <20260814163207.D8C5D1F000E9@smtp.kernel.org>

On Fri, Aug 14, 2026, sashiko-bot@kernel.org wrote:
> > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> > index c78c67525ac9b..d13a4d47bc68f 100644
> > --- a/arch/x86/kvm/vmx/nested.c
> > +++ b/arch/x86/kvm/vmx/nested.c
> [ ... ]
> > @@ -5958,8 +5958,14 @@ static int handle_vmptrst(struct kvm_vcpu *vcpu)
> >  	if (!nested_vmx_check_permission(vcpu))
> >  		return 1;
> >  
> > -	if (unlikely(nested_vmx_is_evmptr12_valid(to_vmx(vcpu))))
> > -		return 1;
> > +	/*
> > +	 * Hyper-V TLFS does not specify the behavior of VMPTRST when eVMCS is used
> > +	 * but genuine Hyper-V seems to be returning eVMCS GPA.
> > +	 */
> > +	if (nested_vmx_is_evmptr12_valid(to_vmx(vcpu)))
> > +		current_vmptr = to_vmx(vcpu)->nested.hv_evmcs_vmptr;
> 
> [Severity: Low]
> Will this cause a build failure when CONFIG_KVM_HYPERV is disabled?
> 
> Because nested_vmx_is_evmptr12_valid() is a static inline function rather
> than a preprocessor macro, the compiler still evaluates and type-checks
> this branch even when the helper is hardcoded to return false. If the
> hv_evmcs_vmptr member in struct nested_vmx is conditionally compiled based
> on CONFIG_KVM_HYPERV, the compiler will fail to find it here.

Yep.

arch/x86/kvm/vmx/nested.c: In function ‘handle_vmptrst’:
arch/x86/kvm/vmx/nested.c:5971:53: error: ‘struct nested_vmx’ has no member named ‘hv_evmcs_vmptr’
 5971 |                 current_vmptr = to_vmx(vcpu)->nested.hv_evmcs_vmptr;
      |                                                     ^

  reply	other threads:[~2026-08-14 16:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 16:22 [PATCH 0/4] KVM: nVMX: Adjust VMPTRLD/VMPTRST behavior with active eVMCS Vitaly Kuznetsov
2026-08-14 16:22 ` [PATCH 1/4] KVM: nVMX: Make VMPTRLD result in #UD when eVMCS is used Vitaly Kuznetsov
2026-08-14 16:31   ` sashiko-bot
2026-08-14 16:43     ` Sean Christopherson
2026-08-14 16:22 ` [PATCH 2/4] KVM: nVMX: Make VMPTRST return eVMCS GPA when it " Vitaly Kuznetsov
2026-08-14 16:32   ` sashiko-bot
2026-08-14 16:44     ` Sean Christopherson [this message]
2026-08-14 16:22 ` [PATCH 3/4] KVM: selftests: Adapt to the updated VMPTRST behavior when eVMCS " Vitaly Kuznetsov
2026-08-14 16:31   ` sashiko-bot
2026-08-14 16:22 ` [PATCH 4/4] KVM: selftests: Check VMPTRLD with active eVMCS Vitaly Kuznetsov
2026-08-14 16:31   ` sashiko-bot

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=an9F9EJj4yLkc8Op@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkuznets@redhat.com \
    /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