From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings Date: Sun, 11 Jan 2009 11:20:42 +0200 Message-ID: <4969B9EA.10801@redhat.com> References: <20090111091233.GB4040@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexander Graf , kvm@vger.kernel.org, joerg.roedel@amd.com To: Marcelo Tosatti Return-path: Received: from mx2.redhat.com ([66.187.237.31]:41978 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbZAKJUr (ORCPT ); Sun, 11 Jan 2009 04:20:47 -0500 In-Reply-To: <20090111091233.GB4040@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Marcelo Tosatti wrote: > On Wed, Jan 07, 2009 at 01:32:41PM +0200, Avi Kivity wrote: > >> Marcelo Tosatti wrote: >> >>> Let me shoot at one direction: a shadow page with PGE bit in either >>> state is created. Later that shadow page is nuked (via mmu notifiers, >>> for example). >>> >> I doubt that mmu notifiers were invoked in this case (the bug would be >> very rare); in any case we flush the tlb. >> > > There are other events that zap shadow pages. Anyway, someone else > should figure why NPT dislikes duplicate shadow page tables for > the same address space. How about this, untested: > > KVM: MMU: zero base_role on TDP mmu context initialization > > A recent change which propagates CR4.PGE to shadow page roles broke NPT, > perhaps due to the allocation of duplicate shadow trees for the same > address space (actual details unknown). > > In the meantime, since guest CR4.PGE is controlled by HW with > NPT, and the relevant role information for TDP is passed directly to > kvm_mmu_get_page, zero base_role on TDP mmu context init. > > Signed-off-by: Marcelo Tosatti > > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > index 10bdb2a..44ffcf6 100644 > --- a/arch/x86/kvm/mmu.c > +++ b/arch/x86/kvm/mmu.c > @@ -2231,6 +2231,8 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) > context->root_level = PT32_ROOT_LEVEL; > } > > + vcpu->arch.mmu.base_role = 0; > + > return 0; > } > > Won't even compile, will it? -- error compiling committee.c: too many arguments to function