mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
drm/amdgpu: sync to KFD fences before clearing PTEs
This patch tries to solve the basic problem we also need to sync to the KFD fences of the BO because otherwise it can be that we clear PTEs while the KFD queues are still running. Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
4771d2ecb7
commit
126be9b2be
@@ -260,6 +260,36 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_sync_kfd - sync to KFD fences
|
||||
*
|
||||
* @sync: sync object to add KFD fences to
|
||||
* @resv: reservation object with KFD fences
|
||||
*
|
||||
* Extract all KFD fences and add them to the sync object.
|
||||
*/
|
||||
int amdgpu_sync_kfd(struct amdgpu_sync *sync, struct dma_resv *resv)
|
||||
{
|
||||
struct dma_resv_iter cursor;
|
||||
struct dma_fence *f;
|
||||
int r = 0;
|
||||
|
||||
dma_resv_iter_begin(&cursor, resv, DMA_RESV_USAGE_BOOKKEEP);
|
||||
dma_resv_for_each_fence_unlocked(&cursor, f) {
|
||||
void *fence_owner = amdgpu_sync_get_owner(f);
|
||||
|
||||
if (fence_owner != AMDGPU_FENCE_OWNER_KFD)
|
||||
continue;
|
||||
|
||||
r = amdgpu_sync_fence(sync, f);
|
||||
if (r)
|
||||
break;
|
||||
}
|
||||
dma_resv_iter_end(&cursor);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Free the entry back to the slab */
|
||||
static void amdgpu_sync_entry_free(struct amdgpu_sync_entry *e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user