Skip to contentSkip to conversation

drm/vmwgfx: reserve fence slots on new resources

PATCH In review Christian König 3 participants 4 messages Apr 22, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vmwgfx: reserve fence slots on new resources

When resources are allocated dynamically during an IOCTL we need to make sure that a fence slot is reserved so that the resulting fence can be added in the end.

Fixes c8d4c18bfbc4 ("dma-buf/drivers: make reserving a shared slot mandatory v4")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +4 -0
index a7d62a4eb47b..edce228f737c 100644
@@ -399,6 +399,10 @@ static int vmw_resource_do_validate(struct vmw_resource *res,
 		ret = func->create(res);
 		if (unlikely(ret != 0))
 			return ret;
+
+		ret = dma_resv_reserve_fences(res->backup->base.base.resv, 1);
+		if (unlikely(ret))
+			goto out_bind_failed;
 	}
 
 	if (func->bind &&
Signature · 1 line
2.25.1
#1 lore raw

Am 22.04.22 um 11:20 schrieb Christian König:

Quoted 3 lines

When resources are allocated dynamically during an IOCTL we need to make sure that a fence slot is reserved so that the resulting fence can be added in the end.

I should probably add that this is only compile tested.

Zack you should probably give it a try for your issue.

Thanks for the help and sorry for the noise,
Christian.

Quoted 22 lines
Fixes c8d4c18bfbc4 ("dma-buf/drivers: make reserving a shared slot mandatory v4")
---
  drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +4 -0
index a7d62a4eb47b..edce228f737c 100644
@@ -399,6 +399,10 @@ static int vmw_resource_do_validate(struct vmw_resource *res,
  		ret = func->create(res);
  		if (unlikely(ret != 0))
  			return ret;
+
+		ret = dma_resv_reserve_fences(res->backup->base.base.resv, 1);
+		if (unlikely(ret))
+			goto out_bind_failed;
  	}
 
  	if (func->bind &&
#2 lore raw
Quoted 10 lines · Christian König

Am 22.04.22 um 11:20 schrieb Christian König:

Quoted 5 lines

When resources are allocated dynamically during an IOCTL we need to make sure
that a fence slot is reserved so that the resulting fence can be added in the
end.

I should probably add that this is only compile tested.

Zack you should probably give it a try for your issue.

I think we're on the right track but cotables are the only objects that create a bo in the create callback so we endup double reserving all the other backup objects. If you don't mind I'd prefer to move the code to localize the reservation to the problematic spot. I'll send it in a sec (6d0fdf27e98a ("drm/vmwgfx: Reserve fence slots on buffer objects in cotables") let me know if I can add a Co-developed-by: Christian König <[email protected]> tag to it.

z

#3 lore raw

Am 22.04.22 um 18:13 schrieb Zack Rusin:

Quoted 9 lines · Christian König
Quoted 8 lines

Am 22.04.22 um 11:20 schrieb Christian König:

Quoted 5 lines

When resources are allocated dynamically during an IOCTL we need to make sure
that a fence slot is reserved so that the resulting fence can be added in the
end.

I should probably add that this is only compile tested.

Quoted 8 lines
Quoted 1 line

Zack you should probably give it a try for your issue.

I think we're on the right track but cotables are the only objects that create a bo in the create callback so we endup double reserving all the other backup objects. If you don't mind I'd prefer to move the code to localize the reservation to the problematic spot. I'll send it in a sec (6d0fdf27e98a ("drm/vmwgfx: Reserve fence slots on buffer objects in cotables") let me know if I can add a Co-developed-by: Christian König <[email protected]> tag to it.

Sure, please go ahead. You know the code much better than I do anyway.

Thanks,
Christian.

Quoted 2 lines

z