dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Matthew Brost <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	leonro@nvidia.com, francois.dugast@intel.com,
	thomas.hellstrom@linux.intel.com,
	himal.prasad.ghimiray@intel.com
Subject: Re: [RFC PATCH v2 0/3] Use new dma-map IOVA alloc, link, and sync API in GPU SVM and DRM pagemap
Date: Fri, 23 Jan 2026 20:26:10 -0400	[thread overview]
Message-ID: <20260124002610.GC1641016@ziepe.ca> (raw)
In-Reply-To: <aXP8B/tAuJO1hfx1@lstrano-desk.jf.intel.com>

On Fri, Jan 23, 2026 at 02:53:59PM -0800, Matthew Brost wrote:
> > Thats a 2x improvement in overall full operation? Wow!
> > 
> > Did you look at how non-iommu cases perform too?
> > 
> 
> Like intel_iommu=off kerenl command line? I haven't checked that but can.

iommu.passthrough=1

This is generally what we recommend everyone who cares about
performance more than iommu protection should use by default. It
leaves the iommu HW turned on, which x86 requires for other reasons,
but eliminates the performance cost to DMA.

> > I think we can do better still for the non-cached platforms as I have
> > a way in mind to batch up lines and flush the line instead of flushing
> > for every 8 byte IOPTE written. Some ARM folks have been talking about
> > this problem too..
> 
> Yes, prior to the IOMMU changes I believe the basline was ~330us so
> dma-map/unmap are still way slower than before and if this affect
> platforms other than Intel x86 there will be complaints everyone until
> the entire kernel moves to the IOVA alloc model.

I have managed to get a test showing that when cache flushing is
turned on the new code is 50% slower. I'm investigating this..

map_pages
   pgsz  ,avg new,old ns, min new,old ns  , min % (+ve is better)
     2^12,    331,249   ,     289,214     , -35.35
     2^21,    335,243   ,     306,222     , -37.37
     2^30,    226,238   ,     205,215     ,   4.04
    # test_map_unmap_benchmark:
unmap_pages
   pgsz  ,avg new,old ns, min new,old ns  , min % (+ve is better)
     2^12,    389,272   ,     347,237     , -46.46
     2^21,    321,261   ,     297,239     , -24.24
     2^30,    237,251   ,     214,228     ,   6.06

So it looks to me like this is isolated to Intel GPU for the moment
because it is the only device that would use the cache flushing flow
until we convert ARM.

FWIW, on my system enabling cache flushing goes from 60ns to 250ns, it
has a huge, huge cost to these flows.

> Also another question does IOVA alloc support modes similar to
> dma_map_resource between per device? We also do that and I haven't
> modified that code or check that for perf regressions.

Yes, and no.. The API does, but Christoph doesn't want to let arbitary
drivers use it. So you need to figure out some way to get there.

For reference Leon added dma_buf_phys_vec_to_sgt() which shows this
flow to create a sg_table.

There are also hmm helpers for the mapping too if this is in a hmm
context.

A PCI device calling map_resource is incorrect usage of the DMA API,
but it was the only option till now.

Jason

  reply	other threads:[~2026-01-24  0:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23 21:59 [RFC PATCH v2 0/3] Use new dma-map IOVA alloc, link, and sync API in GPU SVM and DRM pagemap Matthew Brost
2026-01-23 21:59 ` [RFC PATCH v2 1/3] drm/pagemap: Add helper to access zone_device_data Matthew Brost
2026-01-23 21:59 ` [RFC PATCH v2 2/3] drm/gpusvm: Use new dma-map IOVA alloc, link, and sync API in GPU SVM Matthew Brost
2026-01-23 21:59 ` [RFC PATCH v2 3/3] drm/pagemap: Use new dma-map IOVA alloc, link, and sync API for DRM pagemap Matthew Brost
2026-01-23 22:41 ` [RFC PATCH v2 0/3] Use new dma-map IOVA alloc, link, and sync API in GPU SVM and " Jason Gunthorpe
2026-01-23 22:53   ` Matthew Brost
2026-01-24  0:26     ` Jason Gunthorpe [this message]
2026-01-27 16:54       ` Matthew Brost
2026-01-27 18:37         ` Jason Gunthorpe
2026-01-27 19:05           ` Matthew Brost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260124002610.GC1641016@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=francois.dugast@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=leonro@nvidia.com \
    --cc=matthew.brost@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox