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-36384: [experimental PCI passthrough]: unplu

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 2 of 2] CA-36384: [experimental PCI passthrough]: unplug/plug devices around migrate
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Fri, 15 Jan 2010 10:59:41 +0000
Delivery-date: Fri, 15 Jan 2010 02:56:16 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1263553179@xxxxxxxxxxxxxxxxxxxx>
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 David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1263553145 0
# Node ID c841e1642ae566aaa78f46ad2cadf6c704feafb8
# Parent  6c0dc1298ff409515511ca313480ad1c7cb3a32f
CA-36384: [experimental PCI passthrough]: unplug/plug devices around migrate.

Note we simply unplug devices in series: no fancy parallel stuff.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r 6c0dc1298ff4 -r c841e1642ae5 ocaml/xapi/xapi_vm_migrate.ml
--- a/ocaml/xapi/xapi_vm_migrate.ml     Fri Jan 15 10:57:09 2010 +0000
+++ b/ocaml/xapi/xapi_vm_migrate.ml     Fri Jan 15 10:59:05 2010 +0000
@@ -198,37 +198,7 @@
       raise (Vmops.Domain_shutdown_for_wrong_reason Xal.Crashed)
     end;
 
-    (* PCI: The following code only does anything if PCI devices have been 
passed-through
-       which is an unsupported configuration. *)
-    let pci_hotunplug_time = try float_of_string (List.assoc 
"pci-hotunplug-time" (Db.VM.get_other_config ~__context ~self:vm)) with _ -> 
0.8 in
-    let pci_devices_to_unplug = ref [] in (* XXX: currently only support 1 due 
to xenstore protocol *)
-    let pci_unplug_initiated_already = ref false in
-    let pci_unplug_initiate_noexn () = 
-      Helpers.log_exn_continue "pci_unplug_initiate"
-       (fun () ->
-          if not (!pci_unplug_initiated_already) then begin
-            pci_unplug_initiated_already := true;
-            debug "looking for PCI devices to hot unplug";
-            let devices = Device.PCI.list ~xc ~xs domid in
-            if List.length devices > 1 then warn "We can only handle one PCI 
device during migration!";
-            if List.length devices > 0 then begin
-              let (id, device) = List.hd devices in
-              let (domain, bus, dev, func) = device in
-              debug "requesting unplug of %.4x:%.2x:%.2x.%.1x" domain bus dev 
func;
-              Device.PCI.unplug ~xc ~xs device domid;
-              pci_devices_to_unplug := [ device ]
-            end        
-          end) () in
-    let pci_unplug_wait_noexn () = 
-      Helpers.log_exn_continue "pci_unplug_wait"
-       (fun () ->
-          debug "waiting for PCI hotunplug to complete";
-          List.iter (fun device -> 
-                       let (domain, bus, dev, func) = device in
-                       debug "synchronising with unplug of 
%.4x:%.2x:%.2x.%.1x" domain bus dev func;
-                       Device.PCI.unplug_wait ~xc ~xs domid
-                    ) !pci_devices_to_unplug) () in
-
+         Vmops.unplug_pcidevs_noexn ~__context ~vm domid (Device.PCI.list ~xc 
~xs domid);
 
     (* MTC: We want to be notified when libxc's xc_domain_save suspends the 
domain
      *      to go from background to foreground mode.  Therefore, we provide 
the
@@ -239,12 +209,9 @@
     Domain.suspend ~xc ~xs ~hvm domid fd (if live then [ Domain.Live ] else [])
       ~progress_callback:(fun x -> 
                            debug "migration_progress = %.2f" x;
-                           if x > pci_hotunplug_time then 
pci_unplug_initiate_noexn ();
                            migration_progress_cb ~__context vm_migrate_failed 
~vm (x *. 0.95)) 
       (fun () -> 
-        pci_unplug_initiate_noexn(); (* just in case *)
-        pci_unplug_wait_noexn ();
-        migration_suspend_cb ~xal ~xc ~xs ~__context vm_migrate_failed 
~self:vm domid Domain.Suspend);
+                  migration_suspend_cb ~xal ~xc ~xs ~__context 
vm_migrate_failed ~self:vm domid Domain.Suspend);
 
     (* <-- [2] Synchronisation point *)
 
1 file changed, 2 insertions(+), 35 deletions(-)
ocaml/xapi/xapi_vm_migrate.ml |   37 ++-----------------------------------


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>