From: sashiko-bot@kernel.org
To: "Natalie Vock" <nat@pixelcluster.dev>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 08/10] drm/xe: remove workaround for TTM internals
Date: Mon, 06 Jul 2026 10:32:20 +0000 [thread overview]
Message-ID: <20260706103220.DE3301F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260706-ttm_2_drm_exec-v2-8-4bf6bfc0d320@pixelcluster.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] Locking mismatch and missing error handling in `xe_ttm_bo_release_notify` lead to deadlocks, state corruption, and kernel panics for imported dma-buf objects.
--
commit 654aea229ee4882cf8f04774d507ece22e8921fd
Author: Natalie Vock <nat@pixelcluster.dev>
drm/xe: remove workaround for TTM internals
This commit removes the xe_ttm_bo_lock_in_destructor() workaround and replaces
it with a WARN_ON() check in xe_ttm_bo_release_notify().
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index 5843f850339c7..34eae56716076 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
[ ... ]
> @@ -1680,8 +1655,11 @@ static void xe_ttm_bo_release_notify(struct ttm_buffer_object *ttm_bo)
> bo = ttm_to_xe_bo(ttm_bo);
> xe_assert(xe_bo_device(bo), !(bo->created && kref_read(&ttm_bo->base.refcount)));
>
> - if (!xe_ttm_bo_lock_in_destructor(ttm_bo))
> - return;
> + /*
> + * This should never fail since there are no other references to the BO
> + * any more.
> + */
> + WARN_ON(!dma_resv_trylock(ttm_bo->base.resv));
[Severity: Critical]
Since WARN_ON() does not return on failure, if the trylock fails, won't
execution fall through and modify fences without holding the lock?
Also, there appears to be a mismatch in the resv pointer being locked and
unlocked. We are locking ttm_bo->base.resv here, but later in this same
function it acts on ttm_bo->base._resv:
dma_resv_for_each_fence(&cursor, &ttm_bo->base._resv,
DMA_RESV_USAGE_BOOKKEEP, fence) {
...
}
dma_resv_unlock(&ttm_bo->base._resv);
For imported dma-buf objects, base.resv might not equal &base._resv. Could
this lock the exporter's shared resv but attempt to unlock the local embedded
_resv? This might cause a deadlock on the shared resv and an attempt to
unlock an unheld mutex.
>
> /*
> * Scrub the preempt fences if any. The unbind fence is already
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706-ttm_2_drm_exec-v2-0-4bf6bfc0d320@pixelcluster.dev?part=8
next prev parent reply other threads:[~2026-07-06 10:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 10:07 [PATCH v2 00/10] Use drm_exec to lock TTM buffers, respin Natalie Vock
2026-07-06 10:07 ` [PATCH v2 01/10] drm/exec: Add helper to bypass IGNORE_DUPLICATES flag Natalie Vock
2026-07-06 11:40 ` Christian König
2026-07-06 10:07 ` [PATCH v2 02/10] drm/ttm: replace TTMs refcount with the DRM refcount v4 Natalie Vock
2026-07-06 10:42 ` sashiko-bot
2026-07-06 11:47 ` Christian König
2026-07-06 10:07 ` [PATCH v2 03/10] drm/ttm: remove ttm_lru_walk_ops Natalie Vock
2026-07-06 10:07 ` [PATCH v2 04/10] drm/ttm: grab BO reference before locking it Natalie Vock
2026-07-06 10:07 ` [PATCH v2 05/10] drm/ttm: switch to ttm_bo_lru_for_each_reserved_guarded for swapout Natalie Vock
2026-07-06 10:32 ` sashiko-bot
2026-07-06 10:07 ` [PATCH v2 06/10] drm/ttm: move zombie handling into ttm_bo_evict Natalie Vock
2026-07-06 10:07 ` [PATCH v2 07/10] drm/ttm: use ttm_bo_lru_for_each_reserved_guarded in evict_all Natalie Vock
2026-07-06 10:34 ` sashiko-bot
2026-07-06 10:07 ` [PATCH v2 08/10] drm/xe: remove workaround for TTM internals Natalie Vock
2026-07-06 10:32 ` sashiko-bot [this message]
2026-07-06 10:07 ` [PATCH v2 09/10] drm/ttm: support using drm_exec during eviction v4 Natalie Vock
2026-07-06 10:36 ` sashiko-bot
2026-07-06 10:07 ` [PATCH v2 10/10] drm/amdgpu: use drm_exec during BO validation Natalie Vock
2026-07-06 10:41 ` sashiko-bot
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=20260706103220.DE3301F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=nat@pixelcluster.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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