[3/6] dma-buf: Warn about dma_fence_chain container rules v2
Commit Message
Chaining of dma_fence_chain objects is only allowed through the prev
fence and not through the contained fence.
Warn about that when we create a dma_fence_chain.
v2: fix comment style
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
drivers/dma-buf/dma-fence-chain.c | 9 +++++++++
1 file changed, 9 insertions(+)
Comments
On Fri, 2022-02-04 at 11:04 +0100, Christian König wrote:
> Chaining of dma_fence_chain objects is only allowed through the prev
> fence and not through the contained fence.
>
> Warn about that when we create a dma_fence_chain.
>
> v2: fix comment style
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
It looks like this blows up in generic drm code...
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22201/shard-skl10/igt@syncobj_timeline@transfer-timeline-point.html
/Thomas
Am 09.02.22 um 15:02 schrieb Thomas Hellström:
> On Fri, 2022-02-04 at 11:04 +0100, Christian König wrote:
>> Chaining of dma_fence_chain objects is only allowed through the prev
>> fence and not through the contained fence.
>>
>> Warn about that when we create a dma_fence_chain.
>>
>> v2: fix comment style
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> It looks like this blows up in generic drm code...
>
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22201/shard-skl10/igt@syncobj_timeline@transfer-timeline-point.html
Thanks for the notice. Going to take a look.
I'm wondering why the last CI report I've got didn't showed that.
Christian.
>
> /Thomas
>
>
@@ -254,5 +254,14 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
dma_fence_init(&chain->base, &dma_fence_chain_ops,
&chain->lock, context, seqno);
+
+ /*
+ * Chaining dma_fence_chain container together is only allowed through
+ * the prev fence and not through the contained fence.
+ *
+ * The correct way of handling this is to flatten out the fence
+ * structure into a dma_fence_array by the caller instead.
+ */
+ WARN_ON(dma_fence_is_chain(fence));
}
EXPORT_SYMBOL(dma_fence_chain_init);