xcp-1.6-updates/xen-4.1.hg

changeset 23246:8f927378135a

passthrough: release assigned PCI devices earlier during domain 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
author Jan Beulich <jbeulich@suse.com>
date Wed Mar 07 08:35:58 2012 +0000 (2012-03-07)
parents b9e672d78cec
children e03aa3794cff
files xen/arch/ia64/xen/domain.c xen/arch/x86/domain.c xen/arch/x86/domctl.c
line diff
     1.1 --- a/xen/arch/ia64/xen/domain.c	Wed Mar 07 08:32:29 2012 +0000
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Wed Mar 07 08:35:58 2012 +0000
     1.3 @@ -671,10 +671,8 @@ void arch_domain_destroy(struct domain *
     1.4  		free_xenheap_pages(d->shared_info,
     1.5  				   get_order_from_shift(XSI_SHIFT));
     1.6  
     1.7 -	if ( iommu_enabled && need_iommu(d) )	{
     1.8 -		pci_release_devices(d);
     1.9 +	if ( iommu_enabled && need_iommu(d) )
    1.10  		iommu_domain_destroy(d);
    1.11 -	}
    1.12  
    1.13  	tlb_track_destroy(d);
    1.14  
    1.15 @@ -1719,6 +1717,8 @@ int domain_relinquish_resources(struct d
    1.16  
    1.17  	switch (d->arch.relres) {
    1.18  	case RELRES_not_started:
    1.19 +		pci_release_devices(d);
    1.20 +
    1.21  		/* Relinquish guest resources for VT-i domain. */
    1.22  		if (is_hvm_domain(d))
    1.23  			vmx_relinquish_guest_resources(d);
     2.1 --- a/xen/arch/x86/domain.c	Wed Mar 07 08:32:29 2012 +0000
     2.2 +++ b/xen/arch/x86/domain.c	Wed Mar 07 08:35:58 2012 +0000
     2.3 @@ -605,7 +605,6 @@ void arch_domain_destroy(struct domain *
     2.4          hvm_domain_destroy(d);
     2.5  
     2.6      vmce_destroy_msr(d);
     2.7 -    pci_release_devices(d);
     2.8      free_domain_pirqs(d);
     2.9      if ( !is_idle_domain(d) )
    2.10          iommu_domain_destroy(d);
    2.11 @@ -1954,6 +1953,8 @@ int domain_relinquish_resources(struct d
    2.12      switch ( d->arch.relmem )
    2.13      {
    2.14      case RELMEM_not_started:
    2.15 +        pci_release_devices(d);
    2.16 +
    2.17          /* Tear down paging-assistance stuff. */
    2.18          paging_teardown(d);
    2.19  
     3.1 --- a/xen/arch/x86/domctl.c	Wed Mar 07 08:32:29 2012 +0000
     3.2 +++ b/xen/arch/x86/domctl.c	Wed Mar 07 08:35:58 2012 +0000
     3.3 @@ -835,6 +835,9 @@ long arch_do_domctl(
     3.4              break;
     3.5          }
     3.6  
     3.7 +        if ( d->is_dying )
     3.8 +            goto assign_device_out;
     3.9 +
    3.10          ret = xsm_assign_device(d, domctl->u.assign_device.machine_bdf);
    3.11          if ( ret )
    3.12              goto assign_device_out;