Re: [RFC PATCH v1 00/18] Provide a new two step DMA API mapping API

From: Christoph Hellwig
Date: Sat Jul 13 2024 - 01:24:29 EST


On Fri, Jul 12, 2024 at 09:42:37AM -0300, Jason Gunthorpe wrote:
> On Fri, Jul 12, 2024 at 06:54:22AM +0200, Christoph Hellwig wrote:
>
> > This is all purely hypothetical, and I'm happy to just check for it
> > and reject it for it now.
>
> I do know a patch set is cooking to allow mixing ZONE_DEVICE P2P and
> anon memory in the same VMA ala HMM with transparent migration of
> ZONE_DEVICE to anon.
>
> In this situation userspace will be generating IO with no idea about
> any P2P/!P2P boundaries.

Yes. And as said from the beginning of these discussion I think the
right way is to change the gup code so that for a single call to
get/pin_user_pages it always returns either only P2P pages or non-P2P
pages only, with the FOLL_PCI_P2PDMA just allowing P2P pages at all.
Similarly they could easily just return one kind of P2P pages per
call only.