drm/amdgpu: fix fence slab teardown
commit25ed6e4b0b651d84cc88e1347d34d186f45146ec
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 23 Oct 2016 18:31:43 +0000 (23 21:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Nov 2016 09:51:53 +0000 (18 10:51 +0100)
tree0e3ac6205acbccd3b9908d132ef6ed5c99d85984
parentde5e9aa77a3c4a4a340a2e7191912222bfd34ec4
drm/amdgpu: fix fence slab teardown

commit 0f10425e811355986907c54f7d1d06703e406092 upstream.

To free fences, call_rcu() is used, which calls amdgpu_fence_free()
after a grace period. During teardown, there is no guarantee all
callbacks have finished, so amdgpu_fence_slab may be destroyed before
all fences have been freed. If we are lucky, this results in some slab
warnings, if not, we get a crash in one of rcu threads because callback
is called after amdgpu has already been unloaded.

Fix it with a rcu_barrier().

Fixes: b44135351a3a ("drm/amdgpu: RCU protected amdgpu_fence_release")
Acked-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c