1
0
Fork 0
alistair23-linux/drivers/gpu/drm/scheduler
Andrey Grodzovsky 4a4c78cf0c drm/scheduler: Avoid accessing freed bad job.
[ Upstream commit 135517d356 ]

Problem:
Due to a race between drm_sched_cleanup_jobs in sched thread and
drm_sched_job_timedout in timeout work there is a possiblity that
bad job was already freed while still being accessed from the
timeout thread.

Fix:
Instead of just peeking at the bad job in the mirror list
remove it from the list under lock and then put it back later when
we are garanteed no race with main sched thread is possible which
is after the thread is parked.

v2: Lock around processing ring_mirror_list in drm_sched_cleanup_jobs.

v3: Rebase on top of drm-misc-next. v2 is not needed anymore as
drm_sched_get_cleanup_job already has a lock there.

v4: Fix comments to relfect latest code in drm-misc.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Tested-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/342356
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-01 13:17:25 +02:00
..
Makefile drm/scheduler: rename gpu_scheduler.c to sched_main.c 2018-08-27 11:10:44 -05:00
gpu_scheduler_trace.h drm/scheduler: drop use of drmP.h 2019-07-15 18:11:31 +02:00
sched_entity.c drm/scheduler: use job count instead of peek 2019-08-15 10:52:10 -05:00
sched_fence.c drm/scheduler: drop use of drmP.h 2019-07-15 18:11:31 +02:00
sched_main.c drm/scheduler: Avoid accessing freed bad job. 2020-10-01 13:17:25 +02:00