mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
drm/amdgpu/fence: add helper to extract the guilty fence
Add a helper to extract the first amdgpu_fence which has not yet signalled and is thus guilty or at least collateral damage. Reviewed-by: Jesse Zhang <jesse.zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
ce3f23a780
commit
36ed61b1c0
|
|
@ -831,6 +831,37 @@ void amdgpu_ring_backup_unprocessed_commands(struct amdgpu_ring *ring,
|
||||||
} while (last_seq != seq);
|
} while (last_seq != seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct amdgpu_fence *
|
||||||
|
amdgpu_ring_find_guilty_fence(struct amdgpu_ring *ring)
|
||||||
|
{
|
||||||
|
struct dma_fence *unprocessed;
|
||||||
|
struct dma_fence __rcu **ptr;
|
||||||
|
struct amdgpu_fence *fence;
|
||||||
|
u32 seq, last_seq;
|
||||||
|
|
||||||
|
last_seq = amdgpu_fence_read(ring) & ring->fence_drv.num_fences_mask;
|
||||||
|
seq = ring->fence_drv.sync_seq & ring->fence_drv.num_fences_mask;
|
||||||
|
ring->ring_backup_entries_to_copy = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
last_seq++;
|
||||||
|
last_seq &= ring->fence_drv.num_fences_mask;
|
||||||
|
|
||||||
|
ptr = &ring->fence_drv.fences[last_seq];
|
||||||
|
rcu_read_lock();
|
||||||
|
unprocessed = rcu_dereference(*ptr);
|
||||||
|
|
||||||
|
if (unprocessed && !dma_fence_is_signaled(unprocessed)) {
|
||||||
|
fence = container_of(unprocessed, struct amdgpu_fence, base);
|
||||||
|
rcu_read_unlock();
|
||||||
|
return fence;
|
||||||
|
}
|
||||||
|
rcu_read_unlock();
|
||||||
|
} while (last_seq != seq);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Common fence implementation
|
* Common fence implementation
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -589,6 +589,8 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev);
|
||||||
bool amdgpu_ring_sched_ready(struct amdgpu_ring *ring);
|
bool amdgpu_ring_sched_ready(struct amdgpu_ring *ring);
|
||||||
void amdgpu_ring_backup_unprocessed_commands(struct amdgpu_ring *ring,
|
void amdgpu_ring_backup_unprocessed_commands(struct amdgpu_ring *ring,
|
||||||
struct amdgpu_fence *guilty_fence);
|
struct amdgpu_fence *guilty_fence);
|
||||||
|
struct amdgpu_fence *
|
||||||
|
amdgpu_ring_find_guilty_fence(struct amdgpu_ring *ring);
|
||||||
void amdgpu_ring_reset_helper_begin(struct amdgpu_ring *ring,
|
void amdgpu_ring_reset_helper_begin(struct amdgpu_ring *ring,
|
||||||
struct amdgpu_fence *guilty_fence);
|
struct amdgpu_fence *guilty_fence);
|
||||||
int amdgpu_ring_reset_helper_end(struct amdgpu_ring *ring,
|
int amdgpu_ring_reset_helper_end(struct amdgpu_ring *ring,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user