drm/amdgpu/ttm: Fix memory leak userptr pages
Subsystems (2)
PATCH 1/1 drm/amdgpu/ttm: Fix memory leak userptr pages
If userptr pages have been pinned but not bounded, they remain uncleared.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -3
@@ -1162,13 +1162,13 @@ static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev,struct amdgpu_ttm_tt *gtt = (void *)ttm;int r; -if (!gtt->bound) -return ; -/* if the pages have userptr pinning then clear that first */ if (gtt->userptr)amdgpu_ttm_tt_unpin_userptr (bdev, ttm); +if (!gtt->bound) +return ; +if (gtt->offset ==AMDGPU_BO_INVALID_OFFSET )return ;
Signature · 6 lines
2.30.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 17.03.21 um 17:08 schrieb Daniel Gomez:
Quoted 4 lines
If userptr pages have been pinned but not bounded, they remain uncleared.
Signed-off-by Daniel Gomez <[email protected]>
Good catch, not sure if that can ever happen in practice but better save than sorry.
Quoted 15 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-3@@ -1162,13 +1162,13 @@ static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev,struct amdgpu_ttm_tt *gtt = (void *)ttm;int r; -if (!gtt->bound) -return ; -
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev, · line 1174
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-0/* if the pages have userptr pinning then clear that first */ if (gtt->userptr)amdgpu_ttm_tt_unpin_userptr (bdev, ttm); +if (!gtt->bound) +return ; +if (gtt->offset ==AMDGPU_BO_INVALID_OFFSET )return ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 9 lines · Christian König
Am 17.03.21 um 17:08 schrieb Daniel Gomez:
Quoted 4 lines
If userptr pages have been pinned but not bounded, they remain uncleared.
Signed-off-by Daniel Gomez <[email protected]>Good catch, not sure if that can ever happen in practice but better save than sorry.
Thanks! We actually had a case with clEnqueueWriteBuffer where the driver was leaking.
I can see the problem also affects to the radeon driver so, I'll send a patch for that one as
well.
Quoted 22 lines
Reviewed-by Christian König <[email protected]>Quoted 19 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-3@@ -1162,13 +1162,13 @@ static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev,struct amdgpu_ttm_tt *gtt = (void *)ttm;int r; -if (!gtt->bound) -return ; -/* if the pages have userptr pinning then clear that first */ if (gtt->userptr)amdgpu_ttm_tt_unpin_userptr (bdev, ttm);
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev, · line 1174
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-0+if (!gtt->bound) +return ; +if (gtt->offset ==AMDGPU_BO_INVALID_OFFSET )return ;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 33 lines · Daniel Gomez
If userptr pages have been pinned but not bounded, they remain uncleared.
Signed-off-by Daniel Gomez <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-4@@ -1162,13 +1162,13 @@ static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev,struct amdgpu_ttm_tt *gtt = (void *)ttm;int r; -if (!gtt->bound) -return ; -/* if the pages have userptr pinning then clear that first */ if (gtt->userptr)amdgpu_ttm_tt_unpin_userptr (bdev, ttm); +if (!gtt->bound) +return ; +if (gtt->offset ==AMDGPU_BO_INVALID_OFFSET )return ; --2.30.2
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx