From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
<deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/5] drm/amdgpu: add bo_va cleared flag again v2
Date: Tue, 29 Aug 2017 10:17:31 +0800 [thread overview]
Message-ID: <c405906a-394f-3e92-838f-498c3af2a2dd@amd.com> (raw)
In-Reply-To: <1503946244-1535-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
On 2017年08月29日 02:50, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
>
> We changed this to use an extra list a while back, but for the next
> series I need a separate flag again.
>
> v2: reorder to avoid unlocked list access
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 +++
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 35 +++++++++++-------------------
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ---
> 3 files changed, 16 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index a288fa6..e613ba4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -55,6 +55,9 @@ struct amdgpu_bo_va {
> /* mappings for this bo_va */
> struct list_head invalids;
> struct list_head valids;
> +
> + /* If the mappings are cleared or filled */
> + bool cleared;
> };
>
> struct amdgpu_bo {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index ee53293..85189f1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1791,11 +1791,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
> bo_va->base.moved = false;
> list_splice_init(&bo_va->valids, &bo_va->invalids);
>
> - } else {
> - spin_lock(&vm->status_lock);
> - if (!list_empty(&bo_va->base.vm_status))
> - list_splice_init(&bo_va->valids, &bo_va->invalids);
> - spin_unlock(&vm->status_lock);
> + } else if (bo_va->cleared != clear) {
> + list_splice_init(&bo_va->valids, &bo_va->invalids);
> }
>
> list_for_each_entry(mapping, &bo_va->invalids, list) {
> @@ -1806,25 +1803,22 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
> return r;
> }
>
> - if (trace_amdgpu_vm_bo_mapping_enabled()) {
> - list_for_each_entry(mapping, &bo_va->valids, list)
> - trace_amdgpu_vm_bo_mapping(mapping);
> -
> - list_for_each_entry(mapping, &bo_va->invalids, list)
> - trace_amdgpu_vm_bo_mapping(mapping);
> + if (vm->use_cpu_for_update) {
> + /* Flush HDP */
> + mb();
> + amdgpu_gart_flush_gpu_tlb(adev, 0);
> }
>
> spin_lock(&vm->status_lock);
> - list_splice_init(&bo_va->invalids, &bo_va->valids);
> list_del_init(&bo_va->base.vm_status);
> - if (clear)
> - list_add(&bo_va->base.vm_status, &vm->cleared);
> spin_unlock(&vm->status_lock);
>
> - if (vm->use_cpu_for_update) {
> - /* Flush HDP */
> - mb();
> - amdgpu_gart_flush_gpu_tlb(adev, 0);
> + list_splice_init(&bo_va->invalids, &bo_va->valids);
> + bo_va->cleared = clear;
> +
> + if (trace_amdgpu_vm_bo_mapping_enabled()) {
> + list_for_each_entry(mapping, &bo_va->valids, list)
> + trace_amdgpu_vm_bo_mapping(mapping);
> }
>
> return 0;
> @@ -2426,9 +2420,7 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
> list_for_each_entry(bo_base, &bo->va, bo_list) {
> bo_base->moved = true;
> spin_lock(&bo_base->vm->status_lock);
> - if (list_empty(&bo_base->vm_status))
> - list_add(&bo_base->vm_status,
> - &bo_base->vm->moved);
> + list_move(&bo_base->vm_status, &bo_base->vm->moved);
> spin_unlock(&bo_base->vm->status_lock);
> }
> }
> @@ -2515,7 +2507,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
> vm->reserved_vmid[i] = NULL;
> spin_lock_init(&vm->status_lock);
> INIT_LIST_HEAD(&vm->moved);
> - INIT_LIST_HEAD(&vm->cleared);
> INIT_LIST_HEAD(&vm->freed);
>
> /* create scheduler entity for page table updates */
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 1b478e6..ff093d4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -129,9 +129,6 @@ struct amdgpu_vm {
> /* BOs moved, but not yet updated in the PT */
> struct list_head moved;
>
> - /* BOs cleared in the PT because of a move */
> - struct list_head cleared;
> -
> /* BO mappings freed, but not yet updated in the PT */
> struct list_head freed;
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-08-29 2:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-28 18:50 [PATCH 1/5] drm/amdgpu: rework moved handling in the VM v2 Christian König
[not found] ` <1503946244-1535-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-08-28 18:50 ` [PATCH 2/5] drm/amdgpu: add bo_va cleared flag again v2 Christian König
[not found] ` <1503946244-1535-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-08-29 2:17 ` zhoucm1 [this message]
2017-08-28 18:50 ` [PATCH 3/5] drm/amdgpu: fix comment on amdgpu_bo_va Christian König
[not found] ` <1503946244-1535-3-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-08-29 2:19 ` zhoucm1
2017-08-28 18:50 ` [PATCH 4/5] drm/amdgpu: track evicted page tables v2 Christian König
[not found] ` <1503946244-1535-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-08-29 2:34 ` zhoucm1
2017-08-28 18:50 ` [PATCH 5/5] drm/amdgpu: rework page directory filling v2 Christian König
[not found] ` <1503946244-1535-5-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-08-29 2:55 ` zhoucm1
2017-08-29 2:13 ` [PATCH 1/5] drm/amdgpu: rework moved handling in the VM v2 zhoucm1
[not found] ` <0ef1de49-f2e6-2fac-2931-ce1c851b8112-5C7GfCeVMHo@public.gmane.org>
2017-08-29 12:51 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c405906a-394f-3e92-838f-498c3af2a2dd@amd.com \
--to=david1.zhou-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.