public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* hva_to_pfn and memory leak
@ 2012-11-22 14:13 Koshelev Vladimir
  2012-11-22 17:02 ` Koshelev Vladimir
  0 siblings, 1 reply; 2+ messages in thread
From: Koshelev Vladimir @ 2012-11-22 14:13 UTC (permalink / raw)
  To: kvm

Hello, guys!

I have written paravirtual interface for GPA->HPA translation inside guest. I build GPA->HPA translation table in guest virtual memory. 
To do this, I need to translate userspace virtual address from  memslot to host physical address. I use hva_to_pfn for it. It works fine, but linux doesn't free the guest
memory after guest power off. After testing I have found that cause of memory leak is hva_to_pfg call. You can find my code at http://pastebin.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.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: hva_to_pfn and memory leak
  2012-11-22 14:13 hva_to_pfn and memory leak Koshelev Vladimir
@ 2012-11-22 17:02 ` Koshelev Vladimir
  0 siblings, 0 replies; 2+ messages in thread
From: Koshelev Vladimir @ 2012-11-22 17:02 UTC (permalink / raw)
  To: kvm@vger.kernel.org



22.11.2012, 18:13, "Koshelev Vladimir" <Vedun-Z@yandex.ru>:
&gt; Hello, guys!
&gt;
&gt; I have written paravirtual interface for GPA->HPA translation inside guest. I build GPA->HPA translation table in guest virtual memory.
&gt; To do this, I need to translate userspace virtual address from  memslot to host physical address. I use hva_to_pfn for it. It works fine, but linux doesn't free the guest
&gt; memory after guest power off. After testing I have found that cause of memory leak is hva_to_pfg call. You can find my code at http://pastebin.com/0zBV2aPN.
&gt; Do I translate hva to hpa in the right way?
&gt;
&gt; I do this patch for RHEL Linux Kernel 2.6.32-279.5.2.el6 because I use CentOS 6.3.
&gt;
&gt; Thanks!
&gt;
&gt; Vladimir.

Fixed.

I have found that kvm_release_pfn_clean is necessary for this case. Before that I thought hva_to_pfn just translates(doesn't map) the HVA, but it is not true. 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-22 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-22 14:13 hva_to_pfn and memory leak Koshelev Vladimir
2012-11-22 17:02 ` Koshelev Vladimir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox