From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] kvm mmu: fix another largepage memory leak Date: Thu, 19 Feb 2009 10:20:25 -0300 Message-ID: <20090219132025.GA29085@amt.cnet> References: <1235042336-20101-1-git-send-email-joerg.roedel@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Joerg Roedel Return-path: Received: from mx2.redhat.com ([66.187.237.31]:43553 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753299AbZBSNVK (ORCPT ); Thu, 19 Feb 2009 08:21:10 -0500 Content-Disposition: inline In-Reply-To: <1235042336-20101-1-git-send-email-joerg.roedel@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Feb 19, 2009 at 12:18:56PM +0100, Joerg Roedel wrote: > In the paging_fetch function rmap_remove is called after setting a large > pte to non-present. This causes rmap_remove to not drop the reference to > the large page. The result is a memory leak of that page. > > Signed-off-by: Joerg Roedel > --- > arch/x86/kvm/paging_tmpl.h | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h > index 7314c09..0f11792 100644 > --- a/arch/x86/kvm/paging_tmpl.h > +++ b/arch/x86/kvm/paging_tmpl.h > @@ -306,9 +306,9 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, > continue; > > if (is_large_pte(*sptep)) { > + rmap_remove(vcpu->kvm, sptep); > set_shadow_pte(sptep, shadow_trap_nonpresent_pte); > kvm_flush_remote_tlbs(vcpu->kvm); > - rmap_remove(vcpu->kvm, sptep); > } > > if (level == PT_DIRECTORY_LEVEL > -- ACK