All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward O'Callaghan <funfunctor-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>
To: Chunming Zhou <David1.Zhou-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 05/11] drm/amdgpu: add vm recover entity
Date: Sat, 30 Jul 2016 13:51:57 +1000	[thread overview]
Message-ID: <dfe0d2d4-5d6c-7dfb-6e43-1f12f1883dce@folklore1984.net> (raw)
In-Reply-To: <1469700828-25650-6-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 4123 bytes --]



On 07/28/2016 08:13 PM, Chunming Zhou wrote:
> every vm uses itself recover entity to recovery page table from shadow.
> 
> Change-Id: I93e37666cb3fb511311c96ff172b6e9ebd337547
> Signed-off-by: Chunming Zhou <David1.Zhou-5C7GfCeVMHo@public.gmane.org>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h    |  3 ++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 ++++++++++++++-------
>  2 files changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 9f7fae0..98f631a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -911,7 +911,8 @@ struct amdgpu_vm {
>  
>  	/* Scheduler entity for page table updates */
>  	struct amd_sched_entity	entity;
> -
> +	struct amd_sched_entity	recover_entity;
> +	struct amdgpu_ring      *ring;
>  	/* client id */
>  	u64                     client_id;
>  
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 1d58577..6d2a28a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -714,13 +714,13 @@ error_free:
>  }
>  
>  static int amdgpu_vm_recover_bo_from_shadow(struct amdgpu_device *adev,
> +					    struct amdgpu_vm *vm,
>  					    struct amdgpu_bo *bo,
>  					    struct amdgpu_bo *bo_shadow,
>  					    struct reservation_object *resv,
>  					    struct fence **fence)
>  
>  {
> -	struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
>  	int r;
>  	uint64_t vram_addr, gtt_addr;
>  
> @@ -739,8 +739,8 @@ static int amdgpu_vm_recover_bo_from_shadow(struct amdgpu_device *adev,
>  	if (r)
>  		goto err3;
>  
> -	r = amdgpu_copy_buffer(ring, &adev->mman.entity, gtt_addr, vram_addr,
> -			       amdgpu_bo_size(bo), resv, fence);
> +	r = amdgpu_copy_buffer(vm->ring, &vm->recover_entity, gtt_addr,
> +			       vram_addr, amdgpu_bo_size(bo), resv, fence);
>  	if (!r)
>  		amdgpu_bo_fence(bo, *fence, true);
>  
> @@ -767,7 +767,7 @@ int amdgpu_vm_recover_page_table_from_shadow(struct amdgpu_device *adev,
>  	if (unlikely(r != 0))
>  		return r;
>  
> -	r = amdgpu_vm_recover_bo_from_shadow(adev, vm->page_directory,
> +	r = amdgpu_vm_recover_bo_from_shadow(adev, vm, vm->page_directory,
>  					     vm->page_directory->shadow,
>  					     NULL, &fence);

This is slightly out of scope from your patchsets intention however:

If we are passing 'vm' in now to 'amdgpu_vm_recover_bo_from_shadow()'
could we then perhaps do the dereferences to 'vm->page_directory' and
'vm->page_directory->shadow' in there?

>  	if (r) {
> @@ -784,7 +784,7 @@ int amdgpu_vm_recover_page_table_from_shadow(struct amdgpu_device *adev,
>  
>  		if (!bo || !bo_shadow)
>  			continue;
> -		r = amdgpu_vm_recover_bo_from_shadow(adev, bo, bo_shadow,
> +		r = amdgpu_vm_recover_bo_from_shadow(adev, vm, bo, bo_shadow,
>  						     NULL, &fence);
>  		if (r) {
>  			DRM_ERROR("recover page table failed!\n");
> @@ -1678,12 +1678,17 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
>  	ring_instance = atomic_inc_return(&adev->vm_manager.vm_pte_next_ring);
>  	ring_instance %= adev->vm_manager.vm_pte_num_rings;
>  	ring = adev->vm_manager.vm_pte_rings[ring_instance];
> +	rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_RECOVER];
> +	r = amd_sched_entity_init(&ring->sched, &vm->recover_entity,
> +				  rq, amdgpu_sched_jobs);
> +	if (r)
> +		goto err;
>  	rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_KERNEL];
>  	r = amd_sched_entity_init(&ring->sched, &vm->entity,
>  				  rq, amdgpu_sched_jobs);
>  	if (r)
> -		goto err;
> -
> +		goto err1;
> +	vm->ring = ring;
>  	vm->page_directory_fence = NULL;
>  
>  	r = amdgpu_bo_create(adev, pd_size, align, true,
> @@ -1725,6 +1730,8 @@ error_free_page_directory:
>  error_free_sched_entity:
>  	amd_sched_entity_fini(&ring->sched, &vm->entity);
>  
> +err1:
> +	amd_sched_entity_fini(&ring->sched, &vm->recover_entity);
>  err:
>  	drm_free_large(vm->page_tables);
>  
> 


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

  parent reply	other threads:[~2016-07-30  3:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28 10:13 [PATCH 00/11] add recovery entity Chunming Zhou
     [not found] ` <1469700828-25650-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-07-28 10:13   ` [PATCH 01/11] drm/amdgpu: hw ring should be empty when gpu reset Chunming Zhou
     [not found]     ` <1469700828-25650-2-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-07-30  3:53       ` Edward O'Callaghan
2016-07-28 10:13   ` [PATCH 02/11] drm/amdgpu: specify entity to amdgpu_copy_buffer Chunming Zhou
2016-07-28 10:13   ` [PATCH 03/11] drm/amd: add recover run queue for scheduler Chunming Zhou
     [not found]     ` <1469700828-25650-4-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-07-30  3:52       ` Edward O'Callaghan
2016-07-28 10:13   ` [PATCH 04/11] drm/amdgpu: fix vm init error path Chunming Zhou
     [not found]     ` <1469700828-25650-5-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-07-30  3:41       ` Edward O'Callaghan
     [not found]         ` <7115f9e7-3afd-a693-3e23-1ad4acb3c700-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>
2016-07-30  3:44           ` Edward O'Callaghan
2016-07-28 10:13   ` [PATCH 05/11] drm/amdgpu: add vm recover entity Chunming Zhou
     [not found]     ` <1469700828-25650-6-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-07-30  3:51       ` Edward O'Callaghan [this message]
2016-07-28 10:13   ` [PATCH 06/11] drm/amdgpu: use all pte rings to recover page table Chunming Zhou
2016-07-28 10:13   ` [PATCH 07/11] drm/amd: add recover entity for every scheduler Chunming Zhou
2016-07-28 10:13   ` [PATCH 08/11] drm/amd: use scheduler to recover hw jobs Chunming Zhou
2016-07-28 10:13   ` [PATCH 09/11] drm/amd: hw job list should be exact Chunming Zhou
     [not found]     ` <1469700828-25650-10-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-07-30  3:46       ` Edward O'Callaghan
2016-07-28 10:13   ` [PATCH 10/11] drm/amd: reset jobs to recover entity Chunming Zhou
2016-07-28 10:13   ` [PATCH 11/11] drm/amdgpu: no need fence wait every time Chunming Zhou
2016-08-02  2:06   ` [PATCH 00/11] add recovery entity zhoucm1
2016-08-03 13:43   ` Christian König
     [not found]     ` <233bde9b-f7ff-2697-1fd9-419d08f8f359-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-04  3:10       ` zhoucm1
     [not found]         ` <57A2B217.2010100-5C7GfCeVMHo@public.gmane.org>
2016-08-04  8:39           ` Christian König
     [not found]             ` <a8ade743-309a-6982-7bad-a7c5648bd5e2-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-04  9:04               ` zhoucm1
2016-08-04  9:04               ` zhoucm1
2016-08-02  7:51 [PATCH 00/11] add recovery entity and run queue Chunming Zhou
     [not found] ` <1470124302-23615-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-08-02  7:51   ` [PATCH 05/11] drm/amdgpu: add vm recover entity Chunming Zhou

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=dfe0d2d4-5d6c-7dfb-6e43-1f12f1883dce@folklore1984.net \
    --to=funfunctor-dczkzgxz+bnupwh3paxdjq@public.gmane.org \
    --cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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.