[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y77uM/X94DtKXtK0@google.com>
Date: Wed, 11 Jan 2023 17:13:23 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Christian König <christian.koenig@....com>,
Dmitry Osipenko <dmitry.osipenko@...labora.com>,
David Airlie <airlied@...ux.ie>, Huang Rui <ray.huang@....com>,
Trigger Huang <Trigger.Huang@...il.com>,
Gert Wollny <gert.wollny@...labora.com>,
Antonio Caggiano <antonio.caggiano@...labora.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Dmitry Osipenko <digetx@...il.com>, kvm@...r.kernel.org,
kernel@...labora.com, virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v1] drm/ttm: Refcount allocated tail pages
On Tue, Sep 06, 2022, Daniel Vetter wrote:
> On Tue, Sep 06, 2022 at 10:01:47PM +0200, Daniel Vetter wrote:
> > On Mon, Aug 15, 2022 at 12:05:19PM +0200, Christian König wrote:
> > > Am 15.08.22 um 11:54 schrieb Dmitry Osipenko:
> > > > Higher order pages allocated using alloc_pages() aren't refcounted and they
> > > > need to be refcounted, otherwise it's impossible to map them by KVM. This
> > > > patch sets the refcount of the tail pages and fixes the KVM memory mapping
> > > > faults.
> > > >
> > > > Without this change guest virgl driver can't map host buffers into guest
> > > > and can't provide OpenGL 4.5 profile support to the guest. The host
> > > > mappings are also needed for enabling the Venus driver using host GPU
> > > > drivers that are utilizing TTM.
> > > >
> > > > Based on a patch proposed by Trigger Huang.
> > >
> > > Well I can't count how often I have repeated this: This is an absolutely
> > > clear NAK!
> > >
> > > TTM pages are not reference counted in the first place and because of this
> > > giving them to virgl is illegal.
> > >
> > > Please immediately stop this completely broken approach. We have discussed
> > > this multiple times now.
> >
> > Yeah we need to get this stuff closed for real by tagging them all with
> > VM_IO or VM_PFNMAP asap.
>
> For a bit more context: Anything mapping a bo should be VM_SPECIAL. And I
> think we should add the checks to the gem and dma-buf mmap functions to
> validate for that, and fix all the fallout.
>
> Otherwise this dragon keeps resurrecting ...
>
> VM_SPECIAL _will_ block get_user_pages, which will block everyone from
> even trying to refcount this stuff.
FWIW, IIUC that won't change the KVM story. KVM acquires the PFN for these pages
via follow_pte(), not by gup(). Details are in a different strand of this thread[*].
If TTM pages aren't tied into mmu_notifiers, then I believe the only solution is
to not allow them to be mapped into user page tables. If they are tied into
mmu_notifiers, then this is fully a KVM limitation that we are (slowly) resolving.
[*] https://lore.kernel.org/all/Y77sQZI0IfFVx7Jo@google.com
Powered by blists - more mailing lists