Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: rework how we handle TLB fences

Add a new VM flag to indicate whether or not we need
a TLB fence. Userqs (KFD or KGD) require a TLB fence.
A TLB fence is not strictly required for kernel queues,
but it shouldn't hurt. That said, enabling this
unconditionally should be fine, but it seems to tickle
some issues in KIQ/MES. Only enable them for KFD,
or when KGD userq queues are enabled (currently via module
parameter).

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4798
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4749
Fixes: f3854e04b708 ("drm/amdgpu: attach tlb fence to the PTs update")
Cc: Christian König <christian.koenig@amd.com>
Cc: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Prike Liang <Prike.Liang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+8 -1
+6 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 1073 1073 } 1074 1074 1075 1075 /* Prepare a TLB flush fence to be attached to PTs */ 1076 - if (!params->unlocked) { 1076 + /* The check for need_tlb_fence should be dropped once we 1077 + * sort out the issues with KIQ/MES TLB invalidation timeouts. 1078 + */ 1079 + if (!params->unlocked && vm->need_tlb_fence) { 1077 1080 amdgpu_vm_tlb_fence_create(params->adev, vm, fence); 1078 1081 1079 1082 /* Makes sure no PD/PT is freed before the flush */ ··· 2609 2606 ttm_lru_bulk_move_init(&vm->lru_bulk_move); 2610 2607 2611 2608 vm->is_compute_context = false; 2609 + vm->need_tlb_fence = amdgpu_userq_enabled(&adev->ddev); 2612 2610 2613 2611 vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode & 2614 2612 AMDGPU_VM_USE_CPU_FOR_GFX); ··· 2747 2743 dma_fence_put(vm->last_update); 2748 2744 vm->last_update = dma_fence_get_stub(); 2749 2745 vm->is_compute_context = true; 2746 + vm->need_tlb_fence = true; 2750 2747 2751 2748 unreserve_bo: 2752 2749 amdgpu_bo_unreserve(vm->root.bo);
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
··· 441 441 struct ttm_lru_bulk_move lru_bulk_move; 442 442 /* Flag to indicate if VM is used for compute */ 443 443 bool is_compute_context; 444 + /* Flag to indicate if VM needs a TLB fence (KFD or KGD) */ 445 + bool need_tlb_fence; 444 446 445 447 /* Memory partition number, -1 means any partition */ 446 448 int8_t mem_id;