WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 2 of 2] [CA-39743] Wait for Xen to scrub host memory (o

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 2 of 2] [CA-39743] Wait for Xen to scrub host memory (only if necessary) before building a domain
From: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
Date: Wed, 31 Mar 2010 10:46:53 +0100
Delivery-date: Wed, 31 Mar 2010 02:49:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1270028811@radon>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# 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
<Prev in Thread] Current Thread [Next in Thread>