[PATCH 2/2] dma-buf: Fix dma_resv_test_signaled.

Christian König christian.koenig at amd.com
Fri Oct 15 12:07:32 UTC 2021


Am 15.10.21 um 13:57 schrieb Maarten Lankhorst:
> Commit 7fa828cb9265 ("dma-buf: use new iterator in dma_resv_test_signaled")
> accidentally forgot to test whether the dma-buf is actually signaled, breaking
> pretty much everything depending on it.

NAK, the dma_resv_for_each_fence_unlocked() returns only unsignaled 
fences. So the code is correct as it is.

Regards,
Christian.

>
> Fixes: 7fa828cb9265 ("dma-buf: use new iterator in dma_resv_test_signaled")
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> ---
>   drivers/dma-buf/dma-resv.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
> index 70a8082660c5..37ab2875e469 100644
> --- a/drivers/dma-buf/dma-resv.c
> +++ b/drivers/dma-buf/dma-resv.c
> @@ -655,14 +655,16 @@ bool dma_resv_test_signaled(struct dma_resv *obj, bool test_all)
>   {
>   	struct dma_resv_iter cursor;
>   	struct dma_fence *fence;
> +	bool ret = true;
>   
>   	dma_resv_iter_begin(&cursor, obj, test_all);
>   	dma_resv_for_each_fence_unlocked(&cursor, fence) {
> -		dma_resv_iter_end(&cursor);
> -		return false;
> +		ret = dma_fence_is_signaled(fence);
> +		if (!ret)
> +			break;
>   	}
>   	dma_resv_iter_end(&cursor);
> -	return true;
> +	return ret;
>   }
>   EXPORT_SYMBOL_GPL(dma_resv_test_signaled);
>   



More information about the dri-devel mailing list