drm/amdgpu: Let KFD sync with VM fences
Subsystems (2)
PATCH 1/1 drm/amdgpu: Let KFD sync with VM fences
Change the rules for amdgpu_sync_resv to let KFD synchronize with VM fences on page table reservations. This fixes intermittent memory corruption after evictions when using amdgpu_vm_handle_moved to update page tables for VM mappings managed through render nodes.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +2 -1
@@ -191,7 +191,8 @@ static bool amdgpu_sync_test_fence(struct amdgpu_device *adev,/* Never sync to VM updates either. */ if (fence_owner ==AMDGPU_FENCE_OWNER_VM && - owner !=AMDGPU_FENCE_OWNER_UNDEFINED ) + owner !=AMDGPU_FENCE_OWNER_UNDEFINED && + owner !=AMDGPU_FENCE_OWNER_KFD )return false;/* Ignore fences depending on the sync mode */
Signature · 1 line
2.34.1
Am 18.12.23 um 22:21 schrieb Felix Kuehling:
Quoted 6 lines
Change the rules for
amdgpu_sync_resvto let KFD synchronize with VM fences on page table reservations. This fixes intermittent memory corruption after evictions when usingamdgpu_vm_handle_movedto update page tables for VM mappings managed through render nodes.Signed-off-by Felix Kuehling <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +2
-1@@ -191,7 +191,8 @@ static bool amdgpu_sync_test_fence(struct amdgpu_device *adev,/* Never sync to VM updates either. */ if (fence_owner ==AMDGPU_FENCE_OWNER_VM && - owner !=AMDGPU_FENCE_OWNER_UNDEFINED ) + owner !=AMDGPU_FENCE_OWNER_UNDEFINED && + owner !=AMDGPU_FENCE_OWNER_KFD )return false;/* Ignore fences depending on the sync mode */
Christian König
maintainerAm 19.12.23 um 08:51 schrieb Christian König:
Quoted 9 lines
Am 18.12.23 um 22:21 schrieb Felix Kuehling:
Quoted 6 lines
Change the rules for
amdgpu_sync_resvto let KFD synchronize with VM fences on page table reservations. This fixes intermittent memory corruption after evictions when usingamdgpu_vm_handle_movedto update page tables for VM mappings managed through render nodes.Signed-off-by Felix Kuehling <[email protected]>Reviewed-by Christian König <[email protected]>
In the long term we should probably handle this by changing how VM fences are added to the resv object.
Implicit fences should be added with DMA_RESV_USAGE_KERNEL and explicit updates with DMA_RESV_USAGE_BOOKKEEP.
Regards,
Christian.
Quoted 19 lines
Quoted 18 lines
---
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +0
-0@@ -191,7 +191,8 @@ static bool amdgpu_sync_test_fence(struct amdgpu_device *adev, /* Never sync to VM updates either. */if (
fence_owner==AMDGPU_FENCE_OWNER_VM&& - owner !=AMDGPU_FENCE_OWNER_UNDEFINED) + owner !=AMDGPU_FENCE_OWNER_UNDEFINED&& + owner !=AMDGPU_FENCE_OWNER_KFD) return false;
/* Ignore fences depending on the sync mode */