Skip to contentSkip to conversation

drm/ttm: fixup ttm_bo_add_move_fence

PATCH Superseded Matthew Auld 3 participants 5 messages Apr 13, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Matthew Auld

author reviewer
#0 lore raw

PATCH 1/1 drm/ttm: fixup ttm_bo_add_move_fence

It looks like we still need to call dma_fence_put() on the man->move, otherwise we just end up leaking it, leading to fireworks later.

Fixes 8bb31587820a ("drm/ttm: remove bo->moving")
Cc Christian König <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +2 -0
index 015a94f766de..b15b77e10383 100644
@@ -744,6 +744,8 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
 		dma_fence_put(fence);
 		return ret;
 	}
+
+	dma_fence_put(fence);
 	return 0;
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

Am 13.04.22 um 10:21 schrieb Matthew Auld:

Quoted 8 lines

It looks like we still need to call dma_fence_put() on the man->move, otherwise we just end up leaking it, leading to fireworks later.

Ah, yes! Previously we added the fence reference to bo->moving. I was already searching for that one as well.

Going to push it to drm-misc-next in a minute.

Thanks,
Christian.

Quoted 17 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +2 -0
index 015a94f766de..b15b77e10383 100644
@@ -744,6 +744,8 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
  		dma_fence_put(fence);
  		return ret;
  	}
+
+	dma_fence_put(fence);
  	return 0;
  }
 
#2 lore raw
Quoted 10 lines · Christian König

Am 13.04.22 um 10:21 schrieb Matthew Auld:

Quoted 8 lines

It looks like we still need to call dma_fence_put() on the man->move, otherwise we just end up leaking it, leading to fireworks later.

Quoted 6 lines

Ah, yes! Previously we added the fence reference to bo->moving. I was already searching for that one as well.

Going to push it to drm-misc-next in a minute.

If you haven't pushed yet, pls also check my bikeshed, the code looks a bit funny with this patch applied :-)
-Daniel

Quoted 21 lines

Thanks,
Christian.

Quoted 16 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +2 -0
index 015a94f766de..b15b77e10383 100644
@@ -744,6 +744,8 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
  		dma_fence_put(fence);
  		return ret;
  	}
+
+	dma_fence_put(fence);
  	return 0;
  }
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#3 lore raw
In reply to Matthew Auld
Quoted 17 lines · Matthew Auld

It looks like we still need to call dma_fence_put() on the man->move, otherwise we just end up leaking it, leading to fireworks later.

Fixes 8bb31587820a ("drm/ttm: remove bo->moving")
Cc Christian König <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +0 -0
index 015a94f766de..b15b77e10383 100644

drivers/gpu/drm/ttm/ttm_bo.c static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, · line 748

Quoted 5 lines
drivers/gpu/drm/ttm/ttm_bo.c +2 -0
@@ -744,6 +744,8 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
 		dma_fence_put(fence);
 		return ret;
 	}
+
+	dma_fence_put(fence);

Please delete the above if () and simplify the function tail to

	dma_fence_put(fence);
	return ret;

With that Reviewed-by: Daniel Vetter <[email protected]>

And thanks a lot for catching this, I guess I get a prize for most useless review ever :-/ Hopefully this one here is better.
-Daniel

Quoted 6 lines
drivers/gpu/drm/ttm/ttm_bo.c +0 -0
 	return 0;
 }
 
Signature · 1 line
2.34.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#4 lore raw

Am 13.04.22 um 10:44 schrieb Daniel Vetter:

Quoted 25 lines · Matthew Auld
Quoted 17 lines

It looks like we still need to call dma_fence_put() on the man->move, otherwise we just end up leaking it, leading to fireworks later.

---
  drivers/gpu/drm/ttm/ttm_bo.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +0 -0
index 015a94f766de..b15b77e10383 100644

drivers/gpu/drm/ttm/ttm_bo.c static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, · line 748

Quoted 5 lines
drivers/gpu/drm/ttm/ttm_bo.c +2 -0
@@ -744,6 +744,8 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
  		dma_fence_put(fence);
  		return ret;
  	}
+
+	dma_fence_put(fence);

Please delete the above if () and simplify the function tail to

Quoted 7 lines
	dma_fence_put(fence);
	return ret;

With that Reviewed-by: Daniel Vetter <[email protected]>

And thanks a lot for catching this, I guess I get a prize for most useless review ever :-/ Hopefully this one here is better.

Well so far we one inversion of min/max, one missing put and the incorrect handling of the return code in i915.

Considering how complex the patches have been I think we are still pretty good.

Christian.

Quoted 9 lines

-Daniel

Quoted 6 lines
drivers/gpu/drm/ttm/ttm_bo.c +0 -0
  	return 0;
  }
 
Signature · 1 line
2.34.1