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

RE: [PATCH v2 0.9/2] VT-d: don't needlessly look up DID


  • To: "Beulich, Jan" <JBeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Fri, 8 Apr 2022 04:08:16 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=x7QBY+2397q67d8T16EQA4MJaySGLnCri0MEKS8LzgY=; b=bNyCa281tljK7Ywxc5nfRFIlpPrIIlJt2IA49gZwsNYquMnH9TH+TqDmJ+AcRSPpMSREo9bT29wTwwa9EJPbG8hWlGbl6pnIqRUtNQqNC+eFjIBEmlDKTDi79VkeBT9inCGhEm1eMOT4Cq5MJD3iuRfN4TBeKKg3/fzvJX3uNehagXRz76SRDExwJQFxUCTxNlbPduhGPSQeIeJmYLO5PjXAhOPC27moxMV210Cn2TDdryCTszcE9B717toOjecA4e8rgnXmjbo3L+//jydpVAa16pT/MUBus0bQaJyXwMwis9lJFStQ85MlWPHmXU9TKLaEKGen6BsYqyiqYuB+MQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bg1HSdmmoy9DLbKQjTvNmgvS4vPsFmSG7h37z1w22LolCdPjnuRYSMrICvUfVpOnIzpX2IPfAF5gY0I/CSa7ONvYCCJ7ienyDfag+av10JXZyk00Dz5XOcpNGUN4BZi/VGJ9JkeuxrmxQO3FhNt0upJjtdKRtiX0cr2n7R+Y3a8EYcABf8a5gpveK6eSZAErOljgZT99GK0+99i122zpeD4CO++UV1VxIkIEQ8OZIyrLZyG94yKcZSW7zqv7+nEaq+OP5/RsYtxEuHfqYnJelVjhwPlcWhOuZCsnJciJ0NPtrOa4SGuKUeVgcFcKMicn72uybbFy9pHP1LWxzrYSSA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com;
  • Cc: Pau Monné, Roger <roger.pau@xxxxxxxxxx>, "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Fri, 08 Apr 2022 04:08:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYSmHO5XmPjC2LsUKpawre5sD9M6zlZ60w
  • Thread-topic: [PATCH v2 0.9/2] VT-d: don't needlessly look up DID

> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Thursday, April 7, 2022 5:28 PM
> 
> If get_iommu_domid() in domain_context_unmap_one() fails, we better
> wouldn't clear the context entry in the first place, as we're then unable
> to issue the corresponding flush. However, we have no need to look up the
> DID in the first place: What needs flushing is very specifically the DID
> that was in the context entry before our clearing of it.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

> ---
> This (an intended follow-up to XSA-399) is actually a prereq to what was
> called patch 1 so far in this series.
> 
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1830,18 +1830,12 @@ int domain_context_unmap_one(
>          return 0;
>      }
> 
> +    iommu_domid = context_domain_id(*context);
> +
>      context_clear_present(*context);
>      context_clear_entry(*context);
>      iommu_sync_cache(context, sizeof(struct context_entry));
> 
> -    iommu_domid = get_iommu_did(domid, iommu, !domain->is_dying);
> -    if ( iommu_domid == -1 )
> -    {
> -        spin_unlock(&iommu->lock);
> -        unmap_vtd_domain_page(context_entries);
> -        return -EINVAL;
> -    }
> -
>      rc = iommu_flush_context_device(iommu, iommu_domid,
>                                      PCI_BDF2(bus, devfn),
>                                      DMA_CCMD_MASK_NOBIT, 0);


 


Rackspace

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