[PATCH 0/2] drm/imagination: Break an object reference loop

Matt Coster Matt.Coster at imgtec.com
Wed Sep 11 15:42:01 UTC 2024


When remaining resources are being cleaned up on driver close,
outstanding VM mappings may result in resources being leaked, due
to an object reference loop, as shown below, with each object (or
set of objects) referencing the object below it:

    PVR GEM Object
    GPU scheduler "finished" fence
    GPU scheduler "scheduled" fence
    PVR driver "done" fence
    PVR Context
    PVR VM Context
    PVR VM Mappings
    PVR GEM Object

The reference that the PVR VM Context has on the VM mappings is a
soft one, in the sense that the freeing of outstanding VM mappings
is done as part of VM context destruction; no reference counts are
involved, as is the case for all the other references in the loop.

To break the reference loop during cleanup, free the outstanding
VM mappings before destroying the PVR Context associated with the
VM context.

This is facilitated by tracking the live contexts associated with each
list, implemented in a separate patch to make the main patch cleaner
and easier to grok.

Brendan King (2):
  drm/imagination: Add a per-file PVR context list
  drm/imagination: Break an object reference loop

 drivers/gpu/drm/imagination/pvr_context.c | 33 +++++++++++++++++++++++
 drivers/gpu/drm/imagination/pvr_context.h | 21 +++++++++++++++
 drivers/gpu/drm/imagination/pvr_device.h  | 10 +++++++
 drivers/gpu/drm/imagination/pvr_drv.c     |  3 +++
 drivers/gpu/drm/imagination/pvr_vm.c      | 22 ++++++++++++---
 drivers/gpu/drm/imagination/pvr_vm.h      |  1 +
 6 files changed, 86 insertions(+), 4 deletions(-)


base-commit: 45c690aea8ee5b7d012cd593bd288540a4bfdbf0
-- 
2.46.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20240911/bfd26848/attachment.sig>


More information about the dri-devel mailing list