From: Paolo Bonzini <pbonzini@redhat.com>
To: lantianyu1986@gmail.com
Cc: Lan Tianyu <Tianyu.Lan@microsoft.com>,
rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, michael.h.kelley@microsoft.com,
kys@microsoft.com, vkuznets@redhat.com
Subject: Re: [PATCH V2 1/2] KVM/VMX: Check ept_pointer before flushing ept tlb
Date: Fri, 14 Dec 2018 12:00:07 +0100 [thread overview]
Message-ID: <eb059d1b-78c9-035d-d601-e397df292212@redhat.com> (raw)
In-Reply-To: <20181206073437.1995-1-Tianyu.Lan@microsoft.com>
On 06/12/18 08:34, lantianyu1986@gmail.com wrote:
> From: Lan Tianyu <Tianyu.Lan@microsoft.com>
>
> This patch is to initialize ept_pointer to INVALID_PAGE and check it
> before flushing ept tlb. If ept_pointer is invalid, bypass the flush
> request.
>
> Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com>
Can you explain better *why* this patch is needed? Also, should
vmx->ept_pointer be cleared at reset time, rather than vCPU creation?
Thanks,
Paolo
> ---
> arch/x86/kvm/vmx.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index c379d0bfdcba..6577ec8cbb0f 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -1582,11 +1582,18 @@ static int vmx_hv_remote_flush_tlb(struct kvm *kvm)
> /*
> * FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE hypercall needs the address of the
> * base of EPT PML4 table, strip off EPT configuration information.
> + * If ept_pointer is invalid pointer, bypass the flush request.
> */
> if (to_kvm_vmx(kvm)->ept_pointers_match != EPT_POINTERS_MATCH) {
> - kvm_for_each_vcpu(i, vcpu, kvm)
> + kvm_for_each_vcpu(i, vcpu, kvm) {
> + u64 ept_pointer = to_vmx(vcpu)->ept_pointer;
> +
> + if (!VALID_PAGE(ept_pointer))
> + continue;
> +
> ret |= hyperv_flush_guest_mapping(
> - to_vmx(kvm_get_vcpu(kvm, i))->ept_pointer & PAGE_MASK);
> + ept_pointer & PAGE_MASK);
> + }
> } else {
> ret = hyperv_flush_guest_mapping(
> to_vmx(kvm_get_vcpu(kvm, 0))->ept_pointer & PAGE_MASK);
> @@ -11614,6 +11621,8 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
> vmx->pi_desc.nv = POSTED_INTR_VECTOR;
> vmx->pi_desc.sn = 1;
>
> + vmx->ept_pointer = INVALID_PAGE;
> +
> return &vmx->vcpu;
>
> free_vmcs:
>
next prev parent reply other threads:[~2018-12-14 11:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-06 7:34 lantianyu1986
2018-12-06 7:34 ` [PATCH V2 2/2] KVM/VMX: Fix max line length problem in the vmx_hv_remote_flush_tlb() lantianyu1986
2018-12-14 11:00 ` Paolo Bonzini [this message]
2018-12-17 14:08 ` [PATCH V2 1/2] KVM/VMX: Check ept_pointer before flushing ept tlb Tianyu Lan
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=eb059d1b-78c9-035d-d601-e397df292212@redhat.com \
--to=pbonzini@redhat.com \
--cc=Tianyu.Lan@microsoft.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=lantianyu1986@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.h.kelley@microsoft.com \
--cc=mingo@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.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
Powered by JetHome