passthrough: release assigned PCI devices earlier during domain shutdown
PATCH 1/1 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).
xen/arch/ia64/xen/domain.c +3 -3
@@ -673,10 +673,8 @@ void arch_domain_destroy(struct domain *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);
@@ -1721,6 +1719,8 @@ int domain_relinquish_resources(struct dswitch (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);
xen/arch/x86/domain.c +2 -1
@@ -657,7 +657,6 @@ void arch_domain_destroy(struct domain *xfree (d->arch.pv_domain.e820);vmce_destroy_msr (d); -pci_release_devices (d);free_domain_pirqs (d);if ( !is_idle_domain (d) )iommu_domain_destroy (d);
@@ -2101,6 +2100,8 @@ int domain_relinquish_resources(struct dswitch ( d->arch.relmem ) {case RELMEM_not_started: +pci_release_devices (d); +/* Tear down paging-assistance stuff. */ paging_teardown (d);
xen/drivers/passthrough/iommu.c +2 -1
@@ -574,7 +574,8 @@ int iommu_do_domctl(break ;case XEN_DOMCTL_assign_device: -if (unlikely ((d =get_domain_by_id (domctl->domain)) ==NULL ) ) +if (unlikely ((d =get_domain_by_id (domctl->domain)) ==NULL ) || +unlikely (d->is_dying) ) {printk (XENLOG_G_ERR "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n" );
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).
xen/arch/ia64/xen/domain.c +3 -3
@@ -673,10 +673,8 @@ void arch_domain_destroy(struct domain *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);
@@ -1721,6 +1719,8 @@ int domain_relinquish_resources(struct dswitch (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);
xen/arch/x86/domain.c +2 -1
@@ -657,7 +657,6 @@ void arch_domain_destroy(struct domain *xfree (d->arch.pv_domain.e820);vmce_destroy_msr (d); -pci_release_devices (d);free_domain_pirqs (d);if ( !is_idle_domain (d) )iommu_domain_destroy (d);
@@ -2101,6 +2100,8 @@ int domain_relinquish_resources(struct dswitch ( d->arch.relmem ) {case RELMEM_not_started: +pci_release_devices (d); +/* Tear down paging-assistance stuff. */ paging_teardown (d);
xen/drivers/passthrough/iommu.c +2 -1
@@ -574,7 +574,8 @@ int iommu_do_domctl(break ;case XEN_DOMCTL_assign_device: -if (unlikely ((d =get_domain_by_id (domctl->domain)) ==NULL ) ) +if (unlikely ((d =get_domain_by_id (domctl->domain)) ==NULL ) || +unlikely (d->is_dying) ) {printk (XENLOG_G_ERR "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n" );
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines · Jan Beulich
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 <[email protected]>
Quoted 61 lines
xen/arch/ia64/xen/domain.c +1
-3@@ -673,10 +673,8 @@ void arch_domain_destroy(struct domain *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);@@ -1721,6 +1719,8 @@ int domain_relinquish_resources(struct dswitch (d->arch.relres) {case
RELRES_not_started:xen/arch/ia64/xen/domain.c +2
-0+pci_release_devices (d); +/* Relinquish guest resources for VT-i domain. */
if (is_hvm_domain(d))vmx_relinquish_guest_resources(d);xen/arch/x86/domain.c +2
-1@@ -657,7 +657,6 @@ void arch_domain_destroy(struct domain *xfree (d->arch.pv_domain.e820);vmce_destroy_msr (d); -pci_release_devices (d);free_domain_pirqs (d);if ( !is_idle_domain (d) )iommu_domain_destroy (d);@@ -2101,6 +2100,8 @@ int domain_relinquish_resources(struct dswitch ( d->arch.relmem ) {case RELMEM_not_started: +pci_release_devices (d); +/* Tear down paging-assistance stuff. */ paging_teardown (d);xen/drivers/passthrough/iommu.c +2
-1@@ -574,7 +574,8 @@ int iommu_do_domctl(break ;case XEN_DOMCTL_assign_device: -if (unlikely ((d =get_domain_by_id (domctl->domain)) ==NULL ) ) +if (unlikely ((d =get_domain_by_id (domctl->domain)) ==NULL ) || +unlikely (d->is_dying) ) {printk (XENLOG_G_ERR "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n" );_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel