From: Lorenzo Stoakes <ljs@kernel.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Matthew Wilcox <willy@infradead.org>,
Peter Xu <peterx@redhat.com>, Alex Williamson <alex@shazbot.org>,
Anthony Pighin <anthony.pighin@nokia.com>,
linux-kernel@vger.kernel.org,
Kefeng Wang <wangkefeng.wang@huawei.com>,
kvm@vger.kernel.org, linux-mm@kvack.org,
"Liam R. Howlett" <liam@infradead.org>,
Ryan Roberts <ryan.roberts@arm.com>
Subject: Re: [PATCH] vfio: Request THP-aligned mmap for device fds
Date: Mon, 22 Jun 2026 16:42:13 +0100 [thread overview]
Message-ID: <ajlW-Lf_tSBMccw1@lucifer> (raw)
In-Reply-To: <20260619170705.GC1068655@ziepe.ca>
On Fri, Jun 19, 2026 at 02:07:05PM -0300, Jason Gunthorpe wrote:
> On Fri, Jun 19, 2026 at 05:11:50PM +0100, Matthew Wilcox wrote:
> > On Thu, Jun 18, 2026 at 12:28:05PM -0300, Jason Gunthorpe wrote:
> > > On Thu, Jun 18, 2026 at 03:55:58PM +0100, Lorenzo Stoakes wrote:
> > > > Can't we figure this out from what the driver tells us when it invokes an
> > > > mmap_prepare action?
> > >
> > > VFIO installs the pages via fault handler so there is not a naturally
> > > existing way to pass in the pfn?
> >
> > Is there an advantage to doing it this way? I understand why we (eg)
> > demand-page pagecache, that's obvious. But I've never really understood
> > the advantage to taking page faults for PFNMAP areas where we don't
> > really do anything, just figure out which PFN needs to be installed.
> > It defers page table allocation, I suppose.
>
> VFIO has a model where the mapping can come and go, so it makes the
> entire VMA SIGBUS from time to time. The only way to do this currently
> is with faulting.
>
> The mm also had races around populating the mmap in the mmap callback
> and using zap on the inode, faulting avoids those too. Lorenzo may
> have fixed that with the new interface though
Well, you can't populate the mmap in .mmap_prepare, we do it for you.
I guess the issue there is an race with an rmap walker? I did add a (slightly
hideous) hack^Woption that keeps things rmap-locked until after the 'mmap
action' is complete (action->hold_rmap_lock).
So perhaps with that that issue is addressed?
I am figuring out new APIs for mmap_prepare as I carry on converting based on
what people are doing so I guess when I come to VFIO I can do the same thing
there.
>
> Jason
Thanks, Lorenzo
next prev parent reply other threads:[~2026-06-22 15:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 18:01 [PATCH] vfio: Request THP-aligned mmap for device fds Anthony Pighin
2026-06-16 22:30 ` Alex Williamson
2026-06-17 14:21 ` Peter Xu
2026-06-17 18:34 ` Matthew Wilcox
2026-06-17 19:29 ` Jason Gunthorpe
2026-06-18 14:55 ` Lorenzo Stoakes
2026-06-18 15:04 ` Matthew Wilcox
2026-06-18 15:30 ` Jason Gunthorpe
2026-06-18 15:56 ` Lorenzo Stoakes
2026-06-19 13:16 ` Jason Gunthorpe
2026-06-22 16:54 ` Lorenzo Stoakes
2026-06-18 15:28 ` Jason Gunthorpe
2026-06-19 16:11 ` Matthew Wilcox
2026-06-19 17:07 ` Jason Gunthorpe
2026-06-22 15:42 ` Lorenzo Stoakes [this message]
2026-06-22 15:44 ` Lorenzo Stoakes
2026-06-19 15:04 ` Ryan Roberts
2026-06-22 15:48 ` Lorenzo Stoakes
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=ajlW-Lf_tSBMccw1@lucifer \
--to=ljs@kernel.org \
--cc=alex@shazbot.org \
--cc=anthony.pighin@nokia.com \
--cc=jgg@ziepe.ca \
--cc=kvm@vger.kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=wangkefeng.wang@huawei.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