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

RE: [PATCH v4 07/14] iommu: make map, unmap and flush all take both an order and a count


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Fri, 14 Aug 2020 06:57:05 +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-SenderADCheck; bh=fzsuMYi13MyzeZoitFJGmiP1c3xEu3kj1x8Ul5SCVJs=; b=K4zAcFzhWr3JI5/XJPUeRdwQjpOfEFKN9X9ja94oro+H0FyzlqK2htndPdM2EWKJ2yQ3RKuXS2hlkoCwranZIZx34UKCuQrBAVHKon+RjJUWe6nYjH7Ky4PkUkPoWrC7kJ+KXSiETTxTiZcX3QUllwDQOyPYAgFOBz7skUKMsU+RyoHsbUhEhuWY3YzOZw0WDciqM/VnwJNT4f088mJH6hl8gYmlpSzw6oNkbpxO3HxqxV73MJv6Gigi8/wzGLYthzoZepgvZKTopQxDMhJ3Nv7zh2ZRm9hW79mN9DdyDH9a7ZtWb5BwiowxQrN7IMb/hYeNORGYpFnuPWme6vqoQw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vnlpg41kNksnadKUJMC/9t3s/LbonRcsU055dxJMrbvZ4T+ep7GgbeQxQqbWiOBdeUpO68mbu5LQWZFIzOHXgt45zyFlvTzT4PVej0E5t2pvrGBPh1iMjhhm2sjn3j04m9gzLdoqW2SH1aZ2eIxnLOyacqOY492AdrXRrZXnOSVUm/vJHGLANQQH455AMgqjPDw5S0/v89qSoBMEDh0/RgBufwqH/pVgTHb7dP8sQTcl81Va4AjbbGc/Pawqq9ZRXwpaJo0crE0Q04dYy0JpdgfkpVjDbKPj1Geuj8QNwl/IGGCqpYtPSNHlDB1nr91ijuUvVJoh3yEs1JBMAS1fXw==
  • Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=intel.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Paul Durrant" <pdurrant@xxxxxxxxxx>, "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 14 Aug 2020 06:57:13 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.5.1.3
  • Ironport-sdr: AKmDMp4M0pgYtrwgmWSgpPcvgA/RuhvGcnn1jY5yQptiN3he4W2EwWNH40rZyJx5MxKYfXXKmZ /3AFSJGMZmTQ==
  • Ironport-sdr: lEGn2LLEeuAHf+2Lc5ysC2fQHyYm83yt7NanpvUamE0/KZElRyIsSkyQcHRUPYze/wfRsXqY7n Zhvpcy/7idfw==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWamUjxZsfcXwlgkeaKOBP1/0Smqkq2x4AgAxgEYA=
  • Thread-topic: [PATCH v4 07/14] iommu: make map, unmap and flush all take both an order and a count

> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Thursday, August 6, 2020 5:57 PM
> 
> On 04.08.2020 15:42, Paul Durrant wrote:
> > From: Paul Durrant <pdurrant@xxxxxxxxxx>
> >
> > At the moment iommu_map() and iommu_unmap() take a page order but
> not a
> > count, whereas iommu_iotlb_flush() takes a count but not a page order.
> > This patch simply makes them consistent with each other.
> 
> Why can't we do with just a count, where order gets worked out by
> functions knowing how to / wanting to deal with higher order pages?

Agree. especially the new map/unmap code looks weird when having both 
order and count in parameters.

Thanks
Kevin

> 
> > --- a/xen/arch/x86/mm/p2m-ept.c
> > +++ b/xen/arch/x86/mm/p2m-ept.c
> > @@ -843,7 +843,7 @@ out:
> >           need_modify_vtd_table )
> >      {
> >          if ( iommu_use_hap_pt(d) )
> > -            rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order),
> > +            rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order), 1,
> 
> Forgot to drop the "1 << "? (There are then I think two more instances
> further down.)
> 
> > --- a/xen/common/memory.c
> > +++ b/xen/common/memory.c
> > @@ -851,12 +851,12 @@ int xenmem_add_to_physmap(struct domain *d,
> struct xen_add_to_physmap *xatp,
> >
> >          this_cpu(iommu_dont_flush_iotlb) = 0;
> >
> > -        ret = iommu_iotlb_flush(d, _dfn(xatp->idx - done), done,
> > +        ret = iommu_iotlb_flush(d, _dfn(xatp->idx - done), 0, done,
> 
> Arguments wrong way round? (This risk of inverting their order is
> one of the primary reasons why I think we want just a count.) I'm
> also uncertain about the use of 0 vs PAGE_ORDER_4K here.
> 
> >                                  IOMMU_FLUSHF_added | 
> > IOMMU_FLUSHF_modified);
> >          if ( unlikely(ret) && rc >= 0 )
> >              rc = ret;
> >
> > -        ret = iommu_iotlb_flush(d, _dfn(xatp->gpfn - done), done,
> > +        ret = iommu_iotlb_flush(d, _dfn(xatp->gpfn - done), 0, done,
> 
> Same here then.
> 
> Jan

 


Rackspace

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