On 27.07.2020 11:37, Durrant, Paul wrote:
From: Andrew Cooper <andrew.coop...@citrix.com>
Sent: 24 July 2020 19:24
On 24/07/2020 17:46, Paul Durrant wrote:
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -140,11 +140,19 @@ int arch_iommu_domain_init(struct domain *d)

      spin_lock_init(&hd->arch.mapping_lock);

+    INIT_PAGE_LIST_HEAD(&hd->arch.pgtables.list);
+    spin_lock_init(&hd->arch.pgtables.lock);
+
      return 0;
  }

  void arch_iommu_domain_destroy(struct domain *d)
  {
+    struct domain_iommu *hd = dom_iommu(d);
+    struct page_info *pg;
+
+    while ( (pg = page_list_remove_head(&hd->arch.pgtables.list)) )
+        free_domheap_page(pg);
Some of those 90 lines saved were the logic to not suffer a watchdog
timeout here.

To do it like this, it needs plumbing into the relinquish resources path.

Ok. I does look like there could be other potentially lengthy destruction done 
off the back of the RCU call. Ought we have the ability to have a restartable 
domain_destroy()?
I don't see how this would be (easily) feasible. Instead - why do
page tables not get cleaned up already at relinquish_resources time?

Jan

Reply via email to