diff mbox series

[06/11] dma-buf: warn about containers in dma_resv object

Message ID 20220124130328.2376-7-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show
Series [01/11] drm/radeon: use ttm_resource_manager_debug | expand

Commit Message

Christian König Jan. 24, 2022, 1:03 p.m. UTC
Drivers should not add containers as shared fences to the dma_resv
object, instead each fence should be added individually.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/dma-buf/dma-resv.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Thomas Hellström (Intel) Jan. 24, 2022, 4:36 p.m. UTC | #1
On 1/24/22 14:03, Christian König wrote:
> Drivers should not add containers as shared fences to the dma_resv
> object, instead each fence should be added individually.
>
> 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>

Is there any indication that this triggers on existing drivers?

Thomas
Christian König Jan. 24, 2022, 8:22 p.m. UTC | #2
Am 24.01.22 um 17:36 schrieb Thomas Hellström (Intel):
>
> On 1/24/22 14:03, Christian König wrote:
>> Drivers should not add containers as shared fences to the dma_resv
>> object, instead each fence should be added individually.
>>
>> 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>
>
> Is there any indication that this triggers on existing drivers?

There used to be a case in amdgpu which triggered this, but at least I'm 
not aware of any in the current code.

Christian.

>
> Thomas
>
>
diff mbox series

Patch

diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
index 6dd9a40b55d4..e8a0c1d51da2 100644
--- a/drivers/dma-buf/dma-resv.c
+++ b/drivers/dma-buf/dma-resv.c
@@ -256,6 +256,11 @@  void dma_resv_add_shared_fence(struct dma_resv *obj, struct dma_fence *fence)
 
 	dma_resv_assert_held(obj);
 
+	/* Drivers should not add containers here, instead add each fence
+	 * individually.
+	 */
+	WARN_ON(dma_fence_is_container(fence));
+
 	fobj = dma_resv_shared_list(obj);
 	count = fobj->shared_count;