From mboxrd@z Thu Jan 1 00:00:00 1970 From: Koshelev Vladimir Subject: Re: hva_to_pfn and memory leak Date: Thu, 22 Nov 2012 21:02:27 +0400 Message-ID: <1144801353603747@web5e.yandex.ru> References: <1030761353593606@web26e.yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: QUOTED-PRINTABLE To: "kvm@vger.kernel.org" Return-path: Received: from forward6.mail.yandex.net ([77.88.60.125]:44672 "EHLO forward6.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964969Ab2KVS6q (ORCPT ); Thu, 22 Nov 2012 13:58:46 -0500 Received: from web5e.yandex.ru (web5e.yandex.ru [77.88.60.74]) by forward6.mail.yandex.net (Yandex) with ESMTP id E5B30112176E for ; Thu, 22 Nov 2012 21:02:27 +0400 (MSK) In-Reply-To: <1030761353593606@web26e.yandex.ru> Sender: kvm-owner@vger.kernel.org List-ID: 22.11.2012, 18:13, "Koshelev Vladimir" : > Hello, guys! > > I have written paravirtual interface for GPA->HPA translation insi= de guest. I build GPA->HPA translation table in guest virtual memory. > To do this, I need to translate userspace virtual address from =9A= memslot to host physical address. I use hva_to_pfn for it. It works fin= e, but linux doesn't free the guest > memory after guest power off. After testing I have found that caus= e of memory leak is hva_to_pfg call. You can find my code at http://pas= tebin.com/0zBV2aPN. > Do I translate hva to hpa in the right way? > > I do this patch for RHEL Linux Kernel 2.6.32-279.5.2.el6 because I= use CentOS 6.3. > > Thanks! > > Vladimir. =46ixed. I have found that kvm_release_pfn_clean is necessary for this case. Bef= ore that I thought hva_to_pfn just translates(doesn't map) the HVA, but= it is not true.=20