Skip to contentSkip to conversation

drm/amdgpu: Fix missing drain retry fault the last entry

PATCH Superseded Emily Deng 2 participants 4 messages Mar 3, 2025 – Mar 5, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Fix missing drain retry fault the last entry

For equal case, it also need to be dropped.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +1 -1
index 7d4395a5d8ac..73b8bcb54734 100644
@@ -76,7 +76,7 @@ struct amdgpu_ih_ring {
 
 /* return true if time stamp t2 is after t1 with 48bit wrap around */
 #define amdgpu_ih_ts_after(t1, t2) \
-		(((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) > 0LL)
+		(((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) >= 0LL)
 
 /* provided by the ih block */
 struct amdgpu_ih_funcs {
Signature · 1 line
2.34.1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Ping......

Emily Deng
Best Wishes

Quoted 30 lines

-----Original Message-----
From: Emily Deng <[email protected]>
Sent: Monday, March 3, 2025 5:35 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix missing drain retry fault the last entry

For equal case, it also need to be dropped.

---
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +1 -2
index 7d4395a5d8ac..73b8bcb54734 100644
@@ -76,7 +76,7 @@ struct amdgpu_ih_ring {
 
 /* return true if time stamp t2 is after t1 with 48bit wrap around */  #define
 amdgpu_ih_ts_after(t1, t2) \
-              (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) > 0LL)
+              (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) >= 0LL)
 
 /* provided by the ih block */
 struct amdgpu_ih_funcs {
--

2.34.1

#2 lore raw
Quoted 32 lines · Emily

[AMD Official Use Only - AMD Internal Distribution Only]

[AMD Official Use Only - AMD Internal Distribution Only]

Ping......

Emily Deng
Best Wishes

Quoted 21 lines

-----Original Message-----
From: Emily Deng <[email protected]>
Sent: Monday, March 3, 2025 5:35 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix missing drain retry fault the last entry

For equal case, it also need to be dropped.

---
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +0 -0
index 7d4395a5d8ac..73b8bcb54734 100644
@@ -76,7 +76,7 @@ struct amdgpu_ih_ring {
 
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h struct amdgpu_ih_ring { · line 79

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +1 -1
 /* return true if time stamp t2 is after t1 with 48bit wrap around */  #define
 amdgpu_ih_ts_after(t1, t2) \
-              (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) > 0LL)
+              (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) >= 0LL)

The comment is correct and current condition is correct too, svm_range_drain_retry_fault drop the retry fault with same timestamp as the IH checkpoint_wptr timestamp. Do you see GPU page fault with the stale retry fault after process exit, or what issue do you want to fix?

Regards,

Philip

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +0 -1
 /* provided by the ih block */
 struct amdgpu_ih_funcs {
--

2.34.1

#3 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 52 lines

-----Original Message-----
From: Yang, Philip <[email protected]>
Sent: Tuesday, March 4, 2025 11:00 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Fix missing drain retry fault the last entry

Quoted 33 lines · Emily

[AMD Official Use Only - AMD Internal Distribution Only]

[AMD Official Use Only - AMD Internal Distribution Only]

Ping......

Emily Deng
Best Wishes

Quoted 22 lines

-----Original Message-----
From: Emily Deng <[email protected]>
Sent: Monday, March 3, 2025 5:35 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix missing drain retry fault the last entry

For equal case, it also need to be dropped.

---
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +0 -0
index 7d4395a5d8ac..73b8bcb54734 100644
@@ -76,7 +76,7 @@ struct amdgpu_ih_ring {
 
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h struct amdgpu_ih_ring {

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +2 -1
 /* return true if time stamp t2 is after t1 with 48bit wrap around */
 #define amdgpu_ih_ts_after(t1, t2) \
-              (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) > 0LL)
+              (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) >=
+ 0LL)

The comment is correct and current condition is correct too, svm_range_drain_retry_fault drop the retry fault with same timestamp as the IH checkpoint_wptr timestamp. Do you see GPU page fault with the stale retry fault after process exit, or what issue do you want to fix?

Quoted 3 lines

Regards,

Philip

This commit aims to address the page fault issue observed when running kfdtest with the following command:

sudo bash -c "export GTEST_REPEAT=1000; export GTEST_BREAK_ON_FAILURE=1; ./kfdtest --gtest_filter=KFDSVMRangeTest.*:-KFDSVMRangeTest.ReadOnlyRangeTest* --timeout 100000" 2>/dev/null

The issue is severe because the page fault triggers a call to kfd_set_dbg_ev_from_interrupt, which subsequently invokes kfd_dqm_evict_pasid. As a result, the process is evicted, leading to test failures. This commit resolves the root cause of the page fault to prevent such evictions.

Emily Deng
Best Wishes

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +0 -1
 /* provided by the ih block */
 struct amdgpu_ih_funcs {
--

2.34.1