From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [patch 2/3] KVM: MMU: skip global pgtables on sync due to cr3 switch Date: Sun, 26 Oct 2008 13:27:34 +0200 Message-ID: <49045426.1080807@redhat.com> References: <20081025223111.498934405@localhost.localdomain> <20081025223243.863908646@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx2.redhat.com ([66.187.237.31]:59790 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751962AbYJZL1i (ORCPT ); Sun, 26 Oct 2008 07:27:38 -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 m9QBRbkh003363 for ; Sun, 26 Oct 2008 07:27:37 -0400 In-Reply-To: <20081025223243.863908646@localhost.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: 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. 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. -- error compiling committee.c: too many arguments to function