]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/imagination: Break an object reference loop
authorBrendan King <brendan.king@imgtec.com>
Fri, 18 Oct 2024 15:41:40 +0000 (15:41 +0000)
committerMatt Coster <matt.coster@imgtec.com>
Mon, 4 Nov 2024 09:41:38 +0000 (09:41 +0000)
commitb04ce1e718bd55302b52d05d6873e233cb3ec7a1
tree2f5315e7bbc214b6f6f85fe183f065551ef91f77
parentb0ef514bc6bbdeb8cc7492c0f473e14cb06b14d4
drm/imagination: Break an object reference loop

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.

Signed-off-by: Brendan King <brendan.king@imgtec.com>
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Cc: stable@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/8a25924f-1bb7-4d9a-a346-58e871dfb1d1@imgtec.com
drivers/gpu/drm/imagination/pvr_context.c
drivers/gpu/drm/imagination/pvr_context.h
drivers/gpu/drm/imagination/pvr_vm.c
drivers/gpu/drm/imagination/pvr_vm.h