From patchwork Wed Jan 7 13:46:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 1166 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 n07DhBS8010155 for ; Wed, 7 Jan 2009 05:43:12 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752025AbZAGNqY (ORCPT ); Wed, 7 Jan 2009 08:46:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757325AbZAGNqX (ORCPT ); Wed, 7 Jan 2009 08:46:23 -0500 Received: from mx2.redhat.com ([66.187.237.31]:33641 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752025AbZAGNqW (ORCPT ); Wed, 7 Jan 2009 08:46:22 -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 n07DkKlA025392; Wed, 7 Jan 2009 08:46:20 -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 n07DkK2J016816; Wed, 7 Jan 2009 08:46:20 -0500 Received: from amt.cnet (vpn-10-147.str.redhat.com [10.32.10.147]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n07DkHaf007837; Wed, 7 Jan 2009 08:46:18 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id D3475680254; Wed, 7 Jan 2009 11:46:11 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n07Dk6oR005032; Wed, 7 Jan 2009 11:46:06 -0200 Date: Wed, 7 Jan 2009 11:46:06 -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: <20090107134606.GA4977@amt.cnet> References: <20081221184146.8E00B250012@cleopatra.tlv.redhat.com> <49621FA9.5080903@suse.de> <49633564.7070403@redhat.com> <20090106141151.GA3701@amt.cnet> <49636AE7.4090108@redhat.com> <20090106164311.GA4902@amt.cnet> <49645066.4040009@suse.de> <496481AE.1060102@redhat.com> <20090107104350.GA4170@amt.cnet> <496492D9.7030701@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <496492D9.7030701@redhat.com> 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. This comment is worrying /* * FIXME: Tis shouldn't be necessary here, but there is a flush * missing in the MMU code. Until we find this bug, flush the * complete TLB here on an NPF */ if (npt_enabled) svm_flush_tlb(&svm->vcpu); Alexander, you might want to try this patch, -ENONPT here (and revert the previous one). I have no clue, what else could be causing this? --- 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..bf68e5b 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -33,6 +33,7 @@ #include #include #include +#include /* * When setting this variable to true it enables Two-Dimensional-Paging @@ -1850,6 +1851,11 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write, if (*iterator.sptep == shadow_trap_nonpresent_pte) { pseudo_gfn = (iterator.addr & PT64_DIR_BASE_ADDR_MASK) >> PAGE_SHIFT; + + kvm_flush_remote_tlbs(vcpu->kvm); + kvm_mmu_flush_tlb(vcpu); + __flush_tlb(); + sp = kvm_mmu_get_page(vcpu, pseudo_gfn, iterator.addr, iterator.level - 1, 1, ACC_ALL, iterator.sptep);