diff options
| author | Christian König <[email protected]> | 2022-11-02 13:55:13 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2022-11-09 22:22:48 +0000 |
| commit | f9e69496450352fa0504fd5a8fd9134b31116558 (patch) | |
| tree | d5b1d188f9058dc4e9aff19215926f1c4c9a4afe /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | |
| parent | drm/amdkfd: Fix error handling in criu_checkpoint (diff) | |
| download | kernel-f9e69496450352fa0504fd5a8fd9134b31116558.tar.gz kernel-f9e69496450352fa0504fd5a8fd9134b31116558.zip | |
drm/amdgpu: workaround for TLB seq race
It can happen that we query the sequence value before the callback
had a chance to run.
Workaround that by grabbing the fence lock and releasing it again.
Should be replaced by hw handling soon.
Signed-off-by: Christian König <[email protected]>
CC: [email protected] # 5.19+
Fixes: 5255e146c99a6 ("drm/amdgpu: rework TLB flushing")
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2113
Acked-by: Alex Deucher <[email protected]>
Acked-by: Philip Yang <[email protected]>
Tested-by: Stefan Springer <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index 83acb7bd80fe..1d31771b4230 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h @@ -492,6 +492,21 @@ void amdgpu_debugfs_vm_bo_info(struct amdgpu_vm *vm, struct seq_file *m); */ static inline uint64_t amdgpu_vm_tlb_seq(struct amdgpu_vm *vm) { + unsigned long flags; + spinlock_t *lock; + + /* + * Workaround to stop racing between the fence signaling and handling + * the cb. The lock is static after initially setting it up, just make + * sure that the dma_fence structure isn't freed up. + */ + rcu_read_lock(); + lock = vm->last_tlb_flush->lock; + rcu_read_unlock(); + + spin_lock_irqsave(lock, flags); + spin_unlock_irqrestore(lock, flags); + return atomic64_read(&vm->tlb_seq); } |
