List Info

Thread: fix memory leak when domVTI is created




fix memory leak when domVTI is created
user name
2006-07-28 03:50:08
fix memory leak when VT-i domain is created.
When domain is created, xend sets max vcpu before domain
setup.
So alloc_vcpu_struct() thinks that the domain is normal
domU, not domVTI.
And next xend set the domain as domVTI. so the memory is
allocated for
domU won't be freed.

-- 
yamahata
# HG changeset patch
# User yamahatavalinux.co.jp
# Date 1154057753 -32400
# Node ID 145cb880220fd29b37d114b4e0913c699c99fe0e
# Parent  9ebb2c82bec9031149c3643eef8df0d118596dcf
fix memory leak when VT-i domain is created.
When domain is created, xend sets max vcpu before domain
setup.
So alloc_vcpu_struct() think the domain is normal domU, not
domVTI.
And next xend set the domain as domVTI. so the memory is
allocated for
domU won't be freed.
PATCHNAME: dom_vti_memory_leak

Signed-off-by: Isaku Yamahata <yamahatavalinux.co.jp>

diff -r 9ebb2c82bec9 -r 145cb880220f
xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c	Thu Jul 27 20:53:36 2006
+0900
+++ b/xen/arch/ia64/xen/dom0_ops.c	Fri Jul 28 12:35:53 2006
+0900
 -20,6
+20,7 
 #include <public/sched_ctl.h>
 #include <asm/vmx.h>
 #include <asm/dom_fw.h>
+#include <asm/vhpt.h>
 
 void build_physmap_table(struct domain *d);
 
 -244,6
+245,15  long arch_do_dom0_op(dom0_op_t *op, XEN_
                     ret = -EINVAL;
                     break;
                 }
+                if (!d->arch.is_vti) {
+                    struct vcpu *v;
+                    for_each_vcpu(d, v) {
+                        BUG_ON(v->arch.privregs ==
NULL);
+                       
free_xenheap_pages(v->arch.privregs,
+                               
get_order_from_shift(XMAPPEDREGS_SHIFT));
+                        v->arch.privregs = NULL;
+                    }
+                }
                 d->arch.is_vti = 1;
                 vmx_setup_platform(d);
             }
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devellists.xensource.com
http://list
s.xensource.com/xen-ia64-devel
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )