public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	peterx@redhat.com, mitchell.augustin@canonical.com,
	clg@redhat.com, willy@infradead.org
Subject: Re: [PATCH v2 6/6] vfio/type1: Use mapping page mask for pfnmaps
Date: Mon, 24 Feb 2025 20:17:52 -0400	[thread overview]
Message-ID: <20250225001752.GL520155@nvidia.com> (raw)
In-Reply-To: <20250218222209.1382449-7-alex.williamson@redhat.com>

On Tue, Feb 18, 2025 at 03:22:06PM -0700, Alex Williamson wrote:
> vfio-pci supports huge_fault for PCI MMIO BARs and will insert pud and
> pmd mappings for well aligned mappings.  follow_pfnmap_start() walks the
> page table and therefore knows the page mask of the level where the
> address is found and returns this through follow_pfnmap_args.pgmask.
> Subsequent pfns from this address until the end of the mapping page are
> necessarily consecutive.  Use this information to retrieve a range of
> pfnmap pfns in a single pass.
> 
> With optimal mappings and alignment on systems with 1GB pud and 4KB
> page size, this reduces iterations for DMA mapping PCI BARs by a
> factor of 256K.  In real world testing, the overhead of iterating
> pfns for a VM DMA mapping a 32GB PCI BAR is reduced from ~1s to
> sub-millisecond overhead.
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>  drivers/vfio/vfio_iommu_type1.c | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

  parent reply	other threads:[~2025-02-25  0:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18 22:22 [PATCH v2 0/6] vfio: Improve DMA mapping performance for huge pfnmaps Alex Williamson
2025-02-18 22:22 ` [PATCH v2 1/6] vfio/type1: Catch zero from pin_user_pages_remote() Alex Williamson
2025-02-18 22:22 ` [PATCH v2 2/6] vfio/type1: Convert all vaddr_get_pfns() callers to use vfio_batch Alex Williamson
2025-02-18 22:22 ` [PATCH v2 3/6] vfio/type1: Use vfio_batch for vaddr_get_pfns() Alex Williamson
2025-02-18 22:22 ` [PATCH v2 4/6] vfio/type1: Use consistent types for page counts Alex Williamson
2025-02-18 22:46   ` Peter Xu
2025-02-19  0:55     ` Mitchell Augustin
2025-02-25  0:17   ` Jason Gunthorpe
2025-02-18 22:22 ` [PATCH v2 5/6] mm: Provide address mask in struct follow_pfnmap_args Alex Williamson
2025-02-19  8:31   ` David Hildenbrand
2025-02-26 19:54     ` Alex Williamson
2025-02-26 20:05       ` David Hildenbrand
2025-02-18 22:22 ` [PATCH v2 6/6] vfio/type1: Use mapping page mask for pfnmaps Alex Williamson
2025-02-18 22:47   ` Peter Xu
2025-02-18 23:14     ` Alex Williamson
2025-02-19  2:36       ` Mitchell Augustin
2025-02-19 15:08         ` Alex Williamson
2025-02-19 20:32           ` Mitchell Augustin
2025-02-26 17:55             ` Alex Williamson
2025-02-27 20:22               ` Mitchell Augustin
2025-02-25  0:17   ` Jason Gunthorpe [this message]
2025-02-19  2:37 ` [PATCH v2 0/6] vfio: Improve DMA mapping performance for huge pfnmaps Mitchell Augustin
2025-02-28 16:32 ` Alex Williamson

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=20250225001752.GL520155@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=clg@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mitchell.augustin@canonical.com \
    --cc=peterx@redhat.com \
    --cc=willy@infradead.org \
    /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