* [PATCH] kvm: ppc: stop leaking host memory on VM exit
@ 2008-11-24 17:37 Hollis Blanchard
[not found] ` <1227548258.17746.11.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Hollis Blanchard @ 2008-11-24 17:37 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-ppc, kvm
When the VM exits, we must call put_page() for every page referenced in the
shadow TLB.
Without this patch, we usually leak 30-50 host pages (120 - 200 KiB with 4 KiB
pages). The maximum number of pages leaked is the size of our shadow TLB, 64
pages.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
---
The obvious question is "why didn't we see this before?" Basically, we'd never
looked for it, and since most of our work was in the kernel we always ended up
rebooting before exhausting host memory.
Since it's such a large leak, and a simple fix, please commit this for 2.6.28.
This patch does apply to kvm.git with fuzz, but if you prefer I can send a
separate patch for that later.
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -104,4 +104,6 @@ static inline void kvmppc_set_pid(struct
}
}
+extern void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu);
+
#endif /* __POWERPC_KVM_PPC_H__ */
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c
--- a/arch/powerpc/kvm/44x_tlb.c
+++ b/arch/powerpc/kvm/44x_tlb.c
@@ -124,6 +124,14 @@ static void kvmppc_44x_shadow_release(st
}
}
+void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu)
+{
+ int i;
+
+ for (i = 0; i <= tlb_44x_hwater; i++)
+ kvmppc_44x_shadow_release(vcpu, i);
+}
+
void kvmppc_tlbe_set_modified(struct kvm_vcpu *vcpu, unsigned int i)
{
vcpu->arch.shadow_tlb_mod[i] = 1;
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -238,6 +238,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *
void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
{
+ kvmppc_core_destroy_mmu(vcpu);
}
/* Note: clearing MSR[DE] just means that the debug interrupt will not be
--
Hollis Blanchard
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] kvm: ppc: stop leaking host memory on VM exit
[not found] ` <1227548258.17746.11.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2008-11-25 2:28 ` Liu Yu
0 siblings, 0 replies; 5+ messages in thread
From: Liu Yu @ 2008-11-25 2:28 UTC (permalink / raw)
To: Hollis Blanchard, Avi Kivity; +Cc: kvm-ppc, kvm
Good catch.
> -----Original Message-----
> From: kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> [mailto:kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Hollis Blanchard
> Sent: Tuesday, November 25, 2008 1:38 AM
> To: Avi Kivity
> Cc: kvm-ppc; kvm
> Subject: [PATCH] kvm: ppc: stop leaking host memory on VM exit
>
> When the VM exits, we must call put_page() for every page
> referenced in the
> shadow TLB.
>
> Without this patch, we usually leak 30-50 host pages (120 -
> 200 KiB with 4 KiB
> pages). The maximum number of pages leaked is the size of our
> shadow TLB, 64
> pages.
>
> Signed-off-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
> The obvious question is "why didn't we see this before?"
> Basically, we'd never
> looked for it, and since most of our work was in the kernel
> we always ended up
> rebooting before exhausting host memory.
>
> Since it's such a large leak, and a simple fix, please commit
> this for 2.6.28.
> This patch does apply to kvm.git with fuzz, but if you prefer
> I can send a
> separate patch for that later.
>
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] kvm: ppc: stop leaking host memory on VM exit
2008-11-24 17:37 [PATCH] kvm: ppc: stop leaking host memory on VM exit Hollis Blanchard
[not found] ` <1227548258.17746.11.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2008-11-25 8:32 ` Liu Yu
[not found] ` <D8176E55B81822498D63816C4ADC701023423D-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2008-11-25 11:00 ` Avi Kivity
2 siblings, 1 reply; 5+ messages in thread
From: Liu Yu @ 2008-11-25 8:32 UTC (permalink / raw)
To: Hollis Blanchard, Avi Kivity; +Cc: kvm-ppc, kvm
> -----Original Message-----
> From: kvm-ppc-owner@vger.kernel.org
> [mailto:kvm-ppc-owner@vger.kernel.org] On Behalf Of Hollis Blanchard
> Sent: Tuesday, November 25, 2008 1:38 AM
> To: Avi Kivity
> Cc: kvm-ppc; kvm
> Subject: [PATCH] kvm: ppc: stop leaking host memory on VM exit
>
> When the VM exits, we must call put_page() for every page
> referenced in the
> shadow TLB.
>
> Without this patch, we usually leak 30-50 host pages (120 -
> 200 KiB with 4 KiB
> pages). The maximum number of pages leaked is the size of our
> shadow TLB, 64
> pages.
>
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Need it also to _tlbia() at vcpu_uninit?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: ppc: stop leaking host memory on VM exit
2008-11-24 17:37 [PATCH] kvm: ppc: stop leaking host memory on VM exit Hollis Blanchard
[not found] ` <1227548258.17746.11.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-11-25 8:32 ` Liu Yu
@ 2008-11-25 11:00 ` Avi Kivity
2 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2008-11-25 11:00 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: kvm-ppc, kvm
Hollis Blanchard wrote:
> When the VM exits, we must call put_page() for every page referenced in the
> shadow TLB.
>
> Without this patch, we usually leak 30-50 host pages (120 - 200 KiB with 4 KiB
> pages). The maximum number of pages leaked is the size of our shadow TLB, 64
> pages.
>
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
> ---
> The obvious question is "why didn't we see this before?" Basically, we'd never
> looked for it, and since most of our work was in the kernel we always ended up
> rebooting before exhausting host memory.
>
> Since it's such a large leak, and a simple fix, please commit this for 2.6.28.
> This patch does apply to kvm.git with fuzz, but if you prefer I can send a
> separate patch for that later.
>
Applied on both master and the 2.6.28 queue.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] kvm: ppc: stop leaking host memory on VM exit
[not found] ` <D8176E55B81822498D63816C4ADC701023423D-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
@ 2008-11-25 16:52 ` Hollis Blanchard
0 siblings, 0 replies; 5+ messages in thread
From: Hollis Blanchard @ 2008-11-25 16:52 UTC (permalink / raw)
To: Liu Yu; +Cc: Avi Kivity, kvm-ppc, kvm
On Tue, 2008-11-25 at 16:32 +0800, Liu Yu wrote:
> > -----Original Message-----
> > From: kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > [mailto:kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Hollis Blanchard
> > Sent: Tuesday, November 25, 2008 1:38 AM
> > To: Avi Kivity
> > Cc: kvm-ppc; kvm
> > Subject: [PATCH] kvm: ppc: stop leaking host memory on VM exit
> >
> > When the VM exits, we must call put_page() for every page
> > referenced in the
> > shadow TLB.
> >
> > Without this patch, we usually leak 30-50 host pages (120 -
> > 200 KiB with 4 KiB
> > pages). The maximum number of pages leaked is the size of our
> > shadow TLB, 64
> > pages.
> >
> > Signed-off-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>
> Need it also to _tlbia() at vcpu_uninit?
No, because by the time we hit kvm_arch_vcpu_uninit(),
kvm_arch_vcpu_put() has already been called.
--
Hollis Blanchard
IBM Linux Technology Center
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-11-25 16:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 17:37 [PATCH] kvm: ppc: stop leaking host memory on VM exit Hollis Blanchard
[not found] ` <1227548258.17746.11.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-11-25 2:28 ` Liu Yu
2008-11-25 8:32 ` Liu Yu
[not found] ` <D8176E55B81822498D63816C4ADC701023423D-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2008-11-25 16:52 ` Hollis Blanchard
2008-11-25 11:00 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox