public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Daniel Vetter <daniel@ffwll.ch>,
	rafael.barbalho@intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [RFC 2/2] drm/i915: Clean-up PPGTT on context destruction
Date: Thu, 26 Feb 2015 00:17:52 +0100	[thread overview]
Message-ID: <20150225231752.GI24485@phenom.ffwll.local> (raw)
In-Reply-To: <20150223164151.GI24485@phenom.ffwll.local>

On Mon, Feb 23, 2015 at 05:41:51PM +0100, Daniel Vetter wrote:
> On Fri, Feb 13, 2015 at 10:34:51AM +0000, Chris Wilson wrote:
> > On Fri, Feb 13, 2015 at 10:55:46AM +0100, Daniel Vetter wrote:
> > > On Thu, Feb 12, 2015 at 09:03:06PM +0000, Chris Wilson wrote:
> > > > On Thu, Feb 12, 2015 at 08:05:02PM +0000, rafael.barbalho@intel.com wrote:
> > > > > From: Rafael Barbalho <rafael.barbalho@intel.com>
> > > > > 
> > > > > With full PPGTT enabled an object's VMA entry into a PPGTT VM needs to be
> > > > > cleaned up so that the PPGTT PDE & PTE allocations can be freed.
> > > > > 
> > > > > This problem only shows up with full PPGTT because an object's VMA is
> > > > > only cleaned-up when the object is destroyed. However, if the object has
> > > > > been shared between multiple processes this may not happen, which leads to
> > > > > references to the PPGTT still being kept the object was shared.
> > > > > 
> > > > > Under android the sharing of GEM objects is a fairly common operation, thus
> > > > > the clean-up has to be more agressive.
> > > > 
> > > > Not quite. You need an active refcount as we do not expect close(fd) to
> > > > stall. The trick is to "simply" use requests to retire vma (as well as
> > > > the object management it does today, though that just becomes a second
> > > > layer for GEM API management, everything else goes through vma).
> > > 
> > > Linking into the ctx unref should give us that for free since requests do
> > > hold a reference on the context. So this will only be run when the buffers
> > > are idle.
> > > 
> > > Well except that our unbind code is too dense to do that correctly for
> > > shared buffers, so we need to move obj->active to vma->active first.
> > 
> > We unbind vma, so what do you mean?
> 
> The unbind of the vma will block since we track active per-obj instead of
> per-vma. Which is kinda not that cool for a kref_put cleanup function.
> 
> But yeah the below is what I had in mind too, with the mentioned nuisance
> fixed.

Oh and there's a fun bit of code to clean up - in the execbuf code we just
pin the 2nd vma for the ggtt, which crucially relies on the ->active
boolean being shared by all vmas. That needs to be fixed first before we
can move obj->active to vma->active. For context see

commit da51a1e7e398129d9fddd4b26b8469145dd4fd08
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Aug 11 12:08:58 2014 +0200

    drm/i915: Fix secure dispatch with full ppgtt

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-02-25 23:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12 20:05 [RFC 0/2] Contain PPGTT memory leak/usage in true PPGTT mode rafael.barbalho
2015-02-12 20:05 ` [RFC 1/2] drm/i915: Export active PPGTTs in debugfs rafael.barbalho
2015-02-12 20:05 ` [RFC 2/2] drm/i915: Clean-up PPGTT on context destruction rafael.barbalho
2015-02-12 21:03   ` Chris Wilson
2015-02-13  9:55     ` Daniel Vetter
2015-02-13 10:34       ` Chris Wilson
2015-02-23 16:41         ` Daniel Vetter
2015-02-23 16:50           ` Chris Wilson
2015-02-23 16:52             ` Barbalho, Rafael
2015-02-23 23:44               ` Daniel Vetter
2015-02-25 23:17           ` Daniel Vetter [this message]
2015-02-13  9:51   ` Daniel Vetter
2015-02-13 10:05     ` Chris Wilson
2015-02-23 16:43       ` Daniel Vetter

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=20150225231752.GI24485@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rafael.barbalho@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox