Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] dma-buf: build failure in xe_sync_entry_add_deps() after unwrap
  macro change
--

commit aec8a67605f7a8aa3f0d24386ca64c094e746176
Author: Christian König <[email protected]>

dma-buf: improve robustness of dma_fence_unwrap_for_each

This commit adds a cleanup function for struct dma_fence_unwrap, embeds
the cursor inside dma_fence_unwrap_for_each() with __cleanup(), and
updates callers to pass two arguments instead of three.

> diff --git a/include/linux/dma-fence-unwrap.h 
> b/include/linux/dma-fence-unwrap.h
> index 7bfacdf79de21..1829e2a655b95 100644
> --- a/include/linux/dma-fence-unwrap.h
> +++ b/include/linux/dma-fence-unwrap.h
> @@ -32,27 +32,33 @@ struct dma_fence_unwrap {
>       unsigned int index;
>  };
>  
> -struct dma_fence *dma_fence_unwrap_first(struct dma_fence *head,
> -                                      struct dma_fence_unwrap *cursor);
> -struct dma_fence *dma_fence_unwrap_next(struct dma_fence_unwrap *cursor);
> +struct dma_fence_unwrap dma_fence_unwrap_first(struct dma_fence *head,
> +                                            struct dma_fence **fence);
> +void dma_fence_unwrap_next(struct dma_fence_unwrap *cursor,
> +                        struct dma_fence **fence);
> +void dma_fence_unwrap_cleanup(struct dma_fence_unwrap *cursor);
> +
> +/* Helper for dma_fence_unwrap_for_each(). Internal use only. */
> +#define __dma_fence_unwrap_for_each(fence, cursor, head)     \
> +     for (struct dma_fence_unwrap cursor                     \
> +          __cleanup(dma_fence_unwrap_cleanup)                \
> +          = dma_fence_unwrap_first(head, &(fence)); fence;   \
> +          dma_fence_unwrap_next(&cursor, &(fence)))
>  
>  /**
>   * 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.
>   */
> -#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 in xe_sync_entry_add_deps() when CONFIG_DRM_XE is enabled?

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) {
                /*
                 * There is no dma_fence_unwrap_stop() helper to drop the
                 * reference the iterator holds, so keep iterating without
                 * doing anything once an error has occurred.
                 */
                if (err || dma_fence_is_signaled(fence))
                        continue;

                err = drm_sched_job_add_dependency(&job->drm,
                                                   dma_fence_get(fence));
        }
    ...
}

xe_sync_entry_add_deps() still passes three arguments to
dma_fence_unwrap_for_each() and retains the manual error-continuation
workaround.

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to