[PATCH] drm/amdgpu: Let KFD sync with VM fences
Christian König
christian.koenig at amd.com
Tue Dec 19 07:53:47 UTC 2023
Am 19.12.23 um 08:51 schrieb Christian König:
> Am 18.12.23 um 22:21 schrieb Felix Kuehling:
>> 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.
>>
>> Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
>
> Reviewed-by: Christian König <christian.koenig at amd.com>
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.
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
>> index dcd8c066bc1f..1b013a44ca99 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
>> @@ -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 */
>
More information about the amd-gfx
mailing list