Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH] dma-buf: improve robustness of dma_fence_unwrap_for_each v2
Date: Wed, 02 Dec 2026 14:42:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-245984@kernel.org> (raw)
In-Reply-To: <20261202143509.6903-1-christian.koenig@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/xe: build failure in xe_sync_entry_add_deps() from
  unupdated unwrap macro
--

commit 146e2d47d9ca285371ff56e4898f49f8978c4427
Author: Christian König <ckoenig.leichtzumerken@gmail.com>

dma-buf: improve robustness of dma_fence_unwrap_for_each v2

This commit reworks dma_fence_unwrap_for_each() to manage its cursor
internally with a __cleanup(dma_fence_unwrap_cleanup) attribute and
updates callers to drop the explicit cursor argument.

> diff --git a/include/linux/dma-fence-unwrap.h b/include/linux/dma-fence-unwrap.h
> index 7bfacdf79de21..31f9fdeddf286 100644
> --- a/include/linux/dma-fence-unwrap.h
> +++ b/include/linux/dma-fence-unwrap.h
[ ... ]
> @@ -32,27 +31,49 @@ struct dma_fence_unwrap {
[ ... ]
>  /**
>   * dma_fence_unwrap_for_each - iterate over all fences in containers
>   * @fence: current fence
> - * @cursor: current position inside the containers
>   * @head: starting point for the iterator
>   *
>   * Unwrap dma_fence_chain and dma_fence_array containers and deep dive into all
>   * potential fences in them. If @head is just a normal fence only that one is
>   * returned.
> + *
> + * Keeps a reference to the current chain node to ensure that the data structure
> + * can't be freed while iterating over the fences in it. This reference is
> + * automatically dropped when breaking out of the loop which will eventually
> + * free up the current fence element.
>   */
> -#define dma_fence_unwrap_for_each(fence, cursor, head)			\
> -	for (fence = dma_fence_unwrap_first(head, cursor); fence;	\
> -	     fence = dma_fence_unwrap_next(cursor))
> +#define dma_fence_unwrap_for_each(fence, head) \
> +	__dma_fence_unwrap_for_each(fence, __UNIQUE_ID(cursor), head)

[Severity: High]
Does changing dma_fence_unwrap_for_each() to take two arguments break
the build when CONFIG_DRM_XE is enabled?

Although the commit message notes that a conflict with drm-xe-next will
be resolved later, this tree already includes 3b8860fe2581 ("drm/xe:
Unwrap sync fences before adding them as job dependencies"), which still
passes three arguments:

drivers/gpu/drm/xe/xe_sync.c:xe_sync_entry_add_deps() {
	struct dma_fence_unwrap iter;
    ...
	dma_fence_unwrap_for_each(fence, &iter, sync->fence) {
    ...
}

Compiling drivers/gpu/drm/xe/xe_sync.c fails with a preprocessor error.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202143509.6903-1-christian.koenig@amd.com?part=1

  reply	other threads:[~2026-12-02 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 14:35 [PATCH] dma-buf: improve robustness of dma_fence_unwrap_for_each v2 Christian König
2026-12-02 14:42 ` sashiko-bot [this message]
2026-12-02 15:35 ` Tvrtko Ursulin

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-245984@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=virtualization@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