]> xenbits.xensource.com Git - xen.git/commitdiff
passthrough: release assigned PCI devices earlier during domain
authorJan Beulich <jbeulich@suse.com>
Wed, 7 Mar 2012 09:09:05 +0000 (09:09 +0000)
committerJan Beulich <jbeulich@suse.com>
Wed, 7 Mar 2012 09:09:05 +0000 (09:09 +0000)
shutdown

At least with xend, where there's not even a tool stack side attempt
to de-assign devices during domain shutdown, this allows immediate re-
starts of a domain to work reliably. (There's no apparent reason why
c/s 18010:c1577f094ae4 chose to put this in the asynchronous part of
domain destruction).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24888:71159fb049f2
xen-unstable date:        Fri Feb 24 11:46:32 2012 +0100

xen/arch/ia64/xen/domain.c
xen/arch/x86/domain.c
xen/arch/x86/domctl.c

index 743dab7493a3c7a50be5a4c54df148d0a0590bf6..5a05bbd79772b20ee89d9a417d76a35eb49b85b2 100644 (file)
@@ -669,10 +669,8 @@ void arch_domain_destroy(struct domain *d)
                free_xenheap_pages(d->shared_info,
                                   get_order_from_shift(XSI_SHIFT));
 
-       if ( iommu_enabled && need_iommu(d) )   {
-               pci_release_devices(d);
+       if ( iommu_enabled && need_iommu(d) )
                iommu_domain_destroy(d);
-       }
 
        tlb_track_destroy(d);
 
@@ -1717,6 +1715,8 @@ int domain_relinquish_resources(struct domain *d)
 
        switch (d->arch.relres) {
        case RELRES_not_started:
+               pci_release_devices(d);
+
                /* Relinquish guest resources for VT-i domain. */
                if (is_hvm_domain(d))
                        vmx_relinquish_guest_resources(d);
index 2fd584d6c111a0492cce6aedbac7bef5fb105e01..bb6a5e7e5e857fb633572bbd94f82ddd458dbbd0 100644 (file)
@@ -565,7 +565,6 @@ void arch_domain_destroy(struct domain *d)
     if ( is_hvm_domain(d) )
         hvm_domain_destroy(d);
 
-    pci_release_devices(d);
     free_domain_pirqs(d);
     if ( !is_idle_domain(d) )
         iommu_domain_destroy(d);
@@ -1967,6 +1966,8 @@ int domain_relinquish_resources(struct domain *d)
     switch ( d->arch.relmem )
     {
     case RELMEM_not_started:
+        pci_release_devices(d);
+
         /* Tear down paging-assistance stuff. */
         paging_teardown(d);
 
index 60837c8e263052d7a9f3879eece04438bd4cfb43..a8865cd94852303f7f216bedd9e87b52b7c82d53 100644 (file)
@@ -832,6 +832,9 @@ long arch_do_domctl(
             break;
         }
 
+        if ( d->is_dying )
+            goto assign_device_out;
+
         ret = xsm_assign_device(d, domctl->u.assign_device.machine_bdf);
         if ( ret )
             goto assign_device_out;