[Intel-gfx] [PATCH] dma-buf: revert "return only unsignaled fences in dma_fence_unwrap_for_each v3"

Thomas Zimmermann tzimmermann at suse.de
Thu Jul 14 08:40:23 UTC 2022


Hi Christian

Am 12.07.22 um 12:28 schrieb Christian König:
> This reverts commit 8f61973718485f3e89bc4f408f929048b7b47c83.

I only found this commit in drm-misc-next. Should the revert be 
cherry-picked into drm-misc-next-fixes?

Best regards
Thomas

> 
> It turned out that this is not correct. Especially the sync_file info
> IOCTL needs to see even signaled fences to correctly report back their
> status to userspace.
> 
> Instead add the filter in the merge function again where it makes sense.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>   drivers/dma-buf/dma-fence-unwrap.c | 3 ++-
>   include/linux/dma-fence-unwrap.h   | 6 +-----
>   2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/dma-buf/dma-fence-unwrap.c b/drivers/dma-buf/dma-fence-unwrap.c
> index 502a65ea6d44..7002bca792ff 100644
> --- a/drivers/dma-buf/dma-fence-unwrap.c
> +++ b/drivers/dma-buf/dma-fence-unwrap.c
> @@ -72,7 +72,8 @@ struct dma_fence *__dma_fence_unwrap_merge(unsigned int num_fences,
>   	count = 0;
>   	for (i = 0; i < num_fences; ++i) {
>   		dma_fence_unwrap_for_each(tmp, &iter[i], fences[i])
> -			++count;
> +			if (!dma_fence_is_signaled(tmp))
> +				++count;
>   	}
>   
>   	if (count == 0)
> diff --git a/include/linux/dma-fence-unwrap.h b/include/linux/dma-fence-unwrap.h
> index 390de1ee9d35..66b1e56fbb81 100644
> --- a/include/linux/dma-fence-unwrap.h
> +++ b/include/linux/dma-fence-unwrap.h
> @@ -43,14 +43,10 @@ struct dma_fence *dma_fence_unwrap_next(struct dma_fence_unwrap *cursor);
>    * 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.
> - *
> - * Note that signalled fences are opportunistically filtered out, which
> - * means the iteration is potentially over no fence at all.
>    */
>   #define dma_fence_unwrap_for_each(fence, cursor, head)			\
>   	for (fence = dma_fence_unwrap_first(head, cursor); fence;	\
> -	     fence = dma_fence_unwrap_next(cursor))			\
> -		if (!dma_fence_is_signaled(fence))
> +	     fence = dma_fence_unwrap_next(cursor))
>   
>   struct dma_fence *__dma_fence_unwrap_merge(unsigned int num_fences,
>   					   struct dma_fence **fences,

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20220714/e515d88d/attachment.sig>


More information about the Intel-gfx mailing list