# HG changeset patch # User David Scott # Date 1259589704 0 # Node ID ebf1a1998ae10647378702fd0be2bca9f8a129ba # Parent a5ebd316914bcd93bbc6f928c3ec752d34d1a372 CA-35406: refrain from setting a domain's target unless we think it 'can_balloon' ie it has exposed feature-balloon. This fixes the problem generated by the following interleaving: xapi squeezed -------------------------------------------------------------------------- reserve required memory + overhead create domain invoke domain builder observes domain with no feature-balloon sets maxmem = requred memory + overhead sets target = maxmem [1] unpauses domain observes feature-balloon sets memory-offset = -overhead (!) declares domain uncooperative [1] 519:f509339c8f74 avoid setting target > maxmem Signed-off-by: David Scott diff -r a5ebd316914b -r ebf1a1998ae1 ocaml/xenops/squeeze_xen.ml --- a/ocaml/xenops/squeeze_xen.ml Mon Nov 30 14:01:44 2009 +0000 +++ b/ocaml/xenops/squeeze_xen.ml Mon Nov 30 14:01:44 2009 +0000 @@ -371,11 +371,18 @@ then failwith "Proposed target is negative (domid %d): %Ld" domid target_kib; let cnx = (xc, xs) in let memory_max_kib = Domain.get_maxmem cnx domid in + (* We only set the target of a domain if it has exposed feature-balloon: otherwise + we can screw up the memory-offset calculations for partially-built domains. *) + let can_balloon = Domain.get_feature_balloon cnx domid in if target_kib > memory_max_kib then begin Domain.set_maxmem_noexn cnx domid target_kib; - Domain.set_target_noexn cnx domid target_kib; + if can_balloon + then Domain.set_target_noexn cnx domid target_kib + else debug "Not setting target for domid: %d since no feature-balloon. Setting maxmem to %Ld" domid target_kib; end else begin - Domain.set_target_noexn cnx domid target_kib; + if can_balloon + then Domain.set_target_noexn cnx domid target_kib + else debug "Not setting target for domid: %d since no feature-balloon. Setting maxmem to %Ld" domid target_kib; Domain.set_maxmem_noexn cnx domid target_kib; end with e ->