From: Jason Gunthorpe <jgg@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
John Hubbard <jhubbard@nvidia.com>,
David Hildenbrand <david@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [GIT PULL] VFIO fix for v6.0-rc5
Date: Fri, 9 Sep 2022 11:31:49 -0300 [thread overview]
Message-ID: <YxtOVURw00Dtm3rT@nvidia.com> (raw)
In-Reply-To: <20220909060832.17f6607f.alex.williamson@redhat.com>
On Fri, Sep 09, 2022 at 06:08:32AM -0600, Alex Williamson wrote:
> On Fri, 9 Sep 2022 07:53:17 -0400
> Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
> > On Fri, Sep 9, 2022 at 6:52 AM Alex Williamson
> > <alex.williamson@redhat.com> wrote:
> > >
> > > VFIO fix for v6.0-rc5
> > >
> > > - Fix zero page refcount leak (Alex Williamson)
> >
> > Ugh. This is disgusting.
> >
> > Don't get me wrong - I've pulled this, but I think there's some deeper
> > problem that made this patch required.
The basic issue is that VFIO is using the reserved page as an
indication that pin_user_pages_remote() didn't process the page and
instead VFIO's bad follow_pfn() path was used.
It really shouldn't be working like this, which path was used to
obtain the PFN should be recorded independently. VFIO just doesn't
have a datastructure to accommodate it.
Aside from that, most longterm users don't ever even see the zero page
because that typically creates that GUP incoherence we've talked about
alot. The ugly FOLL_FORCE prevents it from happening. VFIO doesn't do
this either so it suffers the incoherence bug along with exposure to
the zero pages :(
David will fix the FOLL_FORCE issue and this will almost go away.
We had a long thread about this and discussed fixing it by simply
setting FOLL_FORCE as other pin_user_page users do. This reached an
interesting point that I'm curious on your view about ABI stability.
It is related to mlock accounting. When vfio pins pages it accounts
for them in mlock. Alex says there are users that set a mlock
limit. VFIO has this historical bug where it doesn't account for every
page it is asked to pin in mlock, eg it ignores the zero page. So, if
we change how GUP or VFIO does page pinning in a way that increases
its mlock charge is this an ABI break?
On one hand users with an very strict limit may find their environment
requires a limit increase after a kernel upgrade. So it fails the
'everything keeps working after kernel upgrade' test.
On the other hand, treating these sorts of limits as ABI means that a
lot of internal stuff is suddenly ABI - eg with a memory cgroup is
increasing the charge on GFP_KERNEL_ACCOUNT also ABI breaking? That
seems unworkable.
Thanks,
Jason
next prev parent reply other threads:[~2022-09-09 14:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-09 10:52 [GIT PULL] VFIO fix for v6.0-rc5 Alex Williamson
2022-09-09 11:53 ` Linus Torvalds
2022-09-09 12:02 ` David Hildenbrand
2022-09-09 18:58 ` John Hubbard
2022-09-09 12:08 ` Alex Williamson
2022-09-09 14:31 ` Jason Gunthorpe [this message]
2022-09-09 11:59 ` pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YxtOVURw00Dtm3rT@nvidia.com \
--to=jgg@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=alex.williamson@redhat.com \
--cc=david@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.