Re: [PATCH V4 1/2] vfio dma_map/unmap: optimized for hugetlbfs pages

From: Christoph Hellwig
Date: Wed Sep 09 2020 - 13:07:08 EST

On Wed, Sep 09, 2020 at 10:05:18AM -0300, Jason Gunthorpe wrote:
> How to use? The VMAs can have mixed page sizes so the caller would
> have to somehow switch and call twice? Not sure this is faster.

We can find out the page size based on the page. Right now it is
rather cumbersome, but one of willys pending series has a nicer helper
for that.

> > (2) add a bvec version of the API that returns a variable size
> > "extent"
> This is the best one, I think.. The IOMMU setup can have multiple page
> sizes, so having largest contiguous blocks pre-computed should speed
> that up.
> vfio should be a win to use a sgl rather than a page list?
> Especially if we can also reduce the number of pages pinned by only
> pinning head pages..

Especially for raw use of the iommu API as in vfio we don't even need
the scatterlist now, we can call ->map on each chunk. For the DMA API
we'd kinda need it, but not for long.

> What about some 'pin_user_page_sgl' as a stepping stone?

I'd rather avoid adding new scatterlist based APIs.