* drm/amdgpu: workaround for TLB seq race
@ 2022-11-03 16:33 Stefan Springer
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Springer @ 2022-11-03 16:33 UTC (permalink / raw)
To: amd-gfx
[-- Attachment #1: Type: text/plain, Size: 51 bytes --]
Tested-by: Stefan Springer <stefanspr94@gmail.com>
[-- Attachment #2: Type: text/html, Size: 141 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: drm/amdgpu: workaround for TLB seq race
2022-11-02 14:58 [PATCH] " Christian König
@ 2022-11-03 18:03 ` Limonciello, Mario
0 siblings, 0 replies; 2+ messages in thread
From: Limonciello, Mario @ 2022-11-03 18:03 UTC (permalink / raw)
To: Christian König, amd-gfx; +Cc: Christian König
On 11/2/2022 09:58, Christian König wrote:
> It can happen that we query the sequence value before the callback
> had a chance to run.
>
> Work around that by grabbing the fence lock and releasing it again.
> Should be replaced by hw handling soon.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Acked-by: Alex Deucher <alexander.deucher@amd.com>
You probably also want to add these tags:
Fixes: 5255e146c99a6 ("drm/amdgpu: rework TLB flushing")
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2113
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 9ecb7f663e19..e51a46c9582b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -485,6 +485,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;
> +
> + /*
> + * Work around 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);
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-03 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 16:33 drm/amdgpu: workaround for TLB seq race Stefan Springer
-- strict thread matches above, loose matches on Subject: below --
2022-11-02 14:58 [PATCH] " Christian König
2022-11-03 18:03 ` Limonciello, Mario
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.