drm/amdgpu: sanitize fence numbers
Looks like the VCE block sometimes still sends nonsense fence numbers on startup. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
737a44b106
commit
4f399a0828
|
@ -204,16 +204,22 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
|
||||||
if (seq != ring->fence_drv.sync_seq)
|
if (seq != ring->fence_drv.sync_seq)
|
||||||
amdgpu_fence_schedule_fallback(ring);
|
amdgpu_fence_schedule_fallback(ring);
|
||||||
|
|
||||||
|
last_seq &= drv->num_fences_mask;
|
||||||
|
seq &= drv->num_fences_mask;
|
||||||
|
|
||||||
while (last_seq != seq) {
|
while (last_seq != seq) {
|
||||||
struct fence *fence, **ptr;
|
struct fence *fence, **ptr;
|
||||||
|
|
||||||
ptr = &drv->fences[++last_seq & drv->num_fences_mask];
|
++last_seq;
|
||||||
|
last_seq &= drv->num_fences_mask;
|
||||||
|
ptr = &drv->fences[last_seq];
|
||||||
|
|
||||||
/* There is always exactly one thread signaling this fence slot */
|
/* There is always exactly one thread signaling this fence slot */
|
||||||
fence = rcu_dereference_protected(*ptr, 1);
|
fence = rcu_dereference_protected(*ptr, 1);
|
||||||
RCU_INIT_POINTER(*ptr, NULL);
|
RCU_INIT_POINTER(*ptr, NULL);
|
||||||
|
|
||||||
BUG_ON(!fence);
|
if (!fence)
|
||||||
|
continue;
|
||||||
|
|
||||||
r = fence_signal(fence);
|
r = fence_signal(fence);
|
||||||
if (!r)
|
if (!r)
|
||||||
|
|
Loading…
Reference in a new issue