From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vitaly Kuznetsov Subject: Re: [RFC Patch 3/3] KVM/x86: Add tlb_remote_flush callback support for vmcs Date: Thu, 14 Jun 2018 12:33:53 +0200 Message-ID: <87d0wtpsha.fsf@vitty.brq.redhat.com> References: <20180604090749.489-1-Tianyu.Lan@microsoft.com> <20180604090749.489-4-Tianyu.Lan@microsoft.com> <87h8m8qbso.fsf@vitty.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain Cc: "pbonzini\@redhat.com" , "rkrcmar\@redhat.com" , "tglx\@linutronix.de" , "mingo\@redhat.com" , "hpa\@zytor.com" , "x86\@kernel.org" , "kvm\@vger.kernel.org" , "linux-kernel\@vger.kernel.org" , KY Srinivasan To: Tianyu Lan Return-path: In-Reply-To: (Tianyu Lan's message of "Thu, 14 Jun 2018 10:13:46 +0000") Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Tianyu Lan writes: > On 6/12/2018 11:12 PM, Vitaly Kuznetsov wrote: >> Tianyu Lan writes: >> >>> >>> +static int vmx_remote_flush_tlb(struct kvm *kvm) >>> +{ >>> + struct kvm_vcpu *vcpu = kvm_get_vcpu(kvm, 0); >>> + >>> + if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) >>> + return -1; >> >> Why vcpu0? Can arch.mmu.root_hpa-s differ across vCPUs? What happens if >> they do? > > Yes, it may take place that arch.mmu.root_hpa is differ across vCPUs. > We may check all vcpu root_hpa and use the hypercall when there is only > one validated ept table. If not, go back to current way. > I'd suggest an optimization: keep track of wether root_hpas are equal across all vcpus (check this on change). -- Vitaly