From patchwork Sun Jan 11 09:12:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 1761 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0B991bI011358 for ; Sun, 11 Jan 2009 01:09:02 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751097AbZAKJMt (ORCPT ); Sun, 11 Jan 2009 04:12:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750998AbZAKJMs (ORCPT ); Sun, 11 Jan 2009 04:12:48 -0500 Received: from mx2.redhat.com ([66.187.237.31]:34113 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbZAKJMq (ORCPT ); Sun, 11 Jan 2009 04:12:46 -0500 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 n0B9ChkE004800; Sun, 11 Jan 2009 04:12:43 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0B9CgTp019738; Sun, 11 Jan 2009 04:12:43 -0500 Received: from amt.cnet (vpn-10-43.str.redhat.com [10.32.10.43]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0B9CePL031541; Sun, 11 Jan 2009 04:12:41 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 8BD1768024E; Sun, 11 Jan 2009 07:12:36 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n0B9CXpP004148; Sun, 11 Jan 2009 07:12:33 -0200 Date: Sun, 11 Jan 2009 07:12:33 -0200 From: Marcelo Tosatti To: Avi Kivity Cc: Alexander Graf , kvm@vger.kernel.org, joerg.roedel@amd.com Subject: Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings Message-ID: <20090111091233.GB4040@amt.cnet> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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; }