From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] KVM: Defer remote tlb flushes on invlpg (v2) Date: Tue, 17 Mar 2009 16:47:23 -0300 Message-ID: <20090317194723.GA11703@amt.cnet> References: <1237201670-5572-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andrea Arcangeli , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:56936 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753656AbZCQTsc (ORCPT ); Tue, 17 Mar 2009 15:48:32 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n2HJmVgd028168 for ; Tue, 17 Mar 2009 15:48:31 -0400 Content-Disposition: inline In-Reply-To: <1237201670-5572-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Mar 16, 2009 at 01:07:50PM +0200, Avi Kivity wrote: > KVM flushes tlbs on remote cpus for two purposes: to protect guest pages > that it needs to collect information about, and to prevent stale tlb entries > from pointing to pages that no longer belong to the guest. > > We can defer the latter flushes to the point when we actually free the pages, > which is during an mmu notifier invocation. To this end, we add a new state > remote_tlbs_dirty which marks whether the guest tlb might be inconsistent > with the the shadow page tables. Whenever we do a conditional flush of > remote tlbs, we check this state, and if the remote tlbs are dirty we flush > them to ensure no inconsistency. > > [v2: add help kvm_flush_remote_tlbs_cond() to remove the need for callers > to care about the new logic] Looks good, but Andrea should ack.