[PATCH] dma_buf/sync_file: Enable signaling for fences when querying status
Mikko Perttunen
cyndis at kapsi.fi
Fri Sep 1 09:37:51 UTC 2023
On 7/25/23 10:46, Mikko Perttunen wrote:
> From: Mikko Perttunen <mperttunen at nvidia.com>
>
> dma_fence_get_status is not guaranteed to return valid information
> on if the fence has been signaled or not if SW signaling has not
> been enabled for the fence. To ensure valid information is reported,
> enable SW signaling for fences before getting their status.
>
> Signed-off-by: Mikko Perttunen <mperttunen at nvidia.com>
> ---
> drivers/dma-buf/sync_file.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
> index af57799c86ce..57f194b8477f 100644
> --- a/drivers/dma-buf/sync_file.c
> +++ b/drivers/dma-buf/sync_file.c
> @@ -267,6 +267,7 @@ static int sync_fill_fence_info(struct dma_fence *fence,
> strscpy(info->driver_name, fence->ops->get_driver_name(fence),
> sizeof(info->driver_name));
>
> + dma_fence_enable_sw_signaling(fence);
> info->status = dma_fence_get_status(fence);
> while (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) &&
> !test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags))
> @@ -307,6 +308,7 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
> * info->num_fences.
> */
> if (!info.num_fences) {
> + dma_fence_enable_sw_signaling(sync_file->fence);
> info.status = dma_fence_get_status(sync_file->fence);
> goto no_fences;
> } else {
Any thoughts?
Mikko
More information about the dri-devel
mailing list