drm/amdgpu: Check fence emitted count to identify bad jobs
Subsystems (2)
PATCH v3 1/1 drm/amdgpu: Check fence emitted count to identify bad jobs
In SRIOV, when host driver performs MODE 1 reset and notifies FLR to guest driver, there is a small chance that there is no job running on hw but the driver has not updated the pending list yet, causing the driver not respond the FLR request. Modify the has_job_running function to make sure if there is still running job.
v2: Use amdgpu_fence_count_emitted to determine job running status.
v3: Remove the timeout wait in has_job_running
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -8
@@ -5222,15 +5222,18 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, }/** -* amdgpu_device_has_job_running - check if there is any job in mirror list +* amdgpu_device_has_job_running - check if there is any unfinished job * * @adev: amdgpu_device pointer * -* check if there is any job in mirror list +* check if there is any job running on the device when guest driver receives +* FLR notification from host driver. If there are still jobs running, then +* the guest driver will not respond the FLR reset. Instead, let the job hit +* the timeout and guest driver then issue the reset request. */ bool amdgpu_device_has_job_running (struct amdgpu_device *adev) { -int i; +int i, j;struct drm_sched_job *job;for (i =0 ; i <AMDGPU_MAX_RINGS ; ++i) {
@@ -5239,11 +5242,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev)if (!amdgpu_ring_sched_ready (ring))continue ; -spin_lock (&ring->sched.job_list_lock); - job =list_first_entry_or_null (&ring->sched.pending_list, - struct drm_sched_job, list); -spin_unlock (&ring->sched.job_list_lock); -if (job) +if (amdgpu_fence_count_emitted (ring))return true; }return false;
Signature · 1 line
2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
+@Koenig, Christian<mailto:[email protected]>
Hi Christian,
Could you please help review this patch? I removed the timeout wait in the function.
Thanks,
Shikang
________________________________
From: Shikang Fan <[email protected]>
Sent: Thursday, November 21, 2024 11:48 AM
To: [email protected] <[email protected]>
Cc: Fan, Shikang <[email protected]>; Deng, Emily <[email protected]>
Subject: [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs
In SRIOV, when host driver performs MODE 1 reset and notifies FLR to guest driver, there is a small chance that there is no job running on hw but the driver has not updated the pending list yet, causing the driver not respond the FLR request. Modify the has_job_running function to make sure if there is still running job.
v2: Use amdgpu_fence_count_emitted to determine job running status.
v3: Remove the timeout wait in has_job_running
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -8
@@ -5222,15 +5222,18 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, }/** -* amdgpu_device_has_job_running - check if there is any job in mirror list +* amdgpu_device_has_job_running - check if there is any unfinished job * * @adev: amdgpu_device pointer * -* check if there is any job in mirror list +* check if there is any job running on the device when guest driver receives +* FLR notification from host driver. If there are still jobs running, then +* the guest driver will not respond the FLR reset. Instead, let the job hit +* the timeout and guest driver then issue the reset request. */ bool amdgpu_device_has_job_running (struct amdgpu_device *adev) { -int i; +int i, j;struct drm_sched_job *job;for (i =0 ; i <AMDGPU_MAX_RINGS ; ++i) {
@@ -5239,11 +5242,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev)if (!amdgpu_ring_sched_ready (ring))continue ; -spin_lock (&ring->sched.job_list_lock); - job =list_first_entry_or_null (&ring->sched.pending_list, - struct drm_sched_job, list); -spin_unlock (&ring->sched.job_list_lock); -if (job) +if (amdgpu_fence_count_emitted (ring))return true; }return false;
--
2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
I forgot to delete the unused counter "j" from the patch, I'll remove it when submit the patch to the branch.
Thanks,
Shikang
________________________________
From: Fan, Shikang <[email protected]>
Sent: Thursday, November 21, 2024 2:47 PM
To: [email protected] <[email protected]>; Koenig, Christian <[email protected]>
Cc: Deng, Emily <[email protected]>
Subject: Re: [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs
+@Koenig, Christian<mailto:[email protected]>
Hi Christian,
Could you please help review this patch? I removed the timeout wait in the function.
Thanks,
Shikang
________________________________
From: Shikang Fan <[email protected]>
Sent: Thursday, November 21, 2024 11:48 AM
To: [email protected] <[email protected]>
Cc: Fan, Shikang <[email protected]>; Deng, Emily <[email protected]>
Subject: [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs
In SRIOV, when host driver performs MODE 1 reset and notifies FLR to guest driver, there is a small chance that there is no job running on hw but the driver has not updated the pending list yet, causing the driver not respond the FLR request. Modify the has_job_running function to make sure if there is still running job.
v2: Use amdgpu_fence_count_emitted to determine job running status.
v3: Remove the timeout wait in has_job_running
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -8
@@ -5222,15 +5222,18 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, }/** -* amdgpu_device_has_job_running - check if there is any job in mirror list +* amdgpu_device_has_job_running - check if there is any unfinished job * * @adev: amdgpu_device pointer * -* check if there is any job in mirror list +* check if there is any job running on the device when guest driver receives +* FLR notification from host driver. If there are still jobs running, then +* the guest driver will not respond the FLR reset. Instead, let the job hit +* the timeout and guest driver then issue the reset request. */ bool amdgpu_device_has_job_running (struct amdgpu_device *adev) { -int i; +int i, j;struct drm_sched_job *job;for (i =0 ; i <AMDGPU_MAX_RINGS ; ++i) {
@@ -5239,11 +5242,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev)if (!amdgpu_ring_sched_ready (ring))continue ; -spin_lock (&ring->sched.job_list_lock); - job =list_first_entry_or_null (&ring->sched.pending_list, - struct drm_sched_job, list); -spin_unlock (&ring->sched.job_list_lock); -if (job) +if (amdgpu_fence_count_emitted (ring))return true; }return false;
--
2.34.1
Christian König
maintainerYeah, just wanted to point out the unused variable as well.
With that fixed the patch is Reviewed-by: Christian König <[email protected]>
Regards,
Christian.
Am 21.11.24 um 07:49 schrieb Fan, Shikang:
Quoted 93 lines
[AMD Official Use Only - AMD Internal Distribution Only]
I forgot to delete the unused counter "j" from the patch, I'll remove it when submit the patch to the branch.
Thanks,
Shikang------------------------------------------------------------------------
*From:* Fan, Shikang <[email protected]>
*Sent:* Thursday, November 21, 2024 2:47 PM
*To:* [email protected] <[email protected]>; Koenig, Christian <[email protected]> *Cc:* Deng, Emily <[email protected]>
*Subject:* Re: [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs
+@Koenig, Christian <mailto:[email protected]>Hi Christian,
Could you please help review this patch? I removed the timeout wait in the function.Thanks,
Shikang------------------------------------------------------------------------
*From:* Shikang Fan <[email protected]>
*Sent:* Thursday, November 21, 2024 11:48 AM
*To:* [email protected] <[email protected]> *Cc:* Fan, Shikang <[email protected]>; Deng, Emily <[email protected]> *Subject:* [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs In SRIOV, when host driver performs MODE 1 reset and notifies FLR to guest driver, there is a small chance that there is no job running on hw but the driver has not updated the pending list yet, causing the driver not respond the FLR request. Modify thehas_job_runningfunction to make sure if there is still running job.v2: Use
amdgpu_fence_count_emittedto determine job running status.
v3: Remove the timeout wait inhas_job_runningSigned-off-by Emily Deng <[email protected]>Signed-off-by Shikang Fan <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++--------1 file changed, 7 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -5222,15 +5222,18 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, } /** -* amdgpu_device_has_job_running - check if there is any job in mirror list
+ *amdgpu_device_has_job_running- check if there is any unfinished job *
* @adev:amdgpu_devicepointer
*
- * check if there is any job in mirror list
+ * check if there is any job running on the device when guest driver receives
+ * FLR notification from host driver. If there are still jobs running, then
+ * the guest driver will not respond the FLR reset. Instead, let the job hit
+ * the timeout and guest driver then issue the reset request. */
boolamdgpu_device_has_job_running(struct amdgpu_device *adev){
- int i;
+ int i, j;
structdrm_sched_job*job;for (i = 0; i <
AMDGPU_MAX_RINGS; ++i) {drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-5@@ -5239,11 +5242,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev) if (!amdgpu_ring_sched_ready(ring)) continue; -spin_lock (&ring->sched.job_list_lock); - job = list_first_entry_or_null(&ring->sched.pending_list, - struct drm_sched_job, list); -spin_unlock (&ring->sched.job_list_lock); - if (job) + if (amdgpu_fence_count_emitted(ring)) return true;}
return false;
--
2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
Ok, thank you!
Regards,
Shikang.
________________________________
From: Koenig, Christian <[email protected]>
Sent: Thursday, November 21, 2024 4:12 PM
To: Fan, Shikang <[email protected]>; [email protected] <[email protected]>
Cc: Deng, Emily <[email protected]>
Subject: Re: [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs
Yeah, just wanted to point out the unused variable as well.
With that fixed the patch is Reviewed-by: Christian König <[email protected]><mailto:[email protected]>
Regards,
Christian.
Am 21.11.24 um 07:49 schrieb Fan, Shikang:
[AMD Official Use Only - AMD Internal Distribution Only]
I forgot to delete the unused counter "j" from the patch, I'll remove it when submit the patch to the branch.
Thanks,
Shikang
________________________________
From: Fan, Shikang <[email protected]><mailto:[email protected]>
Sent: Thursday, November 21, 2024 2:47 PM
To: [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>; Koenig, Christian <[email protected]><mailto:[email protected]>
Cc: Deng, Emily <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs
+@Koenig, Christian<mailto:[email protected]>
Hi Christian,
Could you please help review this patch? I removed the timeout wait in the function.
Thanks,
Shikang
________________________________
From: Shikang Fan <[email protected]><mailto:[email protected]>
Sent: Thursday, November 21, 2024 11:48 AM
To: [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Cc: Fan, Shikang <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs
In SRIOV, when host driver performs MODE 1 reset and notifies FLR to guest driver, there is a small chance that there is no job running on hw but the driver has not updated the pending list yet, causing the driver not respond the FLR request. Modify the has_job_running function to make sure if there is still running job.
v2: Use amdgpu_fence_count_emitted to determine job running status.
v3: Remove the timeout wait in has_job_running
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -8
@@ -5222,15 +5222,18 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, }/** -* amdgpu_device_has_job_running - check if there is any job in mirror list +* amdgpu_device_has_job_running - check if there is any unfinished job * * @adev: amdgpu_device pointer * -* check if there is any job in mirror list +* check if there is any job running on the device when guest driver receives +* FLR notification from host driver. If there are still jobs running, then +* the guest driver will not respond the FLR reset. Instead, let the job hit +* the timeout and guest driver then issue the reset request. */ bool amdgpu_device_has_job_running (struct amdgpu_device *adev) { -int i; +int i, j;struct drm_sched_job *job;for (i =0 ; i <AMDGPU_MAX_RINGS ; ++i) {
@@ -5239,11 +5242,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev)if (!amdgpu_ring_sched_ready (ring))continue ; -spin_lock (&ring->sched.job_list_lock); - job =list_first_entry_or_null (&ring->sched.pending_list, - struct drm_sched_job, list); -spin_unlock (&ring->sched.job_list_lock); -if (job) +if (amdgpu_fence_count_emitted (ring))return true; }return false;
--
2.34.1