drm/amdgpu: loosen the criteria for huge pages a bit
Subsystems (2)
PATCH 1/4 drm/amdgpu: loosen the criteria for huge pages a bit
We can actually handle invalid huge pages perfectly fine now.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -5
@@ -950,11 +950,8 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p,uint64_t pd_addr, pde;/* In the case of a mixed PT the PDE must point to it*/ -if (p->adev->asic_type <CHIP_VEGA10 || - nptes !=AMDGPU_VM_PTE_COUNT (p->adev) || - p->src || - !(flags &AMDGPU_PTE_VALID )) { - +if (p->adev->asic_type <CHIP_VEGA10 || p->src || + nptes !=AMDGPU_VM_PTE_COUNT (p->adev)) { dst =amdgpu_bo_gpu_offset (entry->base.bo); flags =AMDGPU_PTE_VALID ; }else {
Signature · 6 lines
2.11.0 _______________________________________________ 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): 20180102144715.4278-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
PATCH 2/4 drm/amdgpu: minor optimize VM moved handling v2
Try to lock moved BOs if it's successful we can update the PTEs directly to the new location.
v2: rebase
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +14 -1
@@ -1697,18 +1697,31 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,spin_lock (&vm->status_lock);while (!list_empty (&vm->moved)) {struct amdgpu_bo_va *bo_va; +struct reservation_object *resv; bo_va =list_first_entry (&vm->moved, struct amdgpu_bo_va, base.vm_status);spin_unlock (&vm->status_lock); + resv = bo_va->base.bo->tbo.resv; +/* Per VM BOs never need to bo cleared in the page tables */ - clear = bo_va->base.bo->tbo.resv != vm->root.base.bo->tbo.resv; +if (resv == vm->root.base.bo->tbo.resv) + clear = false; +/* Try to reserve the BO to avoid clearing its ptes */ +else if (reservation_object_trylock (resv)) + clear = false; +/* Somebody else is using the BO right now */ +else + clear = true; r =amdgpu_vm_bo_update (adev, bo_va, clear);if (r)return r; +if (!clear && resv != vm->root.base.bo->tbo.resv) +reservation_object_unlock (resv); +spin_lock (&vm->status_lock); }spin_unlock (&vm->status_lock);
Signature · 6 lines
2.11.0 _______________________________________________ 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): 20180102144715.4278-2-christian.koenig-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/4] drm/amdgpu: minor optimize VM moved handling v2
Quoted 17 lines · Christian König
Try to lock moved BOs if it's successful we can update the PTEs directly to the new location.
v2: rebase
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0@@ -1697,18 +1697,31 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,spin_lock (&vm->status_lock);while (!list_empty (&vm->moved)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_handle_moved(struct amdgpu_device *adev, · line 1708
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3
-0struct amdgpu_bo_va *bo_va; +struct reservation_object *resv; bo_va =list_first_entry (&vm->moved, struct amdgpu_bo_va, base.vm_status);spin_unlock (&vm->status_lock); + resv = bo_va->base.bo->tbo.resv; +/* Per VM BOs never need to bo cleared in the page tables */
This reminders us Per-VM-BOs need to cleared as well after we allow to evict/swap out per-vm-bos.
Regards,
David Zhou
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +8
-1- clear = bo_va->base.bo->tbo.resv != vm->root.base.bo->tbo.resv; +if (resv == vm->root.base.bo->tbo.resv) + clear = false; +/* Try to reserve the BO to avoid clearing its ptes */ +else if (reservation_object_trylock (resv)) + clear = false; +/* Somebody else is using the BO right now */ +else + clear = true;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_handle_moved(struct amdgpu_device *adev, · line 1727
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3
-0r =amdgpu_vm_bo_update (adev, bo_va, clear);if (r)return r; +if (!clear && resv != vm->root.base.bo->tbo.resv) +reservation_object_unlock (resv); +spin_lock (&vm->status_lock); }spin_unlock (&vm->status_lock);
_______________________________________________
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): MWHPR1201MB0206AFE9297613F6B292C91DB41E0-3iK1xFAIwjrUF/YbdlDdgWrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]
Re: [PATCH 2/4] drm/amdgpu: minor optimize VM moved handling v2
Am 03.01.2018 um 09:10 schrieb Zhou, David(ChunMing):
Quoted 26 lines · Christian König
Quoted 24 lines
Try to lock moved BOs if it's successful we can update the PTEs directly to the new location.
v2: rebase
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1697,18 +1697,31 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,spin_lock (&vm->status_lock);while (!list_empty (&vm->moved)) {struct amdgpu_bo_va *bo_va; +struct reservation_object *resv; bo_va =list_first_entry (&vm->moved, struct amdgpu_bo_va, base.vm_status);spin_unlock (&vm->status_lock);
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_handle_moved(struct amdgpu_device *adev, · line 1708
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-0+ resv = bo_va->base.bo->tbo.resv; +/* Per VM BOs never need to bo cleared in the page tables */ This reminders us Per-VM-BOs need to cleared as well after we allow to evict/swap out per-vm-bos.
Actually they don't. The page tables only need to be valid during CS.
So what happens is that the per VM-BOs are validated in right before we call amdgpu_vm_handle_moved().
Regards,
Christian.
Quoted 17 lines
Regards,
David ZhouQuoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +8
-1- clear = bo_va->base.bo->tbo.resv != vm->root.base.bo->tbo.resv; +if (resv == vm->root.base.bo->tbo.resv) + clear = false; +/* Try to reserve the BO to avoid clearing its ptes */ +else if (reservation_object_trylock (resv)) + clear = false; +/* Somebody else is using the BO right now */ +else + clear = true; r =amdgpu_vm_bo_update (adev, bo_va, clear);if (r)return r;
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_handle_moved(struct amdgpu_device *adev, · line 1727
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3
-0+if (!clear && resv != vm->root.base.bo->tbo.resv) +reservation_object_unlock (resv); +spin_lock (&vm->status_lock); }spin_unlock (&vm->status_lock);
_______________________________________________
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): ccfc21d7-57d6-47fd-0019-46a193836e69-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 2/4] drm/amdgpu: minor optimize VM moved handling v2
Quoted 32 lines · Christian König
Am 03.01.2018 um 09:10 schrieb Zhou, David(ChunMing):
Quoted 22 lines · Christian König
Quoted 20 lines
Try to lock moved BOs if it's successful we can update the PTEs directly to the new location.
v2: rebase
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 15 ++++++++++++++-1 file changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1697,18 +1697,31 @@ int amdgpu_vm_handle_moved(structamdgpu_device *adev, spin_lock(&vm->status_lock); while (!list_empty(&vm->moved)) { struct amdgpu_bo_va *bo_va; + struct reservation_object *resv;Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_handle_moved(struct amdgpu_device *adev, · line 1708
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0bo_va = list_first_entry(&vm->moved, struct amdgpu_bo_va, base.vm_status); spin_unlock(&vm->status_lock); + resv = bo_va->base.bo->tbo.resv; + /* Per VM BOs never need to bo cleared in the page tables */This reminders us Per-VM-BOs need to cleared as well after we allow to evict/swap out per-vm-bos.
Quoted 3 lines
Actually they don't. The page tables only need to be valid during CS.
So what happens is that the per VM-BOs are validated in right before we call
amdgpu_vm_handle_moved().
Yeah, agree it for per-vm-bo situation after I checked all adding moved list cases:
1. validate pt bos
2. bo invalidate
3. insert_map for per-vm-bo
item #1 and #3 both are per-vm-bo, they are already validated before handle_moved().
For item #2, there are three places to call it:
a. amdgpu_bo_vm_update_pte in CS for amdgpu_vm_debug
b. amdgpu_gem_op_ioctl, but it is for evicted list, nothing with moved list. c. amdgpu_bo_move_notify when bo validate.
For c case, your optimization is valid, we don't need clear for validate bo. But for a case, yours will break amdgpu_vm_debug functionality.
Right?
Regards,
David Zhou
Quoted 27 lines
Regards,
Christian.Quoted 22 lines
Regards,
David ZhouQuoted 19 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +10
-1- clear = bo_va->base.bo->tbo.resv != vm->root.base.bo->tbo.resv; + if (resv == vm->root.base.bo->tbo.resv) + clear = false; + /* Try to reserve the BO to avoid clearing its ptes */ + else if (reservation_object_trylock(resv)) + clear = false; + /* Somebody else is using the BO right now */ + else + clear = true; r = amdgpu_vm_bo_update(adev, bo_va, clear); if (r) return r; + if (!clear && resv != vm->root.base.bo->tbo.resv) + reservation_object_unlock(resv); + spin_lock(&vm->status_lock); } spin_unlock(&vm->status_lock);
_______________________________________________
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): 2c70dc36-fd93-8e74-6ab9-782c06f1a296-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/4] drm/amdgpu: minor optimize VM moved handling v2
Am 03.01.2018 um 11:43 schrieb Chunming Zhou:
Quoted 49 lines · Christian König
Quoted 32 lines
Am 03.01.2018 um 09:10 schrieb Zhou, David(ChunMing):
Quoted 22 lines · Christian König
Quoted 20 lines
Try to lock moved BOs if it's successful we can update the PTEs directly to the new location.
v2: rebase
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 15 ++++++++++++++-1 file changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1697,18 +1697,31 @@ int amdgpu_vm_handle_moved(structamdgpu_device *adev, spin_lock(&vm->status_lock); while (!list_empty(&vm->moved)) { struct amdgpu_bo_va *bo_va; + struct reservation_object *resv;Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_handle_moved(struct · line 1707
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0bo_va = list_first_entry(&vm->moved, struct amdgpu_bo_va, base.vm_status); spin_unlock(&vm->status_lock); + resv = bo_va->base.bo->tbo.resv; + /* Per VM BOs never need to bo cleared in the page tables */This reminders us Per-VM-BOs need to cleared as well after we allow to evict/swap out per-vm-bos.
Quoted 3 lines
Actually they don't. The page tables only need to be valid during CS.
So what happens is that the per VM-BOs are validated in right before we call
amdgpu_vm_handle_moved().Yeah, agree it for per-vm-bo situation after I checked all adding moved list cases:
1. validate pt bos
2. bo invalidate
3.insert_mapfor per-vm-bo
item #1 and #3 both are per-vm-bo, they are already validated beforehandle_moved().For item #2, there are three places to call it:
a.amdgpu_bo_vm_update_ptein CS foramdgpu_vm_debug
b.amdgpu_gem_op_ioctl, but it is for evicted list, nothing with moved list. c.amdgpu_bo_move_notifywhen bo validate.
Quoted 4 lines
For c case, your optimization is valid, we don't need clear for validate bo. But for a case, yours will break
amdgpu_vm_debugfunctionality.Right?
Interesting point, but no that should be handled as well.
The vm_debug handling is only for the BOs on the BO-list. E.g. per VM BOs are never handled here.
Regards,
Christian.
Quoted 32 lines
Regards,
David ZhouQuoted 27 lines
Regards,
Christian.Quoted 22 lines
Regards,
David ZhouQuoted 19 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +10
-1- clear = bo_va->base.bo->tbo.resv != vm->root.base.bo->tbo.resv; + if (resv == vm->root.base.bo->tbo.resv) + clear = false; + /* Try to reserve the BO to avoid clearing its ptes */ + else if (reservation_object_trylock(resv)) + clear = false; + /* Somebody else is using the BO right now */ + else + clear = true; r = amdgpu_vm_bo_update(adev, bo_va, clear); if (r) return r; + if (!clear && resv != vm->root.base.bo->tbo.resv) + reservation_object_unlock(resv); + spin_lock(&vm->status_lock); } spin_unlock(&vm->status_lock);
_______________________________________________
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): f62c15ab-c605-0f16-1448-b38553ec23ad-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/4] drm/amdgpu: minor optimize VM moved handling v2
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ else if (reservation_object_trylock(resv)) + clear = false;
this will effect bo in bo list,wont it?
发自坚果 Pro
Koenig, Christian <[email protected]> 于 2018年1月3日 下午6:47写道:
Am 03.01.2018 um 11:43 schrieb Chunming Zhou:
Quoted 55 lines · Christian König
Quoted 34 lines
Am 03.01.2018 um 09:10 schrieb Zhou, David(ChunMing):
Quoted 24 lines · Christian König
Quoted 22 lines
Try to lock moved BOs if it's successful we can update the PTEs directly to the new location.
v2: rebase
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1697,18 +1697,31 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,spin_lock (&vm->status_lock);while (!list_empty (&vm->moved)) {struct amdgpu_bo_va *bo_va; +struct reservation_object *resv; bo_va = list_first_entry(&vm->moved,Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0struct amdgpu_bo_va, base.vm_status);spin_unlock (&vm->status_lock); + resv = bo_va->base.bo->tbo.resv; +/* Per VM BOs never need to bo cleared in the page tables */
This reminders us Per-VM-BOs need to cleared as well after we allow to evict/swap out per-vm-bos.
Quoted 4 lines
Actually they don't. The page tables only need to be valid during CS.
So what happens is that the per VM-BOs are validated in right before we call
amdgpu_vm_handle_moved().Yeah, agree it for per-vm-bo situation after I checked all adding moved list cases:
1. validate pt bos
2. bo invalidate
3.insert_mapfor per-vm-bo
item #1 and #3 both are per-vm-bo, they are already validated beforehandle_moved().For item #2, there are three places to call it:
a.amdgpu_bo_vm_update_ptein CS foramdgpu_vm_debug
b.amdgpu_gem_op_ioctl, but it is for evicted list, nothing with moved list.
c.amdgpu_bo_move_notifywhen bo validate.
Quoted 5 lines
For c case, your optimization is valid, we don't need clear for validate bo.
But for a case, yours will breakamdgpu_vm_debugfunctionality.Right?
Interesting point, but no that should be handled as well.
The vm_debug handling is only for the BOs on the BO-list. E.g. per VM BOs are never handled here.
Regards,
Christian.
Quoted 32 lines
Regards,
David ZhouQuoted 27 lines
Regards,
Christian.Quoted 22 lines
Regards,
David ZhouQuoted 19 lines
- clear =
bo_va->base.bo->tbo.resv!=vm->root.base.bo->tbo.resv;drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +10
-0+if (resv == vm->root.base.bo->tbo.resv) + clear = false; +/* Try to reserve the BO to avoid clearing its ptes */ +else if (reservation_object_trylock (resv)) + clear = false; +/* Somebody else is using the BO right now */ +else + clear = true; r =amdgpu_vm_bo_update (adev, bo_va, clear);if (r)return r; + if (!clear && resv != vm->root.base.bo->tbo.resv) +reservation_object_unlock (resv); +spin_lock (&vm->status_lock); }spin_unlock (&vm->status_lock);
_______________________________________________
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): MWHPR1201MB02067E3350544334BF981EE5B41E0-3iK1xFAIwjrUF/YbdlDdgWrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]
Re: [PATCH 2/4] drm/amdgpu: minor optimize VM moved handling v2
Am 03.01.2018 um 12:57 schrieb Zhou, David(ChunMing):
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+ else if (reservation_object_trylock(resv)) + clear = false;
this will effect bo in bo list,wont it?
Ah, now I get what you mean.
Yeah, that should be fixed or otherwise it will completely disable vm_debug support.
Going to send a patch,
Christian.
Quoted 110 lines
发自坚果 Pro
Koenig, Christian <[email protected]> 于 2018年1月3日 下午6:47写道:
Am 03.01.2018 um 11:43 schrieb Chunming Zhou:
Quoted 55 lines · Christian König
Quoted 34 lines
Am 03.01.2018 um 09:10 schrieb Zhou, David(ChunMing):
Quoted 24 lines · Christian König
Quoted 22 lines
Try to lock moved BOs if it's successful we can update the PTEs directly to the new location.
v2: rebase
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 15 ++++++++++++++-1 file changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1697,18 +1697,31 @@ int amdgpu_vm_handle_moved(structamdgpu_device *adev, spin_lock(&vm->status_lock); while (!list_empty(&vm->moved)) { struct amdgpu_bo_va *bo_va; + struct reservation_object *resv; bo_va = list_first_entry(&vm->moved,Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0struct amdgpu_bo_va, base.vm_status);spin_unlock (&vm->status_lock); + resv = bo_va->base.bo->tbo.resv; + /* Per VM BOs never need to bo cleared in the pagetables */
This reminders us Per-VM-BOs need to cleared as well after we allow to evict/swap out per-vm-bos.
Quoted 4 lines
Actually they don't. The page tables only need to be valid during CS.
So what happens is that the per VM-BOs are validated in right before we call
amdgpu_vm_handle_moved().Yeah, agree it for per-vm-bo situation after I checked all adding moved list cases:
1. validate pt bos
2. bo invalidate
3.insert_mapfor per-vm-bo
item #1 and #3 both are per-vm-bo, they are already validated beforehandle_moved().For item #2, there are three places to call it:
a.amdgpu_bo_vm_update_ptein CS foramdgpu_vm_debug
b.amdgpu_gem_op_ioctl, but it is for evicted list, nothing with moved list.
c.amdgpu_bo_move_notifywhen bo validate.Quoted 5 lines
For c case, your optimization is valid, we don't need clear for validate bo.
But for a case, yours will breakamdgpu_vm_debugfunctionality.Right?
Interesting point, but no that should be handled as well.
The
vm_debughandling is only for the BOs on the BO-list. E.g. per VM BOs are never handled here.Regards,
Christian.Quoted 32 lines
Regards,
David ZhouQuoted 27 lines
Regards,
Christian.Quoted 22 lines
Regards,
David ZhouQuoted 19 lines
- clear =
bo_va->base.bo->tbo.resv!=vm->root.base.bo->tbo.resv;
+ if (resv ==vm->root.base.bo->tbo.resv)
+ clear = false;
+ /* Try to reserve the BO to avoid clearing its ptes */ + else if (reservation_object_trylock(resv))
+ clear = false;
+ /* Somebody else is using the BO right now */ + else
+ clear = true;
r =amdgpu_vm_bo_update(adev, bo_va, clear); if (r)
return r;
+ if (!clear && resv !=vm->root.base.bo->tbo.resv)
+reservation_object_unlock(resv);
+spin_lock(&vm->status_lock);
}spin_unlock(&vm->status_lock);
Quoted 4 lines
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amdgpu: update VM PDs after the PTs
In reply to a message not in the archiveNecessary for the next patch.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -4
@@ -778,10 +778,6 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p)struct amdgpu_bo *bo;int i, r; - r =amdgpu_vm_update_directories (adev, vm); -if (r) -return r; - r =amdgpu_vm_clear_freed (adev, vm,NULL );if (r)return r;
@@ -839,6 +835,10 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p)if (r)return r; + r =amdgpu_vm_update_directories (adev, vm); +if (r) +return r; + r =amdgpu_sync_fence (adev, &p->job->sync, vm->last_update, false);if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -4
@@ -518,10 +518,6 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,if (!amdgpu_vm_ready (vm))return ; - r =amdgpu_vm_update_directories (adev, vm); -if (r) - goto error; - r =amdgpu_vm_clear_freed (adev, vm,NULL );if (r) goto error;
@@ -530,6 +526,10 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, operation == AMDGPU_VA_OP_REPLACE) r =amdgpu_vm_bo_update (adev, bo_va, false); + r =amdgpu_vm_update_directories (adev, vm); +if (r) + goto error; + error:if (r && r != -ERESTARTSYS )DRM_ERROR ("Couldn't update BO_VA (%d)\n" , r);
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amdgpu: simplify huge page handling
In reply to a message not in the archiveUpdate the PDEs after resetting the huge flag.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 60 ++++++++++------------------------ 1 file changed, 18 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +18 -42
@@ -946,54 +946,38 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, unsigned nptes, uint64_t dst, uint64_t flags) { - bool use_cpu_update = (p->func == amdgpu_vm_cpu_set_ptes); uint64_t pd_addr, pde;/* In the case of a mixed PT the PDE must point to it*/ -if (p->adev->asic_type <CHIP_VEGA10 || p->src || - nptes !=AMDGPU_VM_PTE_COUNT (p->adev)) { - dst =amdgpu_bo_gpu_offset (entry->base.bo); - flags =AMDGPU_PTE_VALID ; - }else { +if (p->adev->asic_type >=CHIP_VEGA10 && !p->src && + nptes ==AMDGPU_VM_PTE_COUNT (p->adev)) {/* Set the huge page flag to stop scanning at this PDE */ flags |=AMDGPU_PDE_PTE ; } -if (!entry->huge && !(flags &AMDGPU_PDE_PTE )) +if (!(flags &AMDGPU_PDE_PTE )) { +if (entry->huge) { +/* Add the entry to the relocated list to update it. */ + entry->huge = false; +spin_lock (&p->vm->status_lock); +list_move (&entry->base.vm_status, &p->vm->relocated); +spin_unlock (&p->vm->status_lock); + }return ; - entry->huge = !!(flags &AMDGPU_PDE_PTE ); + } + entry->huge = true;amdgpu_gart_get_vm_pde (p->adev,AMDGPU_VM_PDB0 , &dst, &flags); -if (use_cpu_update) { -/* In case a huge page is replaced with a system -* memory mapping, p->pages_addr != NULL and -* amdgpu_vm_cpu_set_ptes would try to translate dst -* through amdgpu_vm_map_gart. But dst is already a -* GPU address (of the page table). Disable -* amdgpu_vm_map_gart temporarily. -*/ -dma_addr_t *tmp; - - tmp = p->pages_addr; - p->pages_addr =NULL ; - - pd_addr = (unsigned long )amdgpu_bo_kptr (parent->base.bo); - pde = pd_addr + (entry - parent->entries) *8 ; -amdgpu_vm_cpu_set_ptes (p, pde, dst,1 ,0 , flags); - - p->pages_addr = tmp; - }else { -if (parent->base.bo->shadow) { - pd_addr =amdgpu_bo_gpu_offset (parent->base.bo->shadow); - pde = pd_addr + (entry - parent->entries) *8 ; -amdgpu_vm_do_set_ptes (p, pde, dst,1 ,0 , flags); - } - pd_addr =amdgpu_bo_gpu_offset (parent->base.bo); +if (parent->base.bo->shadow) { + pd_addr =amdgpu_bo_gpu_offset (parent->base.bo->shadow); pde = pd_addr + (entry - parent->entries) *8 ; -amdgpu_vm_do_set_ptes (p, pde, dst,1 ,0 , flags); + p->func (p, pde, dst,1 ,0 , flags); } + pd_addr =amdgpu_bo_gpu_offset (parent->base.bo); + pde = pd_addr + (entry - parent->entries) *8 ; + p->func (p, pde, dst,1 ,0 , flags); }/**
@@ -1205,12 +1189,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,/* padding, etc. */ ndw =64 ; -/* one PDE write for each huge page */ -if (vm->root.base.bo->shadow) - ndw += ((nptes >> adev->vm_manager.block_size) +1 ) *6 *2 ; -else - ndw += ((nptes >> adev->vm_manager.block_size) +1 ) *6 ; -if (pages_addr) {/* copy commands needed */ ndw += ncmds * adev->vm_manager.vm_pte_funcs->copy_pte_num_dw;
@@ -1285,8 +1263,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, error_free:amdgpu_job_free (job); -amdgpu_vm_invalidate_level (adev, vm, &vm->root, - adev->vm_manager.root_level);return r; }
Signature · 6 lines
2.11.0 _______________________________________________ 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): 20180102144715.4278-4-christian.koenig-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 4/4] drm/amdgpu: simplify huge page handling
[+Kent, Yong, Harish]
This means updating page tables can invalidate page directories. You prepared amdgpu_cs for this. On our amd-kfd-staging branch amdgpu_amdkfd_gpuvm.c we will need an equivalent change when we pick up this patch.
Currently we update page directories in vm_validate_pt_pd_bos. We'll have to split page directory update out of this function and invoke it separately after any page table updates.
The series is Acked-by: Felix Kuehling <[email protected]>
Regards,
Felix
Quoted 98 lines · Christian König
Update the PDEs after resetting the huge flag.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 60 ++++++++++------------------------ 1 file changed, 18 insertions(+), 42 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +18
-40@@ -946,54 +946,38 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, unsigned nptes, uint64_t dst, uint64_t flags) { - bool use_cpu_update = (p->func == amdgpu_vm_cpu_set_ptes); uint64_t pd_addr, pde;/* In the case of a mixed PT the PDE must point to it*/ -if (p->adev->asic_type <CHIP_VEGA10 || p->src || - nptes !=AMDGPU_VM_PTE_COUNT (p->adev)) { - dst =amdgpu_bo_gpu_offset (entry->base.bo); - flags =AMDGPU_PTE_VALID ; - }else { +if (p->adev->asic_type >=CHIP_VEGA10 && !p->src && + nptes ==AMDGPU_VM_PTE_COUNT (p->adev)) {/* Set the huge page flag to stop scanning at this PDE */ flags |=AMDGPU_PDE_PTE ; } -if (!entry->huge && !(flags &AMDGPU_PDE_PTE )) +if (!(flags &AMDGPU_PDE_PTE )) { +if (entry->huge) { +/* Add the entry to the relocated list to update it. */ + entry->huge = false; +spin_lock (&p->vm->status_lock); +list_move (&entry->base.vm_status, &p->vm->relocated); +spin_unlock (&p->vm->status_lock); + }return ; - entry->huge = !!(flags &AMDGPU_PDE_PTE ); + } + entry->huge = true;amdgpu_gart_get_vm_pde (p->adev,AMDGPU_VM_PDB0 , &dst, &flags); -if (use_cpu_update) { -/* In case a huge page is replaced with a system -* memory mapping, p->pages_addr != NULL and -* amdgpu_vm_cpu_set_ptes would try to translate dst -* through amdgpu_vm_map_gart. But dst is already a -* GPU address (of the page table). Disable -* amdgpu_vm_map_gart temporarily. -*/ -dma_addr_t *tmp; - - tmp = p->pages_addr; - p->pages_addr =NULL ; - - pd_addr = (unsigned long )amdgpu_bo_kptr (parent->base.bo); - pde = pd_addr + (entry - parent->entries) *8 ; -amdgpu_vm_cpu_set_ptes (p, pde, dst,1 ,0 , flags); - - p->pages_addr = tmp; - }else { -if (parent->base.bo->shadow) { - pd_addr =amdgpu_bo_gpu_offset (parent->base.bo->shadow); - pde = pd_addr + (entry - parent->entries) *8 ; -amdgpu_vm_do_set_ptes (p, pde, dst,1 ,0 , flags); - } - pd_addr =amdgpu_bo_gpu_offset (parent->base.bo); +if (parent->base.bo->shadow) { + pd_addr =amdgpu_bo_gpu_offset (parent->base.bo->shadow); pde = pd_addr + (entry - parent->entries) *8 ; -amdgpu_vm_do_set_ptes (p, pde, dst,1 ,0 , flags); + p->func (p, pde, dst,1 ,0 , flags); } + pd_addr =amdgpu_bo_gpu_offset (parent->base.bo); + pde = pd_addr + (entry - parent->entries) *8 ; + p->func (p, pde, dst,1 ,0 , flags); }/** @@ -1205,12 +1189,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,/* padding, etc. */ ndw =64 ; -/* one PDE write for each huge page */ -if (vm->root.base.bo->shadow) - ndw += ((nptes >> adev->vm_manager.block_size) +1 ) *6 *2 ; -else - ndw += ((nptes >> adev->vm_manager.block_size) +1 ) *6 ; -if (pages_addr) {/* copy commands needed */ ndw += ncmds * adev->vm_manager.vm_pte_funcs->copy_pte_num_dw;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, · line 1268
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-2@@ -1285,8 +1263,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, error_free:amdgpu_job_free (job); -amdgpu_vm_invalidate_level (adev, vm, &vm->root, - adev->vm_manager.root_level);return r; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 4/4] drm/amdgpu: simplify huge page handling
In reply to a message not in the archiveQuoted 85 lines · Christian König
Update the PDEs after resetting the huge flag.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 60 ++++++++++------------------------ 1 file changed, 18 insertions(+), 42 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +18
-34@@ -946,54 +946,38 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, unsigned nptes, uint64_t dst, uint64_t flags) { - bool use_cpu_update = (p->func == amdgpu_vm_cpu_set_ptes); uint64_t pd_addr, pde;/* In the case of a mixed PT the PDE must point to it*/ -if (p->adev->asic_type <CHIP_VEGA10 || p->src || - nptes !=AMDGPU_VM_PTE_COUNT (p->adev)) { - dst =amdgpu_bo_gpu_offset (entry->base.bo); - flags =AMDGPU_PTE_VALID ; - }else { +if (p->adev->asic_type >=CHIP_VEGA10 && !p->src && + nptes ==AMDGPU_VM_PTE_COUNT (p->adev)) {/* Set the huge page flag to stop scanning at this PDE */ flags |=AMDGPU_PDE_PTE ; } -if (!entry->huge && !(flags &AMDGPU_PDE_PTE )) +if (!(flags &AMDGPU_PDE_PTE )) { +if (entry->huge) { +/* Add the entry to the relocated list to update it. */ + entry->huge = false; +spin_lock (&p->vm->status_lock); +list_move (&entry->base.vm_status, &p->vm->relocated); +spin_unlock (&p->vm->status_lock); + }return ; - entry->huge = !!(flags &AMDGPU_PDE_PTE ); + } + entry->huge = true;amdgpu_gart_get_vm_pde (p->adev,AMDGPU_VM_PDB0 , &dst, &flags); -if (use_cpu_update) { -/* In case a huge page is replaced with a system -* memory mapping, p->pages_addr != NULL and -* amdgpu_vm_cpu_set_ptes would try to translate dst -* through amdgpu_vm_map_gart. But dst is already a -* GPU address (of the page table). Disable -* amdgpu_vm_map_gart temporarily. -*/ -dma_addr_t *tmp; - - tmp = p->pages_addr; - p->pages_addr =NULL ; - - pd_addr = (unsigned long )amdgpu_bo_kptr (parent->base.bo); - pde = pd_addr + (entry - parent->entries) *8 ; -amdgpu_vm_cpu_set_ptes (p, pde, dst,1 ,0 , flags); - - p->pages_addr = tmp; - }else { -if (parent->base.bo->shadow) { - pd_addr =amdgpu_bo_gpu_offset (parent->base.bo->shadow); - pde = pd_addr + (entry - parent->entries) *8 ; -amdgpu_vm_do_set_ptes (p, pde, dst,1 ,0 , flags); - } - pd_addr =amdgpu_bo_gpu_offset (parent->base.bo); +if (parent->base.bo->shadow) { + pd_addr =amdgpu_bo_gpu_offset (parent->base.bo->shadow); pde = pd_addr + (entry - parent->entries) *8 ; -amdgpu_vm_do_set_ptes (p, pde, dst,1 ,0 , flags); + p->func (p, pde, dst,1 ,0 , flags); } + pd_addr =amdgpu_bo_gpu_offset (parent->base.bo); + pde = pd_addr + (entry - parent->entries) *8 ; + p->func (p, pde, dst,1 ,0 , flags); }/**
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, · line 1212
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-5@@ -1205,12 +1189,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,/* padding, etc. */ ndw =64 ; -/* one PDE write for each huge page */ -if (vm->root.base.bo->shadow) - ndw += ((nptes >> adev->vm_manager.block_size) +1 ) *6 *2 ; -else - ndw += ((nptes >> adev->vm_manager.block_size) +1 ) *6 ;
I didn't get why removing this, although you put updating PDE after huge flag resets, for huge flag no-reset case, we still do huge page PDE update, don't we?
Regards,
David Zhou
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, · line 1268
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-3-if (pages_addr) {/* copy commands needed */ ndw += ncmds * adev->vm_manager.vm_pte_funcs->copy_pte_num_dw;@@ -1285,8 +1263,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, error_free:amdgpu_job_free (job); -amdgpu_vm_invalidate_level (adev, vm, &vm->root, - adev->vm_manager.root_level);return r; }
_______________________________________________
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): 86cb7e87-a6b3-1fc2-aa96-b39e7bee9a29-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 4/4] drm/amdgpu: simplify huge page handling
Am 03.01.2018 um 09:29 schrieb Chunming Zhou:
Quoted 86 lines · Christian König
Quoted 83 lines
Update the PDEs after resetting the huge flag.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 60
++++++++++------------------------1 file changed, 18 insertions(+), 42 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +17
-32@@ -946,54 +946,38 @@ static void amdgpu_vm_handle_huge_pages(structamdgpu_pte_update_params *p, unsigned nptes, uint64_t dst, uint64_t flags) { - bool use_cpu_update = (p->func == amdgpu_vm_cpu_set_ptes); uint64_t pd_addr, pde; /* In the case of a mixed PT the PDE must point to it*/ - if (p->adev->asic_type < CHIP_VEGA10 || p->src || - nptes != AMDGPU_VM_PTE_COUNT(p->adev)) { - dst = amdgpu_bo_gpu_offset(entry->base.bo); - flags = AMDGPU_PTE_VALID; - } else { + if (p->adev->asic_type >= CHIP_VEGA10 && !p->src && + nptes == AMDGPU_VM_PTE_COUNT(p->adev)) { /* Set the huge page flag to stop scanning at this PDE */ flags |= AMDGPU_PDE_PTE; } - if (!entry->huge && !(flags & AMDGPU_PDE_PTE)) + if (!(flags & AMDGPU_PDE_PTE)) { + if (entry->huge) { + /* Add the entry to the relocated list to update it. */ + entry->huge = false; + spin_lock(&p->vm->status_lock); + list_move(&entry->base.vm_status, &p->vm->relocated); + spin_unlock(&p->vm->status_lock); + } return; - entry->huge = !!(flags & AMDGPU_PDE_PTE); + } + entry->huge = true; amdgpu_gart_get_vm_pde(p->adev, AMDGPU_VM_PDB0, &dst, &flags); - if (use_cpu_update) { - /* In case a huge page is replaced with a system - * memory mapping, p->pages_addr != NULL and - * amdgpu_vm_cpu_set_ptes would try to translate dst - * through amdgpu_vm_map_gart. But dst is already a - * GPU address (of the page table). Disable - * amdgpu_vm_map_gart temporarily. - */ - dma_addr_t *tmp; - - tmp = p->pages_addr; - p->pages_addr = NULL; - - pd_addr = (unsigned long)amdgpu_bo_kptr(parent->base.bo); - pde = pd_addr + (entry - parent->entries) * 8; - amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags); - - p->pages_addr = tmp; - } else { - if (parent->base.bo->shadow) { - pd_addr = amdgpu_bo_gpu_offset(parent->base.bo->shadow); - pde = pd_addr + (entry - parent->entries) * 8; - amdgpu_vm_do_set_ptes(p, pde, dst, 1, 0, flags); - } - pd_addr = amdgpu_bo_gpu_offset(parent->base.bo); + if (parent->base.bo->shadow) { + pd_addr = amdgpu_bo_gpu_offset(parent->base.bo->shadow); pde = pd_addr + (entry - parent->entries) * 8; - amdgpu_vm_do_set_ptes(p, pde, dst, 1, 0, flags); + p->func(p, pde, dst, 1, 0, flags); } + pd_addr = amdgpu_bo_gpu_offset(parent->base.bo); + pde = pd_addr + (entry - parent->entries) * 8; + p->func(p, pde, dst, 1, 0, flags); } /**@@ -1205,12 +1189,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0/* padding, etc. */ ndw = 64;- /* one PDE write for each huge page */
- if (vm->root.base.bo->shadow)
- ndw += ((nptes >>adev->vm_manager.block_size) + 1) * 6 * 2; - else
- ndw += ((nptes >>adev->vm_manager.block_size) + 1) * 6;I didn't get why removing this, although you put updating PDE after huge flag resets, for huge flag no-reset case, we still do huge page PDE update, don't we?
Yeah, but we don't update the PTEs any more. So we have plenty of free space in the IB for the PDE update.
Regards,
Christian.
Quoted 16 lines
Regards,
David ZhouQuoted 6 lines
-
if (pages_addr) {
/* copy commands needed */
ndw += ncmds *adev->vm_manager.vm_pte_funcs->copy_pte_num_dw;drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0@@ -1285,8 +1263,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,Quoted 6 lines
error_free:
amdgpu_job_free(job);
-amdgpu_vm_invalidate_level(adev, vm, &vm->root, - adev->vm_manager.root_level); return r;
}
_______________________________________________
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): e862ce53-a99b-a5e6-2ef4-87420f720d83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 4/4] drm/amdgpu: simplify huge page handling
Quoted 96 lines · Christian König
Am 03.01.2018 um 09:29 schrieb Chunming Zhou:
Quoted 86 lines · Christian König
Quoted 83 lines
Update the PDEs after resetting the huge flag.
Signed-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 60
++++++++++------------------------1 file changed, 18 insertions(+), 42 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +17
-32@@ -946,54 +946,38 @@ static void amdgpu_vm_handle_huge_pages(structamdgpu_pte_update_params *p, unsigned nptes, uint64_t dst, uint64_t flags) { - bool use_cpu_update = (p->func == amdgpu_vm_cpu_set_ptes); uint64_t pd_addr, pde; /* In the case of a mixed PT the PDE must point to it*/ - if (p->adev->asic_type < CHIP_VEGA10 || p->src || - nptes != AMDGPU_VM_PTE_COUNT(p->adev)) { - dst = amdgpu_bo_gpu_offset(entry->base.bo); - flags = AMDGPU_PTE_VALID; - } else { + if (p->adev->asic_type >= CHIP_VEGA10 && !p->src && + nptes == AMDGPU_VM_PTE_COUNT(p->adev)) { /* Set the huge page flag to stop scanning at this PDE */ flags |= AMDGPU_PDE_PTE; } - if (!entry->huge && !(flags & AMDGPU_PDE_PTE)) + if (!(flags & AMDGPU_PDE_PTE)) { + if (entry->huge) { + /* Add the entry to the relocated list to update it. */ + entry->huge = false; + spin_lock(&p->vm->status_lock); + list_move(&entry->base.vm_status, &p->vm->relocated); + spin_unlock(&p->vm->status_lock); + } return; - entry->huge = !!(flags & AMDGPU_PDE_PTE); + } + entry->huge = true; amdgpu_gart_get_vm_pde(p->adev, AMDGPU_VM_PDB0, &dst, &flags); - if (use_cpu_update) { - /* In case a huge page is replaced with a system - * memory mapping, p->pages_addr != NULL and - * amdgpu_vm_cpu_set_ptes would try to translate dst - * through amdgpu_vm_map_gart. But dst is already a - * GPU address (of the page table). Disable - * amdgpu_vm_map_gart temporarily. - */ - dma_addr_t *tmp; - - tmp = p->pages_addr; - p->pages_addr = NULL; - - pd_addr = (unsigned long)amdgpu_bo_kptr(parent->base.bo); - pde = pd_addr + (entry - parent->entries) * 8; - amdgpu_vm_cpu_set_ptes(p, pde, dst, 1, 0, flags); - - p->pages_addr = tmp; - } else { - if (parent->base.bo->shadow) { - pd_addr = amdgpu_bo_gpu_offset(parent->base.bo->shadow); - pde = pd_addr + (entry - parent->entries) * 8; - amdgpu_vm_do_set_ptes(p, pde, dst, 1, 0, flags); - } - pd_addr = amdgpu_bo_gpu_offset(parent->base.bo); + if (parent->base.bo->shadow) { + pd_addr = amdgpu_bo_gpu_offset(parent->base.bo->shadow); pde = pd_addr + (entry - parent->entries) * 8; - amdgpu_vm_do_set_ptes(p, pde, dst, 1, 0, flags); + p->func(p, pde, dst, 1, 0, flags); } + pd_addr = amdgpu_bo_gpu_offset(parent->base.bo); + pde = pd_addr + (entry - parent->entries) * 8; + p->func(p, pde, dst, 1, 0, flags); } /**@@ -1205,12 +1189,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0/* padding, etc. */ ndw = 64;- /* one PDE write for each huge page */
- if (vm->root.base.bo->shadow)
- ndw += ((nptes >>adev->vm_manager.block_size) + 1) * 6 * 2; - else
- ndw += ((nptes >>adev->vm_manager.block_size) + 1) * 6;I didn't get why removing this, although you put updating PDE after huge flag resets, for huge flag no-reset case, we still do huge page PDE update, don't we?
Quoted 1 line
Yeah, but we don't update the PTEs any more. So we have plenty of free space in the IB for the PDE update.
OK, got it, thanks for explain.
patch#3 and #4 are Reviewed-by: Chunming Zhou <[email protected]>
Quoted 21 lines
Regards,
Christian.Quoted 16 lines
Regards,
David ZhouQuoted 12 lines
-
if (pages_addr) {
/* copy commands needed */
ndw += ncmds *adev->vm_manager.vm_pte_funcs->copy_pte_num_dw;drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0@@ -1285,8 +1263,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
error_free:
amdgpu_job_free(job);
-amdgpu_vm_invalidate_level(adev, vm, &vm->root, - adev->vm_manager.root_level); return r;
}
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Chunming Zhou
Reviewed-byQuoted 1 line · Christian König
We can actually handle invalid huge pages perfectly fine now.
It seems be a bug fix for those valid no-huge-page ptes.
Quoted 14 lines
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0@@ -950,11 +950,8 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p,uint64_t pd_addr, pde;/* In the case of a mixed PT the PDE must point to it*/
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p, · line 957
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-5-if (p->adev->asic_type <CHIP_VEGA10 || - nptes !=AMDGPU_VM_PTE_COUNT (p->adev) || - p->src || - !(flags &AMDGPU_PTE_VALID )) { - +if (p->adev->asic_type <CHIP_VEGA10 || p->src || + nptes !=AMDGPU_VM_PTE_COUNT (p->adev)) { dst =amdgpu_bo_gpu_offset (entry->base.bo); flags =AMDGPU_PTE_VALID ; }else {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx