Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma
From: Christoph Hellwig
Date: Thu Jan 31 2019 - 03:05:06 EST
On Wed, Jan 30, 2019 at 08:44:20PM +0000, Jason Gunthorpe wrote:
> Not really, for MRs most drivers care about DMA addresses only. The
> only reason struct page ever gets involved is because it is part of
> the GUP, SGL and dma_map family of APIs.
And the only way you get the DMA address is through the dma mapping
APIs. Which except for the little oddball dma_map_resource expect
a struct page in some form. And dma_map_resource isn't really up
to speed for full blown P2P.
Now we could and maybe eventually should change all this. But that
is a pre-requisitive for doing anything more fancy, and not something
to be hacked around.
> O_DIRECT seems to be the justification for struct page, but nobody is
> signing up to make O_DIRECT have the required special GUP/SGL/P2P flow
> that would be needed to *actually* make that work - so it really isn't
> a justification today.
O_DIRECT is just the messenger. Anything using GUP will need a struct
page, which is all our interfaces that do I/O directly to user pages.