[PATCH 4.20 90/92] drm/sched: Always trace the dependencies we wait on, to fix a race.

From: Greg Kroah-Hartman
Date: Mon Feb 18 2019 - 08:49:38 EST


4.20-stable review patch. If anyone has any objections, please let me know.

------------------

From: Eric Anholt <eric@xxxxxxxxxx>

commit 82abf33766712d8446ea137a3400165e31bd12c7 upstream.

The entity->dependency can go away completely once we've called
drm_sched_entity_add_dependency_cb() (if the cb is called before we
get around to tracing). The tracepoint is more useful if we trace
every dependency instead of just ones that get callbacks installed,
anyway, so just do that.

Fixes any easy-to-produce OOPS when tracing the scheduler on V3D with
"perf record -a -e gpu_scheduler:.\* glxgears" and DEBUG_SLAB enabled.

Signed-off-by: Eric Anholt <eric@xxxxxxxxxx>
Reviewed-by: Christian KÃnig <christian.koenig@xxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/gpu/drm/scheduler/sched_entity.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -434,13 +434,10 @@ struct drm_sched_job *drm_sched_entity_p

while ((entity->dependency =
sched->ops->dependency(sched_job, entity))) {
+ trace_drm_sched_job_wait_dep(sched_job, entity->dependency);

- if (drm_sched_entity_add_dependency_cb(entity)) {
-
- trace_drm_sched_job_wait_dep(sched_job,
- entity->dependency);
+ if (drm_sched_entity_add_dependency_cb(entity))
return NULL;
- }
}

/* skip jobs from entity that marked guilty */