Message ID | 20230725074611.3309115-1-cyndis@kapsi.fi (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | dma_buf/sync_file: Enable signaling for fences when querying status | expand |
On 7/25/23 10:46, Mikko Perttunen wrote: > From: Mikko Perttunen <mperttunen@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@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
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 {