Skip to content

RFC Contain PPGTT memory leak/usage in true PPGTT mode

[email protected] intel-gfx 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2drm/i915: Export active PPGTTs in debugfsdrivers/gpu/drm/i915/i915_debugfs.c+28 -130 replies
2/2drm/i915: Clean-up PPGTT on context destructiondrivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_gem_context.c drivers/gpu/drm/i915/i915_gem_gtt.c +1 more+54 -511 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/2] Contain PPGTT memory leak/usage in true PPGTT mode

From: Rafael Barbalho <[email protected]>

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 <[email protected]>
Cc Jon Bloomfield <[email protected]>

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(-)
Signature · 6 lines
2.3.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx