drm/amdgpu: simplify bo_va list when vm bo update (v2)
Subsystems (2)
PATCH v2 1/1 drm/amdgpu: simplify bo_va list when vm bo update (v2)
v2: fix compiling warning
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +10 -12
@@ -1509,6 +1509,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,struct drm_mm_node *nodes;struct dma_fence *exclusive, **last_update;uint64_t flags; +uint32_t mem_type;int r;if (clear || !bo_va->base.bo) {
@@ -1561,19 +1562,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, }spin_lock (&vm->status_lock); -if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) { -unsigned mem_type = bo->tbo.mem.mem_type; +list_del_init (&bo_va->base.vm_status); -/* If the BO is not in its preferred location add it back to -* the evicted list so that it gets validated again on the -* next command submission. -*/ -list_del_init (&bo_va->base.vm_status); -if (!(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type))) -list_add_tail (&bo_va->base.vm_status, &vm->evicted); - }else { -list_del_init (&bo_va->base.vm_status); - } +/* If the BO is not in its preferred location add it back to +* the evicted list so that it gets validated again on the +* next command submission. +*/ + mem_type = bo->tbo.mem.mem_type; +if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv && + !(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type))) +list_add_tail (&bo_va->base.vm_status, &vm->evicted);spin_unlock (&vm->status_lock);list_splice_init (&bo_va->invalids, &bo_va->valids);
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): 1524120806-22986-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org
Am 19.04.2018 um 08:53 schrieb Junwei Zhang:
Quoted 34 lines
v2: fix compiling warning
Signed-off-by Junwei Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-9@@ -1509,6 +1509,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,struct drm_mm_node *nodes;struct dma_fence *exclusive, **last_update;uint64_t flags; +uint32_t mem_type;int r;if (clear || !bo_va->base.bo) {@@ -1561,19 +1562,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, }spin_lock (&vm->status_lock); -if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) { -unsigned mem_type = bo->tbo.mem.mem_type; +list_del_init (&bo_va->base.vm_status); -/* If the BO is not in its preferred location add it back to -* the evicted list so that it gets validated again on the -* next command submission. -*/ -list_del_init (&bo_va->base.vm_status); -if (!(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type))) -list_add_tail (&bo_va->base.vm_status, &vm->evicted);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1573
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +7
-3- }else { -list_del_init (&bo_va->base.vm_status); - } +/* If the BO is not in its preferred location add it back to +* the evicted list so that it gets validated again on the +* next command submission. +*/ + mem_type = bo->tbo.mem.mem_type; +if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv && + !(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type)))
The indentation on the line above is wrong, the "!(bo..." should be on the same column as the "bo &&" above.
Apart from that looks good to me,
Christian.
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1577
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0+list_add_tail (&bo_va->base.vm_status, &vm->evicted);spin_unlock (&vm->status_lock);list_splice_init (&bo_va->invalids, &bo_va->valids);
_______________________________________________
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): d18ea29d-4d53-0bad-aacd-3a839e016f80-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 38 lines · Christian König
Am 19.04.2018 um 08:53 schrieb Junwei Zhang:
Quoted 37 lines
v2: fix compiling warning
Signed-off-by Junwei Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4
-12@@ -1509,6 +1509,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,struct drm_mm_node *nodes;struct dma_fence *exclusive, **last_update;uint64_t flags; +uint32_t mem_type;int r;if (clear || !bo_va->base.bo) {@@ -1561,19 +1562,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, }spin_lock (&vm->status_lock); -if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) { -unsigned mem_type = bo->tbo.mem.mem_type; +list_del_init (&bo_va->base.vm_status); -/* If the BO is not in its preferred location add it back to -* the evicted list so that it gets validated again on the -* next command submission. -*/ -list_del_init (&bo_va->base.vm_status); -if (!(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type))) -list_add_tail (&bo_va->base.vm_status, &vm->evicted); - }else { -list_del_init (&bo_va->base.vm_status); - } +/* If the BO is not in its preferred location add it back to +* the evicted list so that it gets validated again on the
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1573
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-0+* next command submission. +*/ + mem_type = bo->tbo.mem.mem_type; +if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv && + !(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type)))The indentation on the line above is wrong, the "!(bo..." should be on the same column as the "bo &&" above.
Thanks to point that out.
May I get your RB with that fix?
Jerry
Quoted 8 lines
Apart from that looks good to me,
Christian.Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0+list_add_tail (&bo_va->base.vm_status, &vm->evicted);spin_unlock (&vm->status_lock);list_splice_init (&bo_va->invalids, &bo_va->valids);
_______________________________________________
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): [email protected]
Am 19.04.2018 um 09:40 schrieb Zhang, Jerry (Junwei):
Quoted 54 lines · Christian König
Quoted 42 lines
Am 19.04.2018 um 08:53 schrieb Junwei Zhang:
Quoted 41 lines
v2: fix compiling warning
Signed-off-by Junwei Zhang <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 22 ++++++++++------------1 file changed, 10 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-12@@ -1509,6 +1509,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct drm_mm_node *nodes; struct dma_fence *exclusive, **last_update; uint64_t flags; + uint32_t mem_type; int r; if (clear || !bo_va->base.bo) {@@ -1561,19 +1562,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, } spin_lock(&vm->status_lock); - if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) { - unsigned mem_type = bo->tbo.mem.mem_type; + list_del_init(&bo_va->base.vm_status); - /* If the BO is not in its preferred location add it back to - * the evicted list so that it gets validated again on the - * next command submission. - */ - list_del_init(&bo_va->base.vm_status); - if (!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type))) - list_add_tail(&bo_va->base.vm_status, &vm->evicted); - } else { - list_del_init(&bo_va->base.vm_status); - } + /* If the BO is not in its preferred location add it back to +* the evicted list so that it gets validated again on the +* next command submission. Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev,
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4
-0+*/ + mem_type = bo->tbo.mem.mem_type; + if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv && + !(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type)))The indentation on the line above is wrong, the "!(bo..." should be on the same column as the "bo &&" above.
Quoted 3 lines
Thanks to point that out.
May I get your RB with that fix?
Yeah, sure patch is Reviewed-by: Christian König <[email protected]>.
Christian.
Quoted 7 lines
Jerry
Quoted 4 lines
Apart from that looks good to me,
Christian.
Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1577
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0+list_add_tail (&bo_va->base.vm_status, &vm->evicted); spin_unlock(&vm->status_lock); list_splice_init(&bo_va->invalids, &bo_va->valids);_______________________________________________
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
A message that is not in the archive (sent off-list or not yet received): c6e733bb-cc43-357a-f7b6-29e6cf394b01-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 51 lines · Christian König
Am 19.04.2018 um 09:40 schrieb Zhang, Jerry (Junwei):
Quoted 50 lines · Christian König
Quoted 46 lines
Am 19.04.2018 um 08:53 schrieb Junwei Zhang:
Quoted 32 lines
v2: fix compiling warning
Signed-off-by Junwei Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-9@@ -1509,6 +1509,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,struct drm_mm_node *nodes;struct dma_fence *exclusive, **last_update;uint64_t flags; +uint32_t mem_type;int r;if (clear || !bo_va->base.bo) {@@ -1561,19 +1562,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, }spin_lock (&vm->status_lock); -if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) { -unsigned mem_type = bo->tbo.mem.mem_type; +list_del_init (&bo_va->base.vm_status); -/* If the BO is not in its preferred location add it back to -* the evicted list so that it gets validated again on the -* next command submission. -*/ -list_del_init (&bo_va->base.vm_status); -if (!(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type))) -list_add_tail (&bo_va->base.vm_status, &vm->evicted);drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1571
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +7
-3- }else { -list_del_init (&bo_va->base.vm_status); - } +/* If the BO is not in its preferred location add it back to +* the evicted list so that it gets validated again on the +* next command submission. +*/ + mem_type = bo->tbo.mem.mem_type; +if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv && + !(bo->preferred_domains &amdgpu_mem_type_to_domain (mem_type)))The indentation on the line above is wrong, the "!(bo..." should be on the same column as the "bo &&" above.
Quoted 5 lines
Quoted 3 lines
Thanks to point that out.
May I get your RB with that fix?
Yeah, sure patch is Reviewed-by: Christian König <[email protected]>.
Thanks, pushed.
Jerry
Quoted 19 lines
Christian.
Quoted 15 lines
Jerry
Quoted 8 lines
Apart from that looks good to me,
Christian.Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0+list_add_tail (&bo_va->base.vm_status, &vm->evicted);spin_unlock (&vm->status_lock);list_splice_init (&bo_va->invalids, &bo_va->valids);_______________________________________________
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