From: Jason Gunthorpe <jgg@nvidia.com>
To: David Matlack <dmatlack@google.com>
Cc: Aaron Lewis <aaronlewis@google.com>,
alex.williamson@redhat.com, kvm@vger.kernel.org,
seanjc@google.com
Subject: Re: [RFC PATCH 1/2] vfio: Improve DMA mapping performance for huge pages
Date: Mon, 5 Jan 2026 15:01:21 -0400 [thread overview]
Message-ID: <20260105190121.GA193546@nvidia.com> (raw)
In-Reply-To: <CALzav=c32W4d=_WtXHWDmjfQaJDyzdxWXS9_kVHvseUsqh=+NQ@mail.gmail.com>
On Mon, Jan 05, 2026 at 10:31:14AM -0800, David Matlack wrote:
> Ack on the feedback that this is not a general solution and we should
> switch to iommufd with memfd pinning for our use-case. But I think
> Google will need to carry an optimization locally to type1 until we
> can make that switch to meet our goals.
>
> For HugeTLB mappings specifically, can it be assumed the VMA contains
> the entire folio? I'm wondering what is the safest way to achieve
> performance close to what Aaron achieved in his patch in type1 for
> HugeTLB and DevDAX. (Not for upstream, just internally.)
If you are certain the address range in question is a single VMA and
that VMA is one of the special memfd-like types then you should be
able to do that.
The issue here is that VFIO doesn't have any idea about VMAs and
pin_user_pages_fast() doesn't check them. So you need to give up
pin_user_pages_fast() and have vfio code bound the work to actual VMAs
under a lock with the table read to make this solution work fully
properly.
Of course for your very special use case the VMM isn't creating sliced
up VMAs and trying to attack the kernel with them so the simple
solution here is workable with VMM co-operation. (though it opens a
sort of security problem of course)
But I wouldn't want to see such hackery in upstream.
Jason
next prev parent reply other threads:[~2026-01-05 19:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 23:00 [RFC PATCH 0/2] vfio: Improve DMA mapping performance for huge pages Aaron Lewis
2025-12-23 23:00 ` [RFC PATCH 1/2] " Aaron Lewis
2025-12-24 2:10 ` Jason Gunthorpe
2025-12-29 21:40 ` Aaron Lewis
2025-12-30 1:12 ` Jason Gunthorpe
2026-01-05 18:31 ` David Matlack
2026-01-05 19:01 ` Jason Gunthorpe [this message]
2026-01-05 19:36 ` David Matlack
2025-12-23 23:00 ` [RFC PATCH 2/2] vfio: selftest: Add vfio_dma_mapping_perf_test Aaron Lewis
2025-12-24 2:04 ` [RFC PATCH 0/2] vfio: Improve DMA mapping performance for huge pages Jason Gunthorpe
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=20260105190121.GA193546@nvidia.com \
--to=jgg@nvidia.com \
--cc=aaronlewis@google.com \
--cc=alex.williamson@redhat.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.