All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Jerry(Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
	<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 4/8] drm/amdgpu: use the DFS iterator in amdgpu_vm_invalidate_pds v2
Date: Thu, 13 Sep 2018 10:52:32 +0800	[thread overview]
Message-ID: <8c8ca049-00e8-f77f-5c95-afedaa866e79@amd.com> (raw)
In-Reply-To: <20180912085445.3245-4-christian.koenig-5C7GfCeVMHo@public.gmane.org>

On 09/12/2018 04:54 PM, Christian König wrote:
> Less code and easier to maintain.
>
> v2: rename the function as well
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 32 ++++++++------------------------
>   1 file changed, 8 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index a0a30416a490..c0c97b1425fa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1370,37 +1370,22 @@ static void amdgpu_vm_update_pde(struct amdgpu_pte_update_params *params,
>   }
>   
>   /*
> - * amdgpu_vm_invalidate_level - mark all PD levels as invalid
> + * amdgpu_vm_invalidate_pds - mark all PDs as invalid
>    *
>    * @adev: amdgpu_device pointer
>    * @vm: related vm
> - * @parent: parent PD
> - * @level: VMPT level
>    *
>    * Mark all PD level as invalid after an error.
>    */
> -static void amdgpu_vm_invalidate_level(struct amdgpu_device *adev,
> -				       struct amdgpu_vm *vm,
> -				       struct amdgpu_vm_pt *parent,
> -				       unsigned level)
> +static void amdgpu_vm_invalidate_pds(struct amdgpu_device *adev,
> +				     struct amdgpu_vm *vm)
>   {
> -	unsigned pt_idx, num_entries;
> -
> -	/*
> -	 * Recurse into the subdirectories. This recursion is harmless because
> -	 * we only have a maximum of 5 layers.
> -	 */
> -	num_entries = amdgpu_vm_num_entries(adev, level);
> -	for (pt_idx = 0; pt_idx < num_entries; ++pt_idx) {
> -		struct amdgpu_vm_pt *entry = &parent->entries[pt_idx];
> -
> -		if (!entry->base.bo)
> -			continue;
> +	struct amdgpu_vm_pt_cursor cursor;
> +	struct amdgpu_vm_pt *entry;
>   
> -		if (!entry->base.moved)
> +	for_each_amdgpu_vm_pt_dfs_safe(adev, vm, cursor, entry)
> +		if (entry->base.bo && !entry->base.moved)
>   			amdgpu_vm_bo_relocated(&entry->base);
> -		amdgpu_vm_invalidate_level(adev, vm, entry, level + 1);
> -	}
>   }
>   
>   /*
> @@ -1497,8 +1482,7 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev,
>   	return 0;
>   
>   error:
> -	amdgpu_vm_invalidate_level(adev, vm, &vm->root,
> -				   adev->vm_manager.root_level);
> +	amdgpu_vm_invalidate_pds(adev, vm);
>   	amdgpu_job_free(job);
>   	return r;
>   }

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

  parent reply	other threads:[~2018-09-13  2:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12  8:54 [PATCH 1/8] drm/amdgpu: add some VM PD/PT iterators v2 Christian König
     [not found] ` <20180912085445.3245-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-09-12  8:54   ` [PATCH 2/8] drm/amdgpu: use leaf iterator for allocating PD/PT Christian König
2018-09-12  8:54   ` [PATCH 3/8] drm/amdgpu: use dfs iterator to free PDs/PTs Christian König
2018-09-12  8:54   ` [PATCH 4/8] drm/amdgpu: use the DFS iterator in amdgpu_vm_invalidate_pds v2 Christian König
     [not found]     ` <20180912085445.3245-4-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-09-13  2:52       ` Zhang, Jerry(Junwei) [this message]
2018-09-12  8:54   ` [PATCH 5/8] drm/amdgpu: use leaf iterator for filling PTs Christian König
2018-09-12  8:54   ` [PATCH 6/8] drm/amdgpu: meld together VM fragment and huge page handling Christian König
     [not found]     ` <20180912085445.3245-6-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-11-08 16:17       ` Samuel Pitoiset
     [not found]         ` <cd923303-6208-3593-74fe-0d9e7b83c12c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-11-08 16:50           ` Christian König
     [not found]             ` <f2d67c06-063f-6441-0699-1ab283a99f6c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-11-08 19:35               ` Samuel Pitoiset
     [not found]                 ` <363ce01b-c6f1-21bc-329e-bbb4ec568ba8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-11-09 12:13                   ` Koenig, Christian
     [not found]                     ` <c4ffbce4-5225-dfc1-8056-2575b6bbdd9c-5C7GfCeVMHo@public.gmane.org>
2018-11-12 15:16                       ` Christian König
2018-09-12  8:54   ` [PATCH 7/8] drm/amdgpu: use the maximum possible fragment size on Vega/Raven Christian König
2018-09-12  8:54   ` [PATCH 8/8] drm/amdgpu: allow fragment processing for invalid PTEs Christian König
2018-09-12 23:12   ` [PATCH 1/8] drm/amdgpu: add some VM PD/PT iterators v2 Felix Kuehling
2018-09-13  2:51   ` Zhang, Jerry(Junwei)
2018-09-13  6:58   ` Huang Rui

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=8c8ca049-00e8-f77f-5c95-afedaa866e79@amd.com \
    --to=jerry.zhang-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@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.