From mboxrd@z Thu Jan 1 00:00:00 1970 From: Quan Xu Subject: [Patch RFC 12/13] vt-d: For gnttab_transfer, If the Device-TLB flush is still Date: Wed, 16 Sep 2015 09:24:06 -0400 Message-ID: <1442409847-65383-13-git-send-email-quan.xu@intel.com> References: <1442409847-65383-1-git-send-email-quan.xu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1442409847-65383-1-git-send-email-quan.xu@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: andrew.cooper3@citrix.com, eddie.dong@intel.com, ian.campbell@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, jun.nakajima@intel.com, keir@xen.org, kevin.tian@intel.com, tim@xen.org, yang.z.zhang@intel.com, george.dunlap@eu.citrix.com Cc: Quan Xu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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 --- 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