From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH 3/3] kvm mmu: alloc shadow pages with __GFP_ZERO Date: Wed, 18 Feb 2009 14:54:37 +0100 Message-ID: <20090218135436.GF8751@amd.com> References: <1234962540-7131-1-git-send-email-joerg.roedel@amd.com> <1234962540-7131-4-git-send-email-joerg.roedel@amd.com> <499C1158.7020401@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Marcelo Tosatti , kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Avi Kivity Return-path: Received: from wa4ehsobe005.messaging.microsoft.com ([216.32.181.15]:32453 "EHLO WA4EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751242AbZBROJt convert rfc822-to-8bit (ORCPT ); Wed, 18 Feb 2009 09:09:49 -0500 Content-Disposition: inline In-Reply-To: <499C1158.7020401@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Feb 18, 2009 at 01:47:04PM +0000, Avi Kivity wrote: > Joerg Roedel wrote: > >Not using __GFP_ZERO when allocating shadow pages triggers the > >assertion in the kvm_mmu_alloc_page() when MMU debugging is enabled. > > > >Signed-off-by: Joerg Roedel > >--- > > arch/x86/kvm/mmu.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > >diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > >index c90b4b2..d93ecec 100644 > >--- a/arch/x86/kvm/mmu.c > >+++ b/arch/x86/kvm/mmu.c > >@@ -301,7 +301,7 @@ static int mmu_topup_memory_cache_page(struct kv= m_mmu_memory_cache *cache, > > if (cache->nobjs >=3D min) > > return 0; > > while (cache->nobjs < ARRAY_SIZE(cache->objects)) { > >- page =3D alloc_page(GFP_KERNEL); > >+ page =3D alloc_page(GFP_KERNEL | __GFP_ZERO); > > if (!page) > > return -ENOMEM; > > set_page_private(page, 0); > > =20 >=20 > What is the warning? >=20 > Adding __GFP_ZERO here will cause us to clear the page twice, which i= s wasteful. The assertion which the attached patch removes fails sometimes. Removin= g this assertion is the alternative solution to this problem ;-) =46rom ca45f3a2e45cd7e76ca624bb1098329db8ff83ab Mon Sep 17 00:00:00 200= 1 =46rom: Joerg Roedel Date: Wed, 18 Feb 2009 14:51:13 +0100 Subject: [PATCH] kvm mmu: remove assertion in kvm_mmu_alloc_page Signed-off-by: Joerg Roedel --- arch/x86/kvm/mmu.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d93ecec..b226973 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -802,7 +802,6 @@ static struct kvm_mmu_page *kvm_mmu_alloc_page(stru= ct kvm_vcpu *vcpu, set_page_private(virt_to_page(sp->spt), (unsigned long)sp); list_add(&sp->link, &vcpu->kvm->arch.active_mmu_pages); INIT_LIST_HEAD(&sp->oos_link); - ASSERT(is_empty_shadow_page(sp->spt)); bitmap_zero(sp->slot_bitmap, KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS= ); sp->multimapped =3D 0; sp->parent_pte =3D parent_pte; --=20 1.5.6.4 --=20 | Advanced Micro Devices GmbH Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei M=C3=BCnchen System |=20 Research | Gesch=C3=A4ftsf=C3=BChrer: Jochen Polster, Thomas M. McCoy= , Giuliano Meroni Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis M=C3=BCnchen | Registergericht M=C3=BCnchen, HRB Nr. 43632