From: Sean Christopherson <seanjc@google.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>,
linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, Tianyu Lan <ltykernel@gmail.com>,
Michael Kelley <mikelley@microsoft.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] KVM: SVM: Flush Hyper-V TLB when required
Date: Wed, 22 Mar 2023 10:01:49 -0700 [thread overview]
Message-ID: <ZBs0fTo72LjnR22r@google.com> (raw)
In-Reply-To: <87355wralt.fsf@redhat.com>
On Wed, Mar 22, 2023, Vitaly Kuznetsov wrote:
> Sean Christopherson <seanjc@google.com> writes:
> > diff --git a/arch/x86/kvm/svm/svm_onhyperv.h b/arch/x86/kvm/svm/svm_onhyperv.h
> > index cff838f15db5..d91e019fb7da 100644
> > --- a/arch/x86/kvm/svm/svm_onhyperv.h
> > +++ b/arch/x86/kvm/svm/svm_onhyperv.h
> > @@ -15,6 +15,13 @@ static struct kvm_x86_ops svm_x86_ops;
> >
> > int svm_hv_enable_l2_tlb_flush(struct kvm_vcpu *vcpu);
> >
> > +static inline bool svm_hv_is_enlightened_tlb_enabled(struct kvm_vcpu *vcpu)
> > +{
> > + struct hv_vmcb_enlightenments *hve = &to_svm(vcpu)->vmcb->control.hv_enlightenments;
> > +
> > + return !!hve->hv_enlightenments_control.enlightened_npt_tlb;
>
> In theory, we should not look at Hyper-V enlightenments in VMCB control
> just because our kernel has CONFIG_HYPERV enabled.
Oooh, right, because hv_enlightenments uses software reserved bits, and in theory
KVM could be running on a different hypervisor that uses those bits for something
completely different.
> I'd suggest we add a
> real check that we're running on Hyper-V and we can do it the same way
> it is done in svm_hv_hardware_setup()/svm_hv_init_vmcb():
>
> return (ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB)
> && !!hve->hv_enlightenments_control.enlightened_npt_tlb;
Jeremi, if you grab this, can you put the && on the previous line? I.e.
return (ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB) &&
!!hve->hv_enlightenments_control.enlightened_npt_tlb;
next prev parent reply other threads:[~2023-03-22 17:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 18:51 [PATCH] KVM: SVM: Flush Hyper-V TLB when required Jeremi Piotrowski
2023-03-22 16:20 ` Sean Christopherson
2023-03-22 16:53 ` Vitaly Kuznetsov
2023-03-22 17:01 ` Sean Christopherson [this message]
2023-03-22 17:07 ` Jeremi Piotrowski
2023-03-24 13:42 ` Jeremi Piotrowski
2023-03-24 14:10 ` 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=ZBs0fTo72LjnR22r@google.com \
--to=seanjc@google.com \
--cc=jpiotrowski@linux.microsoft.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ltykernel@gmail.com \
--cc=mikelley@microsoft.com \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.