From: Mitchell Augustin <mitchell.augustin@canonical.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
peterx@redhat.com, clg@redhat.com, akpm@linux-foundation.org,
linux-mm@kvack.org
Subject: Re: [PATCH 0/5] vfio: Improve DMA mapping performance for huge pfnmaps
Date: Thu, 6 Feb 2025 19:39:19 -0600 [thread overview]
Message-ID: <CAHTA-uajC=5ou5dixDkhF-Fwibyk23vCykxwtFquCnZJW+hwvA@mail.gmail.com> (raw)
In-Reply-To: <20250205231728.2527186-1-alex.williamson@redhat.com>
Thanks Alex, this all looks great to me and completely eliminates the
boot time slowdown I was seeing in my tests on our DGX H100 and A100.
I also double-checked the memory mappings reported in /proc/iomem, and
everything looks consistent with how it was prior to this series on
both devices.
Reported-by: "Mitchell Augustin" <mitchell.augustin@canonical.com>
Reviewed-by: "Mitchell Augustin" <mitchell.augustin@canonical.com>
Tested-by: "Mitchell Augustin" <mitchell.augustin@canonical.com>
On Wed, Feb 5, 2025 at 5:18 PM Alex Williamson
<alex.williamson@redhat.com> wrote:
>
> As GPU BAR sizes increase, the overhead of DMA mapping pfnmap ranges has
> become a significant overhead for VMs making use of device assignment.
> Not only does each mapping require upwards of a few seconds, but BARs
> are mapped in and out of the VM address space multiple times during
> guest boot. Also factor in that multi-GPU configurations are
> increasingly commonplace and BAR sizes are continuing to increase.
> Configurations today can already be delayed minutes during guest boot.
>
> We've taken steps to make Linux a better guest by batching PCI BAR
> sizing operations[1], but it only provides and incremental improvement.
>
> This series attempts to fully address the issue by leveraging the huge
> pfnmap support added in v6.12. When we insert pfnmaps using pud and pmd
> mappings, we can later take advantage of the knowledge of the mapping
> level page mask to iterate on the relevant mapping stride. In the
> commonly achieved optimal case, this results in a reduction of pfn
> lookups by a factor of 256k. For a local test system, an overhead of
> ~1s for DMA mapping a 32GB PCI BAR is reduced to sub-millisecond (8M
> page sized operations reduced to 32 pud sized operations).
>
> Please review, test, and provide feedback. I hope that mm folks can
> ack the trivial follow_pfnmap_args update to provide the mapping level
> page mask. Naming is hard, so any preference other than pgmask is
> welcome. Thanks,
>
> Alex
>
> [1]https://lore.kernel.org/all/20250120182202.1878581-1-alex.williamson@redhat.com/
>
>
> Alex Williamson (5):
> vfio/type1: Catch zero from pin_user_pages_remote()
> vfio/type1: Convert all vaddr_get_pfns() callers to use vfio_batch
> vfio/type1: Use vfio_batch for vaddr_get_pfns()
> mm: Provide page mask in struct follow_pfnmap_args
> vfio/type1: Use mapping page mask for pfnmaps
>
> drivers/vfio/vfio_iommu_type1.c | 107 ++++++++++++++++++++------------
> include/linux/mm.h | 2 +
> mm/memory.c | 1 +
> 3 files changed, 72 insertions(+), 38 deletions(-)
>
> --
> 2.47.1
>
--
Mitchell Augustin
Software Engineer - Ubuntu Partner Engineering
prev parent reply other threads:[~2025-02-07 1:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 23:17 Alex Williamson
2025-02-05 23:17 ` [PATCH 4/5] mm: Provide page mask in struct follow_pfnmap_args Alex Williamson
2025-02-07 1:38 ` Mitchell Augustin
2025-02-14 17:17 ` Alex Williamson
2025-02-14 21:39 ` David Hildenbrand
2025-02-17 21:56 ` Alex Williamson
2025-02-14 19:14 ` Jason Gunthorpe
2025-02-05 23:17 ` [PATCH 5/5] vfio/type1: Use mapping page mask for pfnmaps Alex Williamson
2025-02-07 1:39 ` Mitchell Augustin
2025-02-14 19:27 ` Jason Gunthorpe
2025-02-17 21:52 ` Alex Williamson
2025-02-14 19:46 ` Matthew Wilcox
2025-02-17 19:33 ` Alex Williamson
2025-02-06 19:14 ` [PATCH 0/5] vfio: Improve DMA mapping performance for huge pfnmaps Peter Xu
2025-02-07 1:39 ` Mitchell Augustin [this message]
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='CAHTA-uajC=5ou5dixDkhF-Fwibyk23vCykxwtFquCnZJW+hwvA@mail.gmail.com' \
--to=mitchell.augustin@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=alex.williamson@redhat.com \
--cc=clg@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.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