Re: [PATCH v6 03/34] iov_iter: Pass I/O direction into iov_iter_get_pages*()

From: Christoph Hellwig
Date: Thu Jan 19 2023 - 00:47:52 EST


On Thu, Jan 19, 2023 at 12:15:44AM +0000, Al Viro wrote:
> Actually, looking at that thing... Currently we use it only for
> FOLL_PCI_P2PDMA. It alters behaviour of get_user_pages_fast(), but...
> it is completely ignored for ITER_BVEC or ITER_PIPE. So how the
> hell is it supposed to work?

It broadens the acceptance criteria for UBUF/IOVEC types. It doesn't
change behavior for already accepted memory for those or any others.

> Could somebody give a braindump on that thing? It looks like we
> have pages that should not be DMA'd to/from unless driver takes
> some precautions and we want to make sure they won't be fed to
> drivers that don't take such. With checks done in a very odd
> place...

Yes, normal gup excludes P2P pages. This flag allows it to get them.