Sync KFD Eviction fence only for move / evict
Subsystems (2)
PATCH 1/1 Sync KFD Eviction fence only for move / evict
What is KFD eviction fence?
For KFD submissions are done by user mode process. If any of user mode queues are active, KFD driver must ensure that all the BOs associated with that process must be resident. This is ensured by adding a blanket eviction fence to all of the process BOs.
When will the eviction fence be signaled?
Eviction fence will be signaled only when the system is low on memory and TTM wants to move / evict BOs. Before signaling the fence KFD driver quiesces all the queues that belongs to that process. After a timeout the reverse is done to make the process queues active again.
What is the current issue?
Interop BOs. KFD fence is attached to shared BO. So when graphics tries do a CS using this BO, KFD driver mistakes this to be an eviction. This patch is to solve this issue.
Harish Kasiviswanathan (1):
drm/amdgpu: Sync KFD fence only for move/evict
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1508434836-8944-1-git-send-email-Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org
PATCH 1/1 drm/amdgpu: Sync KFD fence only for move/evict
A single KFD eviction fence is attached to all the BOs of a process including BOs imported. This fence ensures that all BOs belonging to that process stays resident when the process queues are active.
Don't add this eviction fence to any sync object unless it is a move or evict job. These jobs are identified by the fence owner AMDGPU_FENCE_OWNER_UNDEFINED
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +5 -3
@@ -200,8 +200,10 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, f =reservation_object_get_excl (resv); fence_owner =amdgpu_sync_get_owner (f); -if (fence_owner !=AMDGPU_FENCE_OWNER_KFD || - owner !=AMDGPU_FENCE_OWNER_VM ) +if (fence_owner ==AMDGPU_FENCE_OWNER_KFD ) { +if (owner ==AMDGPU_FENCE_OWNER_UNDEFINED ) + r =amdgpu_sync_fence (adev, sync, f); + }else r =amdgpu_sync_fence (adev, sync, f);if (explicit_sync)
@@ -216,7 +218,7 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, reservation_object_held(resv)); fence_owner =amdgpu_sync_get_owner (f);if (fence_owner ==AMDGPU_FENCE_OWNER_KFD && - owner ==AMDGPU_FENCE_OWNER_VM ) + owner !=AMDGPU_FENCE_OWNER_UNDEFINED )continue ;if (amdgpu_sync_same_dev (adev, f)) {
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1508434836-8944-2-git-send-email-Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org
Christian König
NAKRe: [PATCH] drm/amdgpu: Sync KFD fence only for move/evict
Am 19.10.2017 um 19:40 schrieb Harish Kasiviswanathan:
Quoted 19 lines
A single KFD eviction fence is attached to all the BOs of a process including BOs imported. This fence ensures that all BOs belonging to that process stays resident when the process queues are active.
Don't add this eviction fence to any sync object unless it is a move or evict job. These jobs are identified by the fence owner
AMDGPU_FENCE_OWNER_UNDEFINEDChange-Id I8752d1cf6b2a1c4f2a57292b7c2cd308d5b6f9b7Signed-off-by Harish Kasiviswanathan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c int amdgpu_sync_resv(struct amdgpu_device *adev, · line 207
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +4
-2@@ -200,8 +200,10 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, f =reservation_object_get_excl (resv); fence_owner =amdgpu_sync_get_owner (f); -if (fence_owner !=AMDGPU_FENCE_OWNER_KFD || - owner !=AMDGPU_FENCE_OWNER_VM ) +if (fence_owner ==AMDGPU_FENCE_OWNER_KFD ) { +if (owner ==AMDGPU_FENCE_OWNER_UNDEFINED ) + r =amdgpu_sync_fence (adev, sync, f); + }else r =amdgpu_sync_fence (adev, sync, f);
NAK, we always need to sync to the exclusive fence no matter what.
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c int amdgpu_sync_resv(struct amdgpu_device *adev, · line 221
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +1
-1if (explicit_sync)@@ -216,7 +218,7 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, reservation_object_held(resv)); fence_owner =amdgpu_sync_get_owner (f);if (fence_owner ==AMDGPU_FENCE_OWNER_KFD && - owner ==AMDGPU_FENCE_OWNER_VM ) + owner !=AMDGPU_FENCE_OWNER_UNDEFINED )
That hunk looks good to me, but I think we don't have that upstream yet don't we?
Thanks,
Christian.
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c int amdgpu_sync_resv(struct amdgpu_device *adev, · line 224
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +0
-0continue ;if (amdgpu_sync_same_dev (adev, f)) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 55a40eca-08c3-3ba0-9f9c-775d8fe410ab-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
RE: [PATCH] drm/amdgpu: Sync KFD fence only for move/evict
-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, October 20, 2017 3:13 AM
To: Kasiviswanathan, Harish <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Sync KFD fence only for move/evict
Am 19.10.2017 um 19:40 schrieb Harish Kasiviswanathan:
Quoted 20 lines
A single KFD eviction fence is attached to all the BOs of a process including BOs imported. This fence ensures that all BOs belonging to that process stays resident when the process queues are active.
Don't add this eviction fence to any sync object unless it is a move or evict job. These jobs are identified by the fence owner
AMDGPU_FENCE_OWNER_UNDEFINEDChange-Id I8752d1cf6b2a1c4f2a57292b7c2cd308d5b6f9b7Signed-off-by Harish Kasiviswanathan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c int amdgpu_sync_resv(struct amdgpu_device *adev, · line 207
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +4
-2@@ -200,8 +200,10 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, f =reservation_object_get_excl (resv); fence_owner =amdgpu_sync_get_owner (f); -if (fence_owner !=AMDGPU_FENCE_OWNER_KFD || - owner !=AMDGPU_FENCE_OWNER_VM ) +if (fence_owner ==AMDGPU_FENCE_OWNER_KFD ) { +if (owner ==AMDGPU_FENCE_OWNER_UNDEFINED ) + r =amdgpu_sync_fence (adev, sync, f); + }else r =amdgpu_sync_fence (adev, sync, f);
NAK, we always need to sync to the exclusive fence no matter what.
[HK]: Will fix this one.
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c int amdgpu_sync_resv(struct amdgpu_device *adev, · line 221
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +1
-1if (explicit_sync)@@ -216,7 +218,7 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, reservation_object_held(resv)); fence_owner =amdgpu_sync_get_owner (f);if (fence_owner ==AMDGPU_FENCE_OWNER_KFD && - owner ==AMDGPU_FENCE_OWNER_VM ) + owner !=AMDGPU_FENCE_OWNER_UNDEFINED )
That hunk looks good to me, but I think we don't have that upstream yet don't we?
[HK]: Not upstream yet. This is based on amd-kfd-staging. This will be part of KFD upstreaming process.
Thanks,
Christian.
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c int amdgpu_sync_resv(struct amdgpu_device *adev, · line 224
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +0
-0continue ;if (amdgpu_sync_same_dev (adev, f)) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx