From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 2/3] KVM: MMU: skip global pgtables on sync due to cr3 switch Date: Fri, 31 Oct 2008 17:36:03 -0200 Message-ID: <20081031193603.GC21772@dmt.cnet> References: <20081025223111.498934405@localhost.localdomain> <20081025223243.863908646@localhost.localdomain> <49045426.1080807@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:42310 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751364AbYJaThX (ORCPT ); Fri, 31 Oct 2008 15:37:23 -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 m9VJbMGJ025807 for ; Fri, 31 Oct 2008 15:37:22 -0400 Content-Disposition: inline In-Reply-To: <49045426.1080807@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Oct 26, 2008 at 01:27:34PM +0200, Avi Kivity wrote: > Marcelo Tosatti wrote: >> Skip syncing global pages on cr3 switch (but not on cr4/cr0). This is >> important for Linux 32-bit guests with PAE, where the kmap page is >> marked as global. >> >> > > Patch is good, but won't apply without the first. > >> { >> u64 spte; >> int ret = 0; >> u64 mt_mask = shadow_mt_mask; >> + struct kvm_mmu_page *sp = page_header(__pa(shadow_pte)); >> + >> + if (!global && sp->global) { >> + sp->global = 0; >> > > A slight deficiency in this approach is that a page can't transition > from !global to global. I don't think this is frequent, so we don't > need to deal with it. Yep. > But a more accurate approach is to keep a count > of non-global present mappings, and to activate the global logic when > this count is nonzero. I don't think the overhead it adds is significant for the added complexity?