Skip to contentSkip to conversation

drm/amdgpu:fix gpu recover missing skipping(v2)

PATCH In review Monk Liu 3 participants 3 messages Nov 8, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/1 drm/amdgpu:fix gpu recover missing skipping(v2)

if app close CTX right after IB submit, gpu recover will fail to find out the entity behind this guilty job thus lead to no job skipping for this guilty job.

to fix this corner case just move the increasement of job->karma out of the entity iteration.

v2:
only do karma increasment if bad->s_priority != KERNEL because we always consider KERNEL job be correct and always want to recover an unfinished kernel job (sometimes kernel job is interrupted by VF FLR or other GPU hang event)

Change-Id I33e9e959e182d7e002a2108e565cb898acac4f9c
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +3 -2
index 7aa6455..c999026 100644
@@ -463,7 +463,8 @@ void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched, struct amd_sched_jo
 	}
 	spin_unlock(&sched->job_list_lock);
 
-	if (bad) {
+	if (bad && bad->s_priority != AMD_SCHED_PRIORITY_KERNEL) {
+		atomic_inc(&bad->karma);
 		/* don't increase @bad's karma if it's from KERNEL RQ,
 		 * becuase sometimes GPU hang would cause kernel jobs (like VM updating jobs)
 		 * corrupt but keep in mind that kernel jobs always considered good.
@@ -474,7 +475,7 @@ void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched, struct amd_sched_jo
 			spin_lock(&rq->lock);
 			list_for_each_entry_safe(entity, tmp, &rq->entities, list) {
 				if (bad->s_fence->scheduled.context == entity->fence_context) {
-				    if (atomic_inc_return(&bad->karma) > bad->sched->hang_limit)
+				    if (atomic_read(&bad->karma) > bad->sched->hang_limit)
 						if (entity->guilty)
 							atomic_set(entity->guilty, 1);
 					break;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1510124882-3227-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Xiangliang Yu
#2 lore raw
Quoted 58 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Wednesday, November 08, 2017 3:08 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH] drm/amdgpu:fix gpu recover missing skipping(v2)

if app close CTX right after IB submit, gpu recover will fail to find out the entity behind this guilty job thus lead to no job skipping for this guilty job.

to fix this corner case just move the increasement of job->karma out of the entity iteration.

v2:
only do karma increasment if bad->s_priority != KERNEL because we always consider KERNEL job be correct and always want to recover an unfinished kernel job (sometimes kernel job is interrupted by VF FLR or other GPU hang event)

Change-Id I33e9e959e182d7e002a2108e565cb898acac4f9c
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +0 -0
index 7aa6455..c999026 100644
@@ -463,7 +463,8 @@ void amd_sched_hw_job_reset(struct

amd_gpu_scheduler *sched, struct amd_sched_jo

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +2 -1
 	}
 	spin_unlock(&sched->job_list_lock);
 
-	if (bad) {
+	if (bad && bad->s_priority != AMD_SCHED_PRIORITY_KERNEL) {
+		atomic_inc(&bad->karma);
 		/* don't increase @bad's karma if it's from KERNEL RQ,
 		 * becuase sometimes GPU hang would cause kernel jobs

(like VM updating jobs)
* corrupt but keep in mind that kernel jobs always
considered good.

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +0 -0
@@ -474,7 +475,7 @@ void amd_sched_hw_job_reset(struct

amd_gpu_scheduler *sched, struct amd_sched_jo

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +0 -0
 			spin_lock(&rq->lock);
 			list_for_each_entry_safe(entity, tmp, &rq->entities,

list) {
if (bad->s_fence->scheduled.context ==
entity->fence_context) {

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +0 -1
-				    if (atomic_inc_return(&bad->karma) > bad-
Quoted 1 line

sched->hang_limit)

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -0
+				    if (atomic_read(&bad->karma) > bad-
Quoted 1 line

sched->hang_limit)

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +0 -0
 						if (entity->guilty)
 							atomic_set(entity-
Quoted 1 line

guilty, 1);

Quoted 8 lines

break;
--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to a message not in the archive

Am 08.11.2017 um 08:08 schrieb Monk Liu:

Quoted 4 lines

if app close CTX right after IB submit, gpu recover will fail to find out the entity behind this guilty job thus lead to no job skipping for this guilty job.

Quoted 8 lines

to fix this corner case just move the increasement of job->karma out of the entity iteration.

v2:
only do karma increasment if bad->s_priority != KERNEL because we always consider KERNEL job be correct and always want to recover an unfinished kernel job (sometimes kernel job is interrupted by VF FLR or other GPU hang event)

Good point, my rb still stands on that version.

Christian.

Quoted 22 lines
Change-Id I33e9e959e182d7e002a2108e565cb898acac4f9c
---
  drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +2 -1
index 7aa6455..c999026 100644
@@ -463,7 +463,8 @@ void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched, struct amd_sched_jo
  	}
  	spin_unlock(&sched->job_list_lock);
 
-	if (bad) {
+	if (bad && bad->s_priority != AMD_SCHED_PRIORITY_KERNEL) {
+		atomic_inc(&bad->karma);
  		/* don't increase @bad's karma if it's from KERNEL RQ,
  		 * becuase sometimes GPU hang would cause kernel jobs (like VM updating jobs)
  		 * corrupt but keep in mind that kernel jobs always considered good.

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched, struct amd_sched_jo · line 481

Quoted 8 lines
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -1
@@ -474,7 +475,7 @@ void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched, struct amd_sched_jo
  			spin_lock(&rq->lock);
  			list_for_each_entry_safe(entity, tmp, &rq->entities, list) {
  				if (bad->s_fence->scheduled.context == entity->fence_context) {
-				    if (atomic_inc_return(&bad->karma) > bad->sched->hang_limit)
+				    if (atomic_read(&bad->karma) > bad->sched->hang_limit)
  						if (entity->guilty)
  							atomic_set(entity->guilty, 1);
  					break;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx