Skip to contentSkip to conversation

drm/amdgpu/job: fix is_guilty logic change (v2)

PATCH In review Alex Deucher 2 participants 4 messages Feb 21, 2025 – Feb 24, 2025

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu/job: fix is_guilty logic change (v2)

Incrementing the gpu_reset counter needs to be in the is_guilty block. Alos move the fence error before the reset to keep the original ordering.

Fixes f447ba2bbd48 ("drm/amdgpu: Update amdgpu_job_timedout to check if the ring is guilty")
Cc Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +4 -2
index efba509e2b5d1..c37bc683253a4 100644
@@ -151,14 +151,16 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
 		else
 			is_guilty = true;
 
+		if (is_guilty)
+			dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
+
 		r = amdgpu_ring_reset(ring, job->vmid);
 		if (!r) {
 			if (amdgpu_ring_sched_ready(ring))
 				drm_sched_stop(&ring->sched, s_job);
-			atomic_inc(&ring->adev->gpu_reset_counter);
 			if (is_guilty) {
+				atomic_inc(&ring->adev->gpu_reset_counter);
 				amdgpu_fence_driver_force_completion(ring);
-				dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
 			}
 			if (amdgpu_ring_sched_ready(ring))
 				drm_sched_start(&ring->sched, 0);
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

The is

-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: Friday, February 21, 2025 11:39 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH] drm/amdgpu/job: fix is_guilty logic change (v2)

Incrementing the gpu_reset counter needs to be in the is_guilty block. Alos move the fence error before the reset to keep the original ordering.

Fixes f447ba2bbd48 ("drm/amdgpu: Update amdgpu_job_timedout to check if the ring is guilty")
Cc Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +4 -2
index efba509e2b5d1..c37bc683253a4 100644
@@ -151,14 +151,16 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
                else
                        is_guilty = true;
 
+               if (is_guilty)
+                       dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
+
                r = amdgpu_ring_reset(ring, job->vmid);
                if (!r) {
                        if (amdgpu_ring_sched_ready(ring))
                                drm_sched_stop(&ring->sched, s_job);
-                       atomic_inc(&ring->adev->gpu_reset_counter);
                        if (is_guilty) {
+                               atomic_inc(&ring->adev->gpu_reset_counter);
                                amdgpu_fence_driver_force_completion(ring);
-                               dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
                        }
                        if (amdgpu_ring_sched_ready(ring))
                                drm_sched_start(&ring->sched, 0);

--
2.48.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Alex Deucher

[AMD Official Use Only - AMD Internal Distribution Only]

The is

-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: Friday, February 21, 2025 11:39 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH] drm/amdgpu/job: fix is_guilty logic change (v2)

Incrementing the gpu_reset counter needs to be in the is_guilty block. Alos move the fence error before the reset to keep the original ordering.

Fixes f447ba2bbd48 ("drm/amdgpu: Update amdgpu_job_timedout to check if the ring is guilty")
Cc Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +4 -2
index efba509e2b5d1..c37bc683253a4 100644
@@ -151,14 +151,16 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
                else
                        is_guilty = true;
 
+               if (is_guilty)
+                       dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
+
                r = amdgpu_ring_reset(ring, job->vmid);
                if (!r) {
                        if (amdgpu_ring_sched_ready(ring))
                                drm_sched_stop(&ring->sched, s_job);
-                       atomic_inc(&ring->adev->gpu_reset_counter);
                        if (is_guilty) {
+                               atomic_inc(&ring->adev->gpu_reset_counter);
                                amdgpu_fence_driver_force_completion(ring);
-                               dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
                        }
                        if (amdgpu_ring_sched_ready(ring))
                                drm_sched_start(&ring->sched, 0);

--
2.48.1

Reviewed-by on v1 1/1
#3 lore raw
In reply to Alex Deucher

[AMD Official Use Only - AMD Internal Distribution Only]

The is

-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: Friday, February 21, 2025 11:39 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH] drm/amdgpu/job: fix is_guilty logic change (v2)

Incrementing the gpu_reset counter needs to be in the is_guilty block. Alos move the fence error before the reset to keep the original ordering.

Fixes f447ba2bbd48 ("drm/amdgpu: Update amdgpu_job_timedout to check if the ring is guilty")
Cc Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +4 -2
index efba509e2b5d1..c37bc683253a4 100644
@@ -151,14 +151,16 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
                else
                        is_guilty = true;
 
+               if (is_guilty)
+                       dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
+
                r = amdgpu_ring_reset(ring, job->vmid);
                if (!r) {
                        if (amdgpu_ring_sched_ready(ring))
                                drm_sched_stop(&ring->sched, s_job);
-                       atomic_inc(&ring->adev->gpu_reset_counter);
                        if (is_guilty) {
+                               atomic_inc(&ring->adev->gpu_reset_counter);
                                amdgpu_fence_driver_force_completion(ring);
-                               dma_fence_set_error(&s_job->s_fence->finished, -ETIME);
                        }
                        if (amdgpu_ring_sched_ready(ring))
                                drm_sched_start(&ring->sched, 0);

--
2.48.1