<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div style="font-family: "segoe ui westeuropean", "segoe ui", helvetica, arial, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Christian König <christian.koenig@amd.com></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Daniel Gomez <daniel@qtec.com><br>
<b>Gesendet:</b> Donnerstag, 18. März 2021 09:32<br>
<b>Cc:</b> dagmcr@gmail.com <dagmcr@gmail.com>; Daniel Gomez <daniel@qtec.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; amd-gfx@lists.freedesktop.org
<amd-gfx@lists.freedesktop.org>; dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org><br>
<b>Betreff:</b> [PATCH] drm/radeon/ttm: Fix memory leak userptr pages</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">If userptr pages have been pinned but not bounded,<br>
they remain uncleared.<br>
<br>
Signed-off-by: Daniel Gomez <daniel@qtec.com><br>
---<br>
drivers/gpu/drm/radeon/radeon_ttm.c | 5 +++--<br>
1 file changed, 3 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c<br>
index e8c66d10478f..bbcc6264d48f 100644<br>
--- a/drivers/gpu/drm/radeon/radeon_ttm.c<br>
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c<br>
@@ -485,13 +485,14 @@ static void radeon_ttm_backend_unbind(struct ttm_bo_device *bdev, struct ttm_tt<br>
struct radeon_ttm_tt *gtt = (void *)ttm;<br>
struct radeon_device *rdev = radeon_get_rdev(bdev);<br>
<br>
+ if (gtt->userptr)<br>
+ radeon_ttm_tt_unpin_userptr(bdev, ttm);<br>
+<br>
if (!gtt->bound)<br>
return;<br>
<br>
radeon_gart_unbind(rdev, gtt->offset, ttm->num_pages);<br>
<br>
- if (gtt->userptr)<br>
- radeon_ttm_tt_unpin_userptr(bdev, ttm);<br>
gtt->bound = false;<br>
}<br>
<br>
-- <br>
2.30.2<br>
<br>
</div>
</span></font></div>
</body>
</html>