All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Das, Nirmoy" <Nirmoy.Das@amd.com>
To: "Koenig, Christian" <Christian.Koenig@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>
Subject: RE: [PATCH 2/7] drm/amdgpu: move shadow bo validation to VM code
Date: Wed, 26 May 2021 12:38:44 +0000	[thread overview]
Message-ID: <DM4PR12MB51366EE83B73E71272C7BB3E8B249@DM4PR12MB5136.namprd12.prod.outlook.com> (raw)
In-Reply-To: <b166ff2f-1b6f-6d51-db9e-50b15cdaac8a@amd.com>

[AMD Official Use Only]

Thanks Christian, I found some more issues as well, I will update and resend again.

-----Original Message-----
From: Koenig, Christian <Christian.Koenig@amd.com> 
Sent: Wednesday, May 26, 2021 2:03 PM
To: Das, Nirmoy <Nirmoy.Das@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
Subject: Re: [PATCH 2/7] drm/amdgpu: move shadow bo validation to VM code

Am 26.05.21 um 12:10 schrieb Nirmoy Das:
> Do the shadow bo validation in the VM code as VM code knows/owns 
> shadow BOs.
>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 23 ++++-------------------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |  5 +++++
>   2 files changed, 9 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 90136f9dedd6..f6a8f0c5a52f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -396,10 +396,10 @@ void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
>   	spin_unlock(&adev->mm_stats.lock);
>   }
>   
> -static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
> -				 struct amdgpu_bo *bo)
> +static int amdgpu_cs_bo_validate(void *param, struct amdgpu_bo *bo)
>   {
>   	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
> +	struct amdgpu_cs_parser *p = param;
>   	struct ttm_operation_ctx ctx = {
>   		.interruptible = true,
>   		.no_wait_gpu = false,
> @@ -451,21 +451,6 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
>   	return r;
>   }
>   
> -static int amdgpu_cs_validate(void *param, struct amdgpu_bo *bo) -{
> -	struct amdgpu_cs_parser *p = param;
> -	int r;
> -
> -	r = amdgpu_cs_bo_validate(p, bo);
> -	if (r)
> -		return r;
> -
> -	if (bo->shadow)
> -		r = amdgpu_cs_bo_validate(p, bo->shadow);
> -
> -	return r;
> -}
> -
>   static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
>   			    struct list_head *validated)
>   {
> @@ -493,7 +478,7 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
>   						     lobj->user_pages);
>   		}
>   
> -		r = amdgpu_cs_validate(p, bo);
> +		r = amdgpu_cs_bo_validate(p, bo);
>   		if (r)
>   			return r;
>   
> @@ -593,7 +578,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
>   	p->bytes_moved_vis = 0;
>   
>   	r = amdgpu_vm_validate_pt_bos(p->adev, &fpriv->vm,
> -				      amdgpu_cs_validate, p);
> +				      amdgpu_cs_bo_validate, p);
>   	if (r) {
>   		DRM_ERROR("amdgpu_vm_validate_pt_bos() failed.\n");
>   		goto error_validate;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index da155c276c51..f474f15ba344 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -696,6 +696,11 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>   		r = validate(param, bo);
>   		if (r)
>   			return r;
> +		if (bo->shadow) {
> +			r = validate(param, bo);

This needs to be "validate(param, bo->shadow)".

Apart from that looks good to me.

Christian.

> +			if (r)
> +				return r;
> +		}
>   
>   		if (bo->tbo.type != ttm_bo_type_kernel) {
>   			amdgpu_vm_bo_moved(bo_base);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-05-26 12:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 10:10 [PATCH 1/7] drm/amdgpu: add amdgpu_bo_vm bo type Nirmoy Das
2021-05-26 10:10 ` [PATCH 2/7] drm/amdgpu: move shadow bo validation to VM code Nirmoy Das
2021-05-26 12:02   ` Christian König
2021-05-26 12:38     ` Das, Nirmoy [this message]
2021-05-26 10:10 ` [PATCH 3/7] drm/amdgpu: use amdgpu_bo_vm for vm code Nirmoy Das
2021-05-26 12:39   ` Christian König
2021-05-26 10:10 ` [PATCH 4/7] drm/amdgpu: create shadow bo directly Nirmoy Das
2021-05-26 10:10 ` [PATCH 5/7] drm/amdgpu: switch to amdgpu_bo_vm for shadow pointer Nirmoy Das
2021-05-26 10:10 ` [PATCH 6/7] drm/amdgpu: remove unused code Nirmoy Das
2021-05-26 11:34   ` Das, Nirmoy
2021-05-26 10:10 ` [PATCH v2 7/7] drm/amdgpu: do not allocate entries separately Nirmoy Das
2021-05-26 12:01 ` [PATCH 1/7] drm/amdgpu: add amdgpu_bo_vm bo type 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=DM4PR12MB51366EE83B73E71272C7BB3E8B249@DM4PR12MB5136.namprd12.prod.outlook.com \
    --to=nirmoy.das@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --subject='RE: [PATCH 2/7] drm/amdgpu: move shadow bo validation to VM code' \
    /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

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.