mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Manuel Andreas <manuel.andreas@tum.de>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	pbonzini@redhat.com,  Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: Re: [PATCH] x86/hyper-v: Don't WARN on VM-Enter if eVMCS sees VMFUNC[63:32] != 0
Date: Wed, 21 Oct 2026 05:05:18 -0700	[thread overview]
Message-ID: <atiqfqmzRhrlLGHc@google.com> (raw)
In-Reply-To: <17ae73e9-c460-4ffc-9fc0-5fe2e8e1a08a@tum.de>

On Wed, Oct 21, 2026, Manuel Andreas wrote:
> On 10/21/26 00:56, Sean Christopherson wrote:
> > I think the WARN is correct, this code is broken.  Unless I'm missing some eVMCS
> > magic/quirk, this, and the secondary controls check, should be conditioned on the
> > field actually being used.
> > 
> > This, over two patches?
> > 
> > diff --git a/arch/x86/kvm/vmx/hyperv.c b/arch/x86/kvm/vmx/hyperv.c
> > index fa41d036acd4..a1daf8f2ec5a 100644
> > --- a/arch/x86/kvm/vmx/hyperv.c
> > +++ b/arch/x86/kvm/vmx/hyperv.c
> > @@ -169,7 +169,8 @@ int nested_evmcs_check_controls(struct vmcs12 *vmcs12)
> >  					       vmcs12->cpu_based_vm_exec_control)))
> >  		return -EINVAL;
> >  
> > -	if (CC(!nested_evmcs_is_valid_controls(EVMCS_2NDEXEC,
> > +	if (nested_cpu_has(vmcs12, CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) &&
> > +	    CC(!nested_evmcs_is_valid_controls(EVMCS_2NDEXEC,
> >  					       vmcs12->secondary_vm_exec_control)))
> >  		return -EINVAL;
> >  
> > @@ -186,11 +187,10 @@ int nested_evmcs_check_controls(struct vmcs12 *vmcs12)
> >  	 * controls in bits 63:32, i.e. dropping those bits on the consistency
> >  	 * check is intentional.
> >  	 */
> > -	if (WARN_ON_ONCE(vmcs12->vm_function_control >> 32))
> > -		return -EINVAL;
> > -
> > -	if (CC(!nested_evmcs_is_valid_controls(EVMCS_VMFUNC,
> > -					       vmcs12->vm_function_control)))
> > +	if (nested_cpu_has_vmfunc(vmcs12) &&
> > +	    (WARN_ON_ONCE(vmcs12->vm_function_control >> 32) ||
> > +	     CC(!nested_evmcs_is_valid_controls(EVMCS_VMFUNC,
> > +						vmcs12->vm_function_control))))
> >  		return -EINVAL;
> >  
> >  	return 0;
> > 
> > 
> Looks sane to me. However, I still don't see a reason for this being a
> WARN at all, what exactly is the intended signal here?

That normal, non-eVMCS VMX added support for a VMFUNC operation that lives in
bits 63:32 and thus nested_evmcs_is_valid_controls() needs to be updated to play
nice with 64-bit values.

      reply	other threads:[~2026-10-21 12:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 19:34 Manuel Andreas
2026-10-20 19:36 ` Manuel Andreas
2026-10-20 22:56 ` Sean Christopherson
2026-10-21 11:42   ` Manuel Andreas
2026-10-21 12:05     ` Sean Christopherson [this message]

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=atiqfqmzRhrlLGHc@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manuel.andreas@tum.de \
    --cc=pbonzini@redhat.com \
    --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

all inboxes | Powered by JetHome®