All of lore.kernel.org
 help / color / mirror / Atom feed
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 1/5] drm/amdgpu: rework moved handling in the VM v2
Date: Tue, 29 Aug 2017 10:13:37 +0800	[thread overview]
Message-ID: <0ef1de49-f2e6-2fac-2931-ce1c851b8112@amd.com> (raw)
In-Reply-To: <1503946244-1535-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>

Hi Christian,

I asked you how you keep the access of base.moved is safely in last 
thread, I check it just now, it depends on the shared resv lock.

For patch itself, Reviewed-by: Chunming Zhou <david1.zhou@amd.com>

another question comes up to me, I find most of all vm lists are 
protected by the shared resv lock, whether the status lock can be 
removed as well? seems everything of vm is protected by that big resv lock.

Regards,
David Zhou

On 2017年08月29日 02:50, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
>
> Instead of using the vm_state use a separate flag to note
> that the BO was moved.
>
> v2: reorder patches to avoid temporary lockless access
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 13 ++++++++++---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h |  3 +++
>   2 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index f621dba..ee53293 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1787,10 +1787,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
>   	else
>   		flags = 0x0;
>   
> -	spin_lock(&vm->status_lock);
> -	if (!list_empty(&bo_va->base.vm_status))
> +	if (!clear && bo_va->base.moved) {
> +		bo_va->base.moved = false;
>   		list_splice_init(&bo_va->valids, &bo_va->invalids);
> -	spin_unlock(&vm->status_lock);
> +
> +	} 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);
> +	}
>   
>   	list_for_each_entry(mapping, &bo_va->invalids, list) {
>   		r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm,
> @@ -2418,6 +2424,7 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
>   	struct amdgpu_vm_bo_base *bo_base;
>   
>   	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,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 9347d28..1b478e6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -105,6 +105,9 @@ struct amdgpu_vm_bo_base {
>   
>   	/* protected by spinlock */
>   	struct list_head		vm_status;
> +
> +	/* protected by the BO being reserved */
> +	bool				moved;
>   };
>   
>   struct amdgpu_vm_pt {

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-08-29  2:13 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
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   ` zhoucm1 [this message]
     [not found]     ` <0ef1de49-f2e6-2fac-2931-ce1c851b8112-5C7GfCeVMHo@public.gmane.org>
2017-08-29 12:51       ` [PATCH 1/5] drm/amdgpu: rework moved handling in the VM v2 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=0ef1de49-f2e6-2fac-2931-ce1c851b8112@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.