Re: [RFC PATCH 0/5] vfio/pci: Support ZONE_DEVICE-backed P2P Registration
From: Pranjal Shrivastava
Date: Thu Jun 11 2026 - 10:41:25 EST
On Wed, Jun 10, 2026 at 01:28:48PM -0300, Jason Gunthorpe wrote:
> On Wed, Jun 10, 2026 at 03:18:48PM +0000, Pranjal Shrivastava wrote:
>
> > Users utilize the standard sysfs p2pmem/allocate interface for managing
> > memory slices once a BAR is registered.
>
> I'm shocked someone wants to use API, what are you expecting to do
> with it??
Our primary use-case is PCIe BAR (DDR / HBM) -> NFS via P2PDMA while the
PCIe device is managed by a user-space driver based on vfio-pci. While
kernel drivers (e.g.drm) can register BARs with ZONE_DEVICE natively to
enable this, VFIO currently lacks an equivalent mechanism.
>
> > An alternative implementation has been explored which integrates with the
> > ongoing VFIO DMABUF-mmap refactor [1]. In that approach, rather than
> > registering a BAR as a system-wide P2P provider, VFIO optionally
> > allocates ZONE_DEVICE pages only for specifically exported DMABUFs via a
> > new VFIO_DMA_BUF_FLAG_ALLOC_STRUCT_PAGES flag.
>
> That's probably more sensible but you can't have a DMABUF mmap
> actually install non-special memory. The native vfio mmap still can,
> but not mmap on the dmabuf fd. That's still workable, just keep in
> mind.
Ack. I guess, we could have a separate mmap path in case of BARs that are
struct page backed which doesn't go through the dmabuf exporter.
That said, we don't mind moving away from the old API if VFIO mmap can
support this, we don't mind open-coding with devmem_remap_pages.
Effectively, we just need a struct page-backed BAR exporter, preferably,
via VFIO.
>
> What do you even intend to do with this? With the new work to tie
> dmabuf directly into io_uring I really wonder if this is worth doing
> for VFIO?
I agree that Pavel's io_uring series is great for the Block Layer [1],
However, it doesn't help with NFS + O_DIRECT which still relies on
struct page for DMA mapping. We have a series to modernize NFS to support
P2PDMA [2][3] and while I understand native dmabuf read/writes are coming
into play, their integration into NFS is a distant future (which probably
we'll have a stab at once Pavel's series settles).
Thus, we'd like to provide a standard, VFS-compatible P2P path via VFIO
we're willing to help maintain this if needed.
Thanks,
Praan
[1] https://lore.kernel.org/all/cover.1777475843.git.asml.silence@xxxxxxxxx/
[2] https://lore.kernel.org/all/20260603053033.3300318-1-praan@xxxxxxxxxx/
[3] [RFC] https://lore.kernel.org/all/20260401194501.2269200-1-praan@xxxxxxxxxx/