[Intel-gfx] [RFC 0/2] Contain PPGTT memory leak/usage in true PPGTT mode

rafael.barbalho at intel.com rafael.barbalho at intel.com
Thu Feb 12 12:05:00 PST 2015


From: Rafael Barbalho <rafael.barbalho at intel.com>

This particular memory leak, if I can call it that, shows itself when i915
is in true PPGTT mode and you share a buffer object to another hardware
context using flink.

In the failure case harware context A creates an object & does some rendering
 to it, in turn mapping to its PPGTT, flinks it and then shares the object 
with hardware context B. Hardware context B then does some rendering operation
 with the share object, adding a VMA to its PPGTT address space, but it's 
eventually exited by the user. Because i915 doesn't clean-up an object's VMAs
until the object is destroyed all the PPGTT memory allocations for hardware 
context B will still be kept a live because an object is still referencing it.

When you repeat this sharing and re-using multiple times the system eventually
runs out of memory because of all these PPGTT memory allocations for old
contexts are still hanging around but will actually never be used again. I am
also not seeing the shrinker coming in to reap this object because it is active
in another hardware contexts.

This naive attempt at fixing the issue is to clean-up the PPGTT entries when
the context is destroyed.

Patch 1 is what I used to help me track the issue and see the VM leak, patch 2
is the naive fix.

Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Jon Bloomfield <jon.bloomfield at intel.com>

Rafael Barbalho (2):
  drm/i915: Export active PPGTTs in debugfs
  drm/i915: Clean-up PPGTT on context destruction

 drivers/gpu/drm/i915/i915_debugfs.c     | 41 +++++++++++++++++++++----------
 drivers/gpu/drm/i915/i915_gem.c         |  7 +++---
 drivers/gpu/drm/i915/i915_gem_context.c |  2 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c     | 43 ++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_gem_gtt.h     |  7 ++++++
 5 files changed, 82 insertions(+), 18 deletions(-)

-- 
2.3.0



More information about the Intel-gfx mailing list