From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: "Christian König" <christian.koenig@amd.com>,
matthew.brost@intel.com, dri-devel@lists.freedesktop.org,
intel-xe@lists.freedesktop.org
Subject: Re: Switching over to GEM refcounts and a bunch of cleanups
Date: Tue, 09 Sep 2025 10:36:34 +0200 [thread overview]
Message-ID: <f5e4507c679e5777964df4e41e9aaf06ea514c7a.camel@linux.intel.com> (raw)
In-Reply-To: <3913518c-af11-49a8-989a-4468493d075b@amd.com>
On Tue, 2025-09-09 at 10:13 +0200, Christian König wrote:
> On 09.09.25 09:21, Thomas Hellström wrote:
> > > > So what do you think about starting out with a fence, and if /
> > > > when
> > > > that appears not to be sufficient, we have a backup plan to
> > > > move to
> > > > a
> > > > struct completion?
> > >
> > > Well we need to start somewhere, so grabbing an unsignaled
> > > dma_fence
> > > reference sounds like the best plan for now.
> >
> > True. A good starting point. Although I have a feeling it will turn
> > out
> > to be not fully sufficient.
>
> Had another sleepiness night because of pain in my joints, but that
> got me another idea how to solve this.
>
> What if the first thread who sees the BO with the zero refcount does
> the zombiefication?
>
> In other words we grab the LRU lock and try to grab a reference to
> the BO, if that works we do our current handling.
>
> If grabbing the BO reference doesn't work we individualize the
> dma_resv and turn the BO into a zombie by adjusting the object funcs,
> init the reference count to 1 again and eventually schedule the
> cleanup worker (e.g. mostly everything currently done in
> ttm_bo_release()).
>
> As far as I can see that should work, only problem might be that we
> need to turn the LRU lock into a mutex to be able to alloc memory and
> sleep.
Yes that would probably work. It mighte become a little complex,
though, and we'd still have to deal with the unorthodox practice of
resurrecting a refcount.
Turning the LRU lock into a mutex is probably OK as well.
Another solution in the other direction is if we allow dma-buf
unmapping under a separate lock without holding the dma-resv, with
associated slight locking complications.
Thanks,
Thomas
>
> Regards,
> Christian.
>
>
prev parent reply other threads:[~2025-09-09 8:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 16:04 Switching over to GEM refcounts and a bunch of cleanups Christian König
2025-07-16 16:04 ` [PATCH 1/7] drm/ttm: replace TTMs refcount with the DRM refcount v3 Christian König
2025-07-16 16:04 ` [PATCH 2/7] drm/ttm: remove ttm_lru_walk_ops Christian König
2025-07-16 16:04 ` [PATCH 3/7] drm/ttm: grab BO reference before locking it Christian König
2025-07-16 16:04 ` [PATCH 4/7] drm/ttm: switch to ttm_bo_lru_for_each_reserved_guarded for swapout Christian König
2025-07-16 16:04 ` [PATCH 5/7] drm/ttm: move zombie handling into ttm_bo_evict Christian König
2025-07-16 16:04 ` [PATCH 6/7] drm/ttm: use ttm_bo_lru_for_each_reserved_guarded in evict_all Christian König
2025-07-16 16:04 ` [PATCH 7/7] drm/xe: remove workaround for TTM internals Christian König
2025-07-22 12:36 ` Switching over to GEM refcounts and a bunch of cleanups Thomas Hellström
2025-08-04 12:24 ` Christian König
2025-08-21 12:30 ` Christian König
2025-08-21 14:06 ` Thomas Hellström
2025-08-21 14:59 ` Christian König
2025-08-22 8:51 ` Thomas Hellström
2025-09-08 15:16 ` Christian König
2025-09-09 7:21 ` Thomas Hellström
2025-09-09 8:13 ` Christian König
2025-09-09 8:36 ` Thomas Hellström [this message]
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=f5e4507c679e5777964df4e41e9aaf06ea514c7a.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.