drm/amdgpu: hold reference to fences in amdgpu_sa_bo_new (v2)
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 5 Feb 2016 15:59:43 +0000 (10:59 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Mar 2016 23:07:19 +0000 (15:07 -0800)
commit7a42e7cd29f4c9d59fab1a8e306e21d77f57a0a5
treecc2ffab2845c4e5aeab8b05c64bed675997be5d8
parent978b8b828d357197f4f209c9b3a0337a1a7aa7fd
drm/amdgpu: hold reference to fences in amdgpu_sa_bo_new (v2)

commit a8d81b36267366603771431747438d18f32ae2d5 upstream.

An arbitrary amount of time can pass between spin_unlock and
fence_wait_any_timeout, so we need to ensure that nobody frees the
fences from under us.

A stress test (rapidly starting and killing hundreds of glxgears
instances) ran into a deadlock in fence_wait_any_timeout after
about an hour, and this race condition appears to be a plausible
cause.

v2: agd: rebase on upstream

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c