Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Philipp Stanner" <phasta@kernel.org>
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, media-ci@linuxtv.org
Subject: Re: [RFC PATCH 6/8] dma-buf: sync_debug: don't use TIMESTAMP bit
Date: Fri, 27 Nov 2026 10:26:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-237126@kernel.org> (raw)
In-Reply-To: <20261127101812.2706432-8-phasta@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] dma-buf: sync_debug: recursive spinlock deadlock in
  sync_print_fence()
--

commit 771cc9b6d800a1a39680e74552adf1782c101ea3
Author: Philipp Stanner <phasta@kernel.org>

dma-buf: sync_debug: don't use TIMESTAMP bit

This commit replaces the direct DMA_FENCE_FLAG_TIMESTAMP_BIT check in
sync_print_fence() with a call to dma_fence_timestamp().

> diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
> index 9e5d662cd4e84..58c0d00ba5b3c 100644
> --- a/drivers/dma-buf/sync_debug.c
> +++ b/drivers/dma-buf/sync_debug.c
> @@ -46,6 +46,8 @@ static void sync_print_fence(struct seq_file *s,
>  			     struct dma_fence *fence, bool show)
>  {
>  	struct sync_timeline *parent = dma_fence_parent(fence);
> +	struct timespec64 ts64;
> +	ktime_t ts;
>  	int status;
>  
>  	status = dma_fence_get_status_locked(fence);
> @@ -55,10 +57,8 @@ static void sync_print_fence(struct seq_file *s,
>  		   show ? "_" : "",
>  		   sync_status_str(status));
>  
> -	if (test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags)) {
> -		struct timespec64 ts64 =
> -			ktime_to_timespec64(fence->timestamp);
> -
> +	if (dma_fence_timestamp(fence, &ts) == 0) {
> +		ts64 = ktime_to_timespec64(ts);
>  		seq_printf(s, "@%ptSp", &ts64);
>  	}

[Severity: High]
Does calling dma_fence_timestamp() here self-deadlock on obj->lock?

sync_pt_create() initializes each sync_pt fence with &obj->lock as its
external fence spinlock, and sync_print_obj() already holds obj->lock when it
calls sync_print_fence() (which is why dma_fence_get_status_locked() is used
above):

sync_info_debugfs_show()
  spin_lock_irq(&sync_timeline_list_lock)
  sync_print_obj()
    spin_lock(&obj->lock)
    sync_print_fence()
      dma_fence_timestamp()
        dma_fence_lock_irqsave()  <-- spins forever on &obj->lock

Reading /sys/kernel/debug/sync/info while any sync_timeline has a sync_pt on
obj->pt_list will deadlock the CPU with interrupts disabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127101812.2706432-2-phasta@kernel.org?part=6

  reply	other threads:[~2026-11-27 10:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 10:18 [RFC PATCH 0/8] dma-fence: Remove TIMESTAMP bit Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 1/8] dma-buf: dma-fence: Hot-fix timestamp misordering Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 2/8] drm/sched: " Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 3/8] dma-buf: dma-fence: Ensure ordering with locks for timestamps Philipp Stanner
2026-11-27 10:48   ` sashiko-bot
2026-11-27 10:18 ` [RFC PATCH 4/8] dma-buf: dma-fence: Improve dma_fence_timestamp() Philipp Stanner
2026-11-27 10:42   ` sashiko-bot
2026-11-27 10:18 ` [RFC PATCH 5/8] drm/amdgpu: Stop using dma_fence internals Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 6/8] dma-buf: sync_debug: don't use TIMESTAMP bit Philipp Stanner
2026-11-27 10:26   ` sashiko-bot [this message]
2026-11-27 10:18 ` [RFC PATCH 7/8] drm/i915: Remove " Philipp Stanner
2026-11-27 10:35   ` sashiko-bot
2026-11-27 10:18 ` [RFC PATCH 8/8] dma-buf: dma-fence: " Philipp Stanner
2026-11-27 10:36   ` 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=sashiko-outbox-237126@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=media-ci@linuxtv.org \
    --cc=phasta@kernel.org \
    --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