From: Arunpravin Paneer Selvam <arunpravin.paneerselvam@amd.com>
To: "Christian König" <christian.koenig@amd.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
matthew.auld@intel.com, matthew.brost@intel.com
Cc: alexander.deucher@amd.com, stable@vger.kernel.org
Subject: Re: [PATCH v2 1/3] drm/amdgpu: Dirty cleared blocks on free
Date: Thu, 3 Jul 2025 12:43:41 +0530 [thread overview]
Message-ID: <1a65c427-e0ae-49fa-b5cb-0a67a6851d72@amd.com> (raw)
In-Reply-To: <dda50b9d-1348-4fce-a513-c20e6223d58f@amd.com>
On 7/2/2025 7:11 PM, Christian König wrote:
> On 02.07.25 13:58, Arunpravin Paneer Selvam wrote:
>> Hi Christian,
>>
>> On 7/2/2025 1:27 PM, Christian König wrote:
>>> On 01.07.25 21:08, Arunpravin Paneer Selvam wrote:
>>>> 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 <Arunpravin.PaneerSelvam@amd.com>
>>>> Suggested-by: Christian König <christian.koenig@amd.com>
>>>> Cc: stable@vger.kernel.org
>>>> 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);
>>> Mhm, that looks incorrect to me.
>>>
>>> Why don't we consider the resource cleared after it go wiped during eviction?
>> 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.
> Something fishy is going on that we don't fully understand.
>
> What happens here is that we move from VRAM to GTT, clear the VRAM BO after the move and set the flag.
>
> When the BO is destroyed the it is backed by GTT and not VRAM any more, so no clear operation and no flag setting is performed.
>
> It looks more like we forget to clear the flag in some cases.
Got it. I tried to add back the resource cleared after being wiped
during eviction and verified it, and I didn't observe WARN_ON messages.
I will update the patch and send the next version.
Thanks,
Arun.
>
> Regards,
> Christian.
>
>>> Regards,
>>> Christian.
>>>
>>>> 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
prev parent reply other threads:[~2025-07-03 7:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 19:08 [PATCH v2 1/3] drm/amdgpu: Dirty cleared blocks on free Arunpravin Paneer Selvam
2025-07-01 19:08 ` [PATCH v2 2/3] drm/amdgpu: Reset the clear flag in buddy during resume Arunpravin Paneer Selvam
2025-07-04 8:52 ` Matthew Auld
2025-07-08 6:10 ` Arunpravin Paneer Selvam
2025-07-02 7:57 ` [PATCH v2 1/3] drm/amdgpu: Dirty cleared blocks on free Christian König
[not found] ` <eebf740c-2a96-434a-a114-2d168f51f774@amd.com>
2025-07-02 13:41 ` Christian König
2025-07-03 7:13 ` Arunpravin Paneer Selvam [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1a65c427-e0ae-49fa-b5cb-0a67a6851d72@amd.com \
--to=arunpravin.paneerselvam@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox