[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 2 of 2] [CA-39743] Wait for Xen to scrub host memory (only if necessary) before building a domain



# HG changeset patch
# User Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
# Date 1270028768 -3600
# Node ID 50f10d45f8a0c607061d172631d4059bf48e4c70
# Parent  73d8b966e6eb5a1f654f75e25387fd1afb184073
[CA-39743] Wait for Xen to scrub host memory (only if necessary) before 
building a domain.

Signed-off-by: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
Acked-by: Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx>

diff -r 73d8b966e6eb -r 50f10d45f8a0 ocaml/xenops/domain.ml
--- a/ocaml/xenops/domain.ml    Wed Mar 31 10:34:48 2010 +0100
+++ b/ocaml/xenops/domain.ml    Wed Mar 31 10:46:08 2010 +0100
@@ -387,9 +387,13 @@
        let console = Xc.evtchn_alloc_unbound xc domid 0 in
        store, console
 
-let build_pre ~xc ~xs ~vcpus ~xen_max_mib ~shadow_mib domid =
-       debug "build_pre domid=%d; max=%Ld MiB; shadow=%Ld MiB"
-               domid xen_max_mib shadow_mib;
+let build_pre ~xc ~xs ~vcpus ~xen_max_mib ~shadow_mib ~required_host_free_mib 
domid =
+       debug "build_pre domid=%d; max=%Ld MiB; shadow=%Ld MiB; required=%Ld 
MiB"
+               domid xen_max_mib shadow_mib required_host_free_mib;
+
+       (* CA-39743: Wait, if necessary, for the Xen scrubber to catch up. *)
+       Memory.wait_xen_free_mem ~xc (Memory.kib_of_mib required_host_free_mib);
+
        let shadow_mib = Int64.to_int shadow_mib in
 
        let dom_path = xs.Xs.getdomainpath domid in
@@ -467,9 +471,11 @@
                Memory.Linux.xen_max_mib static_max_mib in
        let shadow_mib =
                Memory.Linux.shadow_mib in
+       let required_host_free_mib =
+               Memory.Linux.footprint_mib target_mib in
 
-       let store_port, console_port =
-               build_pre ~xc ~xs ~xen_max_mib ~shadow_mib ~vcpus domid in
+       let store_port, console_port = build_pre ~xc ~xs
+               ~xen_max_mib ~shadow_mib ~required_host_free_mib ~vcpus domid in
 
        let cnx = XenguestHelper.connect
          [
@@ -531,9 +537,11 @@
                Memory.HVM.xen_max_mib static_max_mib in
        let shadow_mib =
                Memory.HVM.shadow_mib static_max_mib vcpus shadow_multiplier in
+       let required_host_free_mib =
+               Memory.HVM.footprint_mib target_mib static_max_mib vcpus 
shadow_multiplier in
 
-       let store_port, console_port =
-               build_pre ~xc ~xs ~xen_max_mib ~shadow_mib ~vcpus domid in
+       let store_port, console_port = build_pre ~xc ~xs
+               ~xen_max_mib ~shadow_mib ~required_host_free_mib ~vcpus domid in
 
        let cnx = XenguestHelper.connect
          [
@@ -656,9 +664,11 @@
                Memory.Linux.xen_max_mib static_max_mib in
        let shadow_mib =
                Memory.Linux.shadow_mib in
+       let required_host_free_mib =
+               Memory.Linux.footprint_mib target_mib in
 
-       let store_port, console_port =
-               build_pre ~xc ~xs ~xen_max_mib ~shadow_mib ~vcpus domid in
+       let store_port, console_port = build_pre ~xc ~xs
+               ~xen_max_mib ~shadow_mib ~required_host_free_mib ~vcpus domid in
 
        let store_mfn, console_mfn = restore_common ~xc ~xs ~hvm:false
                                                    ~store_port ~console_port
@@ -685,9 +695,11 @@
                Memory.HVM.xen_max_mib static_max_mib in
        let shadow_mib =
                Memory.HVM.shadow_mib static_max_mib vcpus shadow_multiplier in
+       let required_host_free_mib =
+               Memory.HVM.footprint_mib target_mib static_max_mib vcpus 
shadow_multiplier in
 
-       let store_port, console_port =
-               build_pre ~xc ~xs ~xen_max_mib ~shadow_mib ~vcpus domid in
+       let store_port, console_port = build_pre ~xc ~xs
+               ~xen_max_mib ~shadow_mib ~required_host_free_mib ~vcpus domid in
 
        let store_mfn, console_mfn = restore_common ~xc ~xs ~hvm:true
                                                    ~store_port ~console_port
1 file changed, 23 insertions(+), 11 deletions(-)
ocaml/xenops/domain.ml |   34 +++++++++++++++++++++++-----------


Attachment: xen-api.hg-2.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.