<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Hi Christian,<br>
</p>
<div class="moz-cite-prefix">On 7/2/2025 1:27 PM, Christian König
wrote:<br>
</div>
<blockquote type="cite" cite="mid:39ff4d7d-d8eb-4c2d-9330-2bb8a5a04964@amd.com">
<pre class="moz-quote-pre" wrap="">
On 01.07.25 21:08, Arunpravin Paneer Selvam wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Set the dirty bit when the memory resource is not cleared
during BO release.
v2(Christian):
- Drop the cleared flag set to false.
- Improve the amdgpu_vram_mgr_set_clear_state() function.
Signed-off-by: Arunpravin Paneer Selvam <a class="moz-txt-link-rfc2396E" href="mailto:Arunpravin.PaneerSelvam@amd.com"><Arunpravin.PaneerSelvam@amd.com></a>
Suggested-by: Christian König <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a>
Cc: <a class="moz-txt-link-abbreviated" href="mailto:stable@vger.kernel.org">stable@vger.kernel.org</a>
Fixes: a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality")
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 -
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 5 ++++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 9c5df35f05b7..86eb6d47dcc5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -409,7 +409,6 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
if (r) {
goto error;
} else if (wipe_fence) {
- amdgpu_vram_mgr_set_cleared(bo->resource);
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Mhm, that looks incorrect to me.
Why don't we consider the resource cleared after it go wiped during eviction?</pre>
</blockquote>
<pre class="moz-quote-pre" style="white-space: pre-wrap;" wrap=""><span style="white-space: normal">Modifying the resource flag here doesn't go into effect until we call the drm_buddy_free_list() in amdgpu_vram_mgr_del().
This BO will be cleared once again after executing amdgpu_bo_release_notify(). With the new implementation, there's a
chance that changing the resource flag the second time would cause the WARN_ON to occur. Hence I removed the
resource cleared function call in amdgpu_move_blit.
Thanks,
Arun.
</span></pre>
<blockquote type="cite" cite="mid:39ff4d7d-d8eb-4c2d-9330-2bb8a5a04964@amd.com">
<pre class="moz-quote-pre" wrap="">
Regards,
Christian.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap=""> dma_fence_put(fence);
fence = wipe_fence;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
index b256cbc2bc27..2c88d5fd87da 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
@@ -66,7 +66,10 @@ to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
static inline void amdgpu_vram_mgr_set_cleared(struct ttm_resource *res)
{
- to_amdgpu_vram_mgr_resource(res)->flags |= DRM_BUDDY_CLEARED;
+ struct amdgpu_vram_mgr_resource *ares = to_amdgpu_vram_mgr_resource(res);
+
+ WARN_ON(ares->flags & DRM_BUDDY_CLEARED);
+ ares->flags |= DRM_BUDDY_CLEARED;
}
#endif
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
</pre>
</blockquote>
</body>
</html>