[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [Patch RFC 12/13] vt-d: For gnttab_transfer, If the Device-TLB flush is still



not completed when to map the transferring page to a remote
domain, schedule and wait on a waitqueue until the Device-TLB
flush is completed.

Signed-off-by: Quan Xu <quan.xu@xxxxxxxxx>
---
 xen/common/grant_table.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index f2ed64a..9bf2009 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1808,6 +1808,22 @@ gnttab_transfer(
         guest_physmap_remove_page(d, gop.mfn, mfn, 0);
         gnttab_flush_tlb(d);
 
+#ifdef HAS_PASSTHROUGH
+        /*
+         * The page freed from the domain should be on held, until the
+         * Device-TLB flush is completed. The page previously associated
+         * with the freed portion of GPA should not be reallocated for
+         * another purpose until the appropriate invalidations have been
+         * performed. Otherwise, the original page owner can still access
+         * freed page though DMA.
+         *
+         * If the Device-TLB flush is still not completed, schedule and
+         * wait on a waitqueue until the Device-TLB flush is completed.
+         */
+        if ( QI_FLUSHING(d) )
+            wait_for_qi_flushing(d);
+#endif
+
         /* Find the target domain. */
         if ( unlikely((e = rcu_lock_domain_by_id(gop.domid)) == NULL) )
         {
-- 
1.8.3.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.