]> xenbits.xen.org Git - xenclient/toolstack.git/commitdiff
set affinity carefully for each cpus specified after building domain.
authorVincent Hanquez <vincent.hanquez@eu.citrix.com>
Tue, 8 Sep 2009 14:55:52 +0000 (15:55 +0100)
committerVincent Hanquez <vincent.hanquez@eu.citrix.com>
Tue, 8 Sep 2009 14:55:52 +0000 (15:55 +0100)
xenvm/vmact.ml

index 6a41563cc2ee44c5144c9ad568e2487edf5d2247..a24a82f48c3168041325f8777e337ae5807506b1 100644 (file)
@@ -270,6 +270,21 @@ let set_cpuid xc domid cfg =
        with exn ->
                warn "exception ignored during cpuid: %s" (Printexc.to_string exn)
 
+let set_affinity xc domid cfg =
+       try
+               List.iter (fun (id, l) ->
+                       let cpumap = Array.make 64 false in
+                       (* make the bitmap *)
+                       List.iter (fun x ->
+                               if x >= 0 && x < 64 then
+                                       cpumap.(x) <- true
+                       ) l;
+                       (* and dump in into xen *)
+                       Domain.vcpu_affinity_set ~xc domid id cpumap
+               ) cfg.cpus_affinity;
+       with exn ->
+               warn "exception ignored during affinity setting: %s" (Printexc.to_string exn)
+
 let do_trigger xc state args =
        match args with
        | "s3resume" :: _ ->
@@ -453,6 +468,7 @@ let build_vm xc xs state f restore =
        try
                f state cfg;
                set_cpuid xc domid cfg;
+               set_affinity xc domid cfg;
                add_devices xc xs domid state restore;
        with exn ->
                warn "receive exception building vm: %s" (Printexc.to_string exn);