Re: [PATCH] vfio/type1: Unpin zero pages

From: Alex Williamson
Date: Wed Sep 07 2022 - 21:10:31 EST


On Wed, 7 Sep 2022 20:07:02 -0300
Jason Gunthorpe <jgg@xxxxxxxx> wrote:

> On Wed, Sep 07, 2022 at 02:24:16PM -0600, Alex Williamson wrote:
>
> > Also, I want to clarify, is this a recommendation relative to the
> > stable patch proposed here, or only once we get rid of shared zero page
> > pinning? We can't simply do accounting on the shared zero page since a
> > single user can overflow the refcount.
>
> Yes, here I would account properly in a way that keeps working for
> future GUP changes because if something goes wrong with this simple
> patch it has a simple fix.
>
> Trialing it will get some good data to inform what David's patch
> should do.
>
> Overall have the feeling that a small group of people might grumble
> that their limits break, but with a limit adjustment they can probably
> trivially move on. It would be very interesting to see if someone
> feels like the issue is important enough to try and get something
> changed.
>
> You could also fix it by just using FOLL_FORCE (like RDMA/io_uring
> does), which fixes the larger issue Kevin noted that the ROM doesn't
> become visible to DMA.

That's only a theoretical problem, I suspect there are absolutely zero
cases where this is an actual problem. Doing anything other than
simply fixing the leak for stable seems reckless, we're not actually
consuming resources that need to be accounted until David's changes
come through, and we risk breaking users on a broad scale. IMO, the
fix proposed here is the correct first step and we can start
experimenting with accounting the zero page moving forward. Thanks,

Alex