diff options
author | Christian König <christian.koenig@amd.com> | 2019-12-16 16:07:06 +0100 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2020-02-05 05:30:39 +0100 |
commit | 5d3196605d00b513a735b358f5e4f2d1b65f6c3a (patch) | |
tree | 9d0fe419b8e5f7924417bbd06d2f0e89844967c0 /drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | |
parent | drm/amdgpu: use the VM as job owner (diff) | |
download | linux-5d3196605d00b513a735b358f5e4f2d1b65f6c3a.tar.xz linux-5d3196605d00b513a735b358f5e4f2d1b65f6c3a.zip |
drm/amdgpu: rework job synchronization v2
For unlocked page table updates we need to be able
to sync to fences of a specific VM.
v2: use SYNC_ALWAYS in the UVD code
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c index a09b6b9c27d1..c124f64e7aae 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c @@ -202,18 +202,17 @@ int amdgpu_sync_vm_fence(struct amdgpu_sync *sync, struct dma_fence *fence) * * @sync: sync object to add fences from reservation object to * @resv: reservation object with embedded fence - * @explicit_sync: true if we should only sync to the exclusive fence + * @mode: how owner affects which fences we sync to + * @owner: owner of the planned job submission * * Sync to the fence */ -int amdgpu_sync_resv(struct amdgpu_device *adev, - struct amdgpu_sync *sync, - struct dma_resv *resv, - void *owner, bool explicit_sync) +int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync, + struct dma_resv *resv, enum amdgpu_sync_mode mode, + void *owner) { struct dma_resv_list *flist; struct dma_fence *f; - void *fence_owner; unsigned i; int r = 0; @@ -229,6 +228,8 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, return r; for (i = 0; i < flist->shared_count; ++i) { + void *fence_owner; + f = rcu_dereference_protected(flist->shared[i], dma_resv_held(resv)); /* We only want to trigger KFD eviction fences on @@ -239,20 +240,34 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, owner != AMDGPU_FENCE_OWNER_UNDEFINED) continue; - if (amdgpu_sync_same_dev(adev, f)) { - /* VM updates only sync with moves but not with user - * command submissions or KFD evictions fences - */ - if (owner == AMDGPU_FENCE_OWNER_VM && - fence_owner != AMDGPU_FENCE_OWNER_UNDEFINED) + /* VM updates only sync with moves but not with user + * command submissions or KFD evictions fences + */ + if (fence_owner != AMDGPU_FENCE_OWNER_UNDEFINED && + owner == AMDGPU_FENCE_OWNER_VM) + continue; + + /* Ignore fences depending on the sync mode */ + switch (mode) { + case AMDGPU_SYNC_ALWAYS: + break; + + case AMDGPU_SYNC_NE_OWNER: + if (amdgpu_sync_same_dev(adev, f) && + fence_owner == owner) continue; + break; - /* Ignore fence from the same owner and explicit one as - * long as it isn't undefined. - */ - if (owner != AMDGPU_FENCE_OWNER_UNDEFINED && - (fence_owner == owner || explicit_sync)) + case AMDGPU_SYNC_EQ_OWNER: + if (amdgpu_sync_same_dev(adev, f) && + fence_owner != owner) + continue; + break; + + case AMDGPU_SYNC_EXPLICIT: + if (owner != AMDGPU_FENCE_OWNER_UNDEFINED) continue; + break; } r = amdgpu_sync_fence(sync, f, false); |