Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.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, 9 Sep 2025 10:13:09 +0200	[thread overview]
Message-ID: <3913518c-af11-49a8-989a-4468493d075b@amd.com> (raw)
In-Reply-To: <108ed59e07faaaa78167045670cea803d58f7127.camel@linux.intel.com>

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.

Regards,
Christian.



  reply	other threads:[~2025-09-09  8:13 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 [this message]
2025-09-09  8:36                   ` Thomas Hellström

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=3913518c-af11-49a8-989a-4468493d075b@amd.com \
    --to=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=thomas.hellstrom@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox