mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Coster <Matt.Coster@imgtec.com>
To: "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>
Cc: Brendan King <Brendan.King@imgtec.com>,
	Frank Binns <Frank.Binns@imgtec.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH v3 0/2] drm/imagination: Break an obejct reference loop
Date: Fri, 18 Oct 2024 15:41:22 +0000	[thread overview]
Message-ID: <d35a7455-1ed7-44c2-94fe-3d211a8a5e94@imgtec.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2082 bytes --]

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.

---

Changes in v1 -> v2:
 - [PATCH 1/2] Add justification to the commit message so it stands on
   its own (e.g. during bisect)

Changes in v2 -> v3:
 - [ALL] Add Frank's Rb [1][2]
 - [ALL] Add Cc: stable tag

[1]: https://lore.kernel.org/dri-devel/1a206b08485a1ebea0aeff5306c0f5b6eb7c315d.camel@imgtec.com/
[2]: https://lore.kernel.org/dri-devel/b75e658cc5ce9ac24df2c31c1a6fd798a5f3a87f.camel@imgtec.com/

---

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: 83f000784844cb9d4669ef1a3366479db3197b33
-- 
2.47.0



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

             reply	other threads:[~2024-10-18 15:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 15:41 Matt Coster [this message]
2024-10-18 15:41 ` [PATCH v3 1/2] drm/imagination: Add a per-file PVR context list Matt Coster
2024-10-18 15:41 ` [PATCH v3 2/2] drm/imagination: Break an object reference loop Matt Coster

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=d35a7455-1ed7-44c2-94fe-3d211a8a5e94@imgtec.com \
    --to=matt.coster@imgtec.com \
    --cc=Brendan.King@imgtec.com \
    --cc=Frank.Binns@imgtec.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®