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

[Xen-devel] [Patch RFC 10/13] vt-d: Held on the removed page until the Device-TLB flush is completed.



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

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 61bb94c..4b2def5 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -253,7 +253,21 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
 
     guest_physmap_remove_page(d, gmfn, mfn, 0);
 
-    put_page(page);
+#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 ( need_iommu(d) && QI_FLUSHING(d) && !d->is_dying )
+        qi_hold_page(d, page);
+    else
+#endif
+        put_page(page);
+
     put_gfn(d, gmfn);
 
     return 1;
-- 
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®.