drm/amdgpu: Fix deadlock during GPU reset.
authorAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Thu, 12 Oct 2017 20:46:26 +0000 (16:46 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Dec 2017 21:33:11 +0000 (16:33 -0500)
commit83f4b1180155f2d65472ce943a1f051215030560
tree6e9a6740c8bb3f720ac65a480e5ec347c278d240
parent27105db6c63a571b91d01e749d026105a1e63bcf
drm/amdgpu: Fix deadlock during GPU reset.

Bug:
Kfifo is limited at size, during GPU reset it would fill up to limit
and the pushing thread (producer) would wait for the scheduler worker to
consume the items in the fifo while holding reservation lock
on a BO. The gpu reset thread on the other hand blocks the scheduler
during reset. Before it unblocks the sceduler it might want
to recover VRAM and so will try to reserve the same BO the producer
thread is already holding creating a deadlock.

Fix:
Switch from kfifo to SPSC queue which is unlimited in size.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/scheduler/gpu_sched_trace.h
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h