Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753026AbdLMNfZ (ORCPT ); Wed, 13 Dec 2017 08:35:25 -0500 Received: from merlin.infradead.org ([205.233.59.134]:43668 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752786AbdLMNfY (ORCPT ); Wed, 13 Dec 2017 08:35:24 -0500 Date: Wed, 13 Dec 2017 14:35:15 +0100 From: Peter Zijlstra To: Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Wanpeng Li Subject: Re: [PATCH v8 3/4] KVM: X86: introduce invalidate_gpa argument to tlb flush Message-ID: <20171213133515.h6ky65rgrfwutxei@hirez.programming.kicks-ass.net> References: <1513128784-5924-1-git-send-email-wanpeng.li@hotmail.com> <1513128784-5924-4-git-send-email-wanpeng.li@hotmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1513128784-5924-4-git-send-email-wanpeng.li@hotmail.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1402 Lines: 44 On Tue, Dec 12, 2017 at 05:33:03PM -0800, Wanpeng Li wrote: > From: Wanpeng Li > > Introduce a new bool invalidate_gpa argument to kvm_x86_ops->tlb_flush, > it will be used by later patches to just flush guest tlb. As opposed to what? Will it now also flush host TLB? Why would it ever want to flush host TLBs? > @@ -4785,7 +4785,7 @@ static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr) > return 0; > } > > -static void svm_flush_tlb(struct kvm_vcpu *vcpu) > +static void svm_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa) > { > struct vcpu_svm *svm = to_svm(vcpu); > So this is a no-op for SVM. > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index ef7d13e..c179175 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -4140,9 +4140,10 @@ static void exit_lmode(struct kvm_vcpu *vcpu) > > #endif > > -static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid) > +static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid, > + bool invalidate_gpa) > { > - if (enable_ept) { > + if (enable_ept && (invalidate_gpa || !enable_vpid)) { > if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) > return; > ept_sync_context(construct_eptp(vcpu, vcpu->arch.mmu.root_hpa)); And for EPT you explicitly fall back to INVPVID when !gpa. Why? This really needs a better changelog; this is incomprehensible.