Skip to contentSkip to conversation

drm/amdgpu: attach tlb fence to the PTs update

PATCH In review Prike Liang 2 participants 4 messages Nov 5, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: attach tlb fence to the PTs update

Ensure the userq TLB flush is emitted only after the VM update finishes and the PT BOs have been annotated with bookkeeping fences.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index db66b4232de0..79d687dee877 100644
@@ -1062,7 +1062,7 @@ amdgpu_vm_tlb_flush(struct amdgpu_vm_update_params *params,
 	}
 
 	/* Prepare a TLB flush fence to be attached to PTs */
-	if (!params->unlocked && vm->is_compute_context) {
+	if (!params->unlocked) {
 		amdgpu_vm_tlb_fence_create(params->adev, vm, fence);
 
 		/* Makes sure no PD/PT is freed before the flush */
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Prike Liang

Ensure the userq TLB flush is emitted only after the VM update finishes and the PT BOs have been annotated with bookkeeping fences.

Could be that people start to complain that this results in extra overhead, but that shouldn't be much of an issue.

Regards,
Christian.

Quoted 17 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index db66b4232de0..79d687dee877 100644
@@ -1062,7 +1062,7 @@ amdgpu_vm_tlb_flush(struct amdgpu_vm_update_params *params,
 	}
 
 	/* Prepare a TLB flush fence to be attached to PTs */
-	if (!params->unlocked && vm->is_compute_context) {
+	if (!params->unlocked) {
 		amdgpu_vm_tlb_fence_create(params->adev, vm, fence);
 
 		/* Makes sure no PD/PT is freed before the flush */
#2 lore raw

[Public]

Regards,
Prike

Quoted 13 lines

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, November 5, 2025 8:50 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: attach tlb fence to the PTs update

Quoted 3 lines · Prike Liang

Ensure the userq TLB flush is emitted only after the VM update finishes and the PT BOs have been annotated with bookkeeping fences.

Quoted 7 lines
Quoted 2 lines

Could be that people start to complain that this results in extra overhead, but that shouldn't be much of an issue.

If without sorting the userq or KFD compute context, maybe overhead on legacy kernel queue case?

Quoted 22 lines

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c amdgpu_vm_tlb_flush(struct

Quoted 10 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index db66b4232de0..79d687dee877 100644
@@ -1062,7 +1062,7 @@ amdgpu_vm_tlb_flush(struct

amdgpu_vm_update_params *params,

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
    }
 
    /* Prepare a TLB flush fence to be attached to PTs */
-   if (!params->unlocked && vm->is_compute_context) {
+   if (!params->unlocked) {
            amdgpu_vm_tlb_fence_create(params->adev, vm, fence);
 
            /* Makes sure no PD/PT is freed before the flush */
maintainer
#3 lore raw
Quoted 18 lines · Prike

[Public]

Regards,
Prike

Quoted 13 lines

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, November 5, 2025 8:50 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: attach tlb fence to the PTs update

Quoted 3 lines · Prike Liang

Ensure the userq TLB flush is emitted only after the VM update finishes and the PT BOs have been annotated with bookkeeping fences.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

Could be that people start to complain that this results in extra overhead, but that shouldn't be much of an issue.

If without sorting the userq or KFD compute context, maybe overhead on legacy kernel queue case?

Yes, starting a worker all the time is not that much overhead but checking all the VMIDs for the PASID is.

We could make it depend on the HW generation if that really becomes a problem.

Regards,
Christian.

Quoted 24 lines
Quoted 23 lines

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c amdgpu_vm_tlb_flush(struct

Quoted 10 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index db66b4232de0..79d687dee877 100644
@@ -1062,7 +1062,7 @@ amdgpu_vm_tlb_flush(struct

amdgpu_vm_update_params *params,

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
    }
 
    /* Prepare a TLB flush fence to be attached to PTs */
-   if (!params->unlocked && vm->is_compute_context) {
+   if (!params->unlocked) {
            amdgpu_vm_tlb_fence_create(params->adev, vm, fence);
 
            /* Makes sure no PD/PT is freed before the flush */