public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.25-rc5-git5 KVM memory not freed
@ 2008-03-20 16:41 Ioan Ionita
  2008-03-23 10:30 ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Ioan Ionita @ 2008-03-20 16:41 UTC (permalink / raw)
  To: kernel list

Hi,

I'm using KVM and the qemu kvm modified to run a windows guest. I'm
allocating 900 MB to the guest. Seems that when I terminate a qemu
process, the memory that was allocated to qemu is not freed:


Mem:       2058140    1739156     318984          0     226944     425140
-/+ buffers/cache:    1087072     971068
Swap:            0          0          0

So I'm using 1GB of ram even though I've terminated qemu. If I attempt
to start qemu again, the machine locks up. No message in the logs.

Command to start qemu:
/usr/local/kvm/bin/qemu-system-x86_64 b.data -no-acpi -m 900 -net nic
-net user -hdb temp.raw -usbdevice tablet

uname -a
Linux ops-desktop 2.6.25-rc5-git5 #1 SMP PREEMPT Sat Mar 15 14:47:25
EET 2008 x86_64 GNU/Linux


Not sure whether this is a problem on the kernel side.  I don't
pretend to understand linux memory management. But it wasn't occurring
with older kernels. I'll attempt to bisect.

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

* Re: 2.6.25-rc5-git5 KVM memory not freed
  2008-03-20 16:41 2.6.25-rc5-git5 KVM memory not freed Ioan Ionita
@ 2008-03-23 10:30 ` Avi Kivity
  2008-03-23 12:20   ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2008-03-23 10:30 UTC (permalink / raw)
  To: Ioan Ionita; +Cc: kernel list

Ioan Ionita wrote:
> Hi,
>
> I'm using KVM and the qemu kvm modified to run a windows guest. I'm
> allocating 900 MB to the guest. Seems that when I terminate a qemu
> process, the memory that was allocated to qemu is not freed:
>
>
> Mem:       2058140    1739156     318984          0     226944     425140
> -/+ buffers/cache:    1087072     971068
> Swap:            0          0          0
>
> So I'm using 1GB of ram even though I've terminated qemu. If I attempt
> to start qemu again, the machine locks up. No message in the logs.
>
> Command to start qemu:
> /usr/local/kvm/bin/qemu-system-x86_64 b.data -no-acpi -m 900 -net nic
> -net user -hdb temp.raw -usbdevice tablet
>
> uname -a
> Linux ops-desktop 2.6.25-rc5-git5 #1 SMP PREEMPT Sat Mar 15 14:47:25
> EET 2008 x86_64 GNU/Linux
>
>
> Not sure whether this is a problem on the kernel side.  I don't
> pretend to understand linux memory management. But it wasn't occurring
> with older kernels. I'll attempt to bisect.
>   

I reproduced this and am investigating.


-- 
error compiling committee.c: too many arguments to function


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

* Re: 2.6.25-rc5-git5 KVM memory not freed
  2008-03-23 10:30 ` Avi Kivity
@ 2008-03-23 12:20   ` Avi Kivity
  2008-03-24 23:30     ` Ioan Ionita
  0 siblings, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2008-03-23 12:20 UTC (permalink / raw)
  To: Ioan Ionita; +Cc: kernel list

[-- Attachment #1: Type: text/plain, Size: 1188 bytes --]

Avi Kivity wrote:
> Ioan Ionita wrote:
>> Hi,
>>
>> I'm using KVM and the qemu kvm modified to run a windows guest. I'm
>> allocating 900 MB to the guest. Seems that when I terminate a qemu
>> process, the memory that was allocated to qemu is not freed:
>>
>>
>> Mem:       2058140    1739156     318984          0     226944     
>> 425140
>> -/+ buffers/cache:    1087072     971068
>> Swap:            0          0          0
>>
>> So I'm using 1GB of ram even though I've terminated qemu. If I attempt
>> to start qemu again, the machine locks up. No message in the logs.
>>
>> Command to start qemu:
>> /usr/local/kvm/bin/qemu-system-x86_64 b.data -no-acpi -m 900 -net nic
>> -net user -hdb temp.raw -usbdevice tablet
>>
>> uname -a
>> Linux ops-desktop 2.6.25-rc5-git5 #1 SMP PREEMPT Sat Mar 15 14:47:25
>> EET 2008 x86_64 GNU/Linux
>>
>>
>> Not sure whether this is a problem on the kernel side.  I don't
>> pretend to understand linux memory management. But it wasn't occurring
>> with older kernels. I'll attempt to bisect.
>>   
>
> I reproduced this and am investigating.
>
>

Attached patch ought to fix this.

-- 
error compiling committee.c: too many arguments to function


[-- Attachment #2: fix-kvm-2.6.25-rc6-leak.patch --]
[-- Type: text/x-patch, Size: 463 bytes --]

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 4ba85d9..e55af12 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1412,7 +1412,7 @@ static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
 	up_read(&current->mm->mmap_sem);
 
 	vcpu->arch.update_pte.gfn = gfn;
-	vcpu->arch.update_pte.page = gfn_to_page(vcpu->kvm, gfn);
+	vcpu->arch.update_pte.page = page;
 }
 
 void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,

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

* Re: 2.6.25-rc5-git5 KVM memory not freed
  2008-03-23 12:20   ` Avi Kivity
@ 2008-03-24 23:30     ` Ioan Ionita
  2008-03-25  6:21       ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Ioan Ionita @ 2008-03-24 23:30 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kernel list

On Sun, Mar 23, 2008 at 2:20 PM, Avi Kivity <avi@qumranet.com> wrote:

>  Attached patch ought to fix this.

I confirmed! Regression is fixed. Thank you! Will it be pushed
upstream for 2.6.25?

Kudos!

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

* Re: 2.6.25-rc5-git5 KVM memory not freed
  2008-03-24 23:30     ` Ioan Ionita
@ 2008-03-25  6:21       ` Avi Kivity
  0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2008-03-25  6:21 UTC (permalink / raw)
  To: Ioan Ionita; +Cc: kernel list

Ioan Ionita wrote:
> On Sun, Mar 23, 2008 at 2:20 PM, Avi Kivity <avi@qumranet.com> wrote:
>
>   
>>  Attached patch ought to fix this.
>>     
>
> I confirmed! Regression is fixed. Thank you! 

Thanks for testing.

> Will it be pushed
> upstream for 2.6.25?
>   

Yes, of course.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


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

end of thread, other threads:[~2008-03-25  6:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-20 16:41 2.6.25-rc5-git5 KVM memory not freed Ioan Ionita
2008-03-23 10:30 ` Avi Kivity
2008-03-23 12:20   ` Avi Kivity
2008-03-24 23:30     ` Ioan Ionita
2008-03-25  6:21       ` Avi Kivity

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