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 06/19] drm/amdgpu: implement vm recovery function from shadow
Date: Thu, 11 Aug 2016 16:42:05 +0800 [thread overview]
Message-ID: <57AC3A5D.4000906@amd.com> (raw)
In-Reply-To: <17dc9ee4-35d0-3e20-8402-15524e667327-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
On 2016年08月11日 16:39, Christian König wrote:
> Am 05.08.2016 um 11:38 schrieb Chunming Zhou:
>> Change-Id: I46783043eecbe9fc9c2ce9230be1085aca3731bd
>> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 +++
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 48
>> ++++++++++++++++++++++++++++++++++
>> 2 files changed, 52 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index 53b7039..9cb6fda 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -921,6 +921,8 @@ struct amdgpu_vm {
>> /* client id */
>> u64 client_id;
>> +
>> + struct fence *shadow_sync_fence;
>> };
>> struct amdgpu_vm_id {
>> @@ -1011,6 +1013,8 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
>> uint64_t addr);
>> void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
>> struct amdgpu_bo_va *bo_va);
>> +int amdgpu_vm_recover_page_table_from_shadow(struct amdgpu_device
>> *adev,
>> + struct amdgpu_vm *vm);
>> /*
>> * context related structures
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> index 017274c..e6576c2 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> @@ -702,6 +702,52 @@ error_free:
>> return r;
>> }
>> +int amdgpu_vm_recover_page_table_from_shadow(struct amdgpu_device
>> *adev,
>> + struct amdgpu_vm *vm)
>> +{
>> + struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
>> + struct fence *fence;
>> + uint64_t pt_idx;
>> + int r;
>> +
>> + if (!vm->page_directory->shadow)
>> + return 0;
>> +
>> + r = amdgpu_bo_reserve(vm->page_directory, false);
>> + if (r)
>> + return r;
>
> I think that the caller should reserve the BOs here.
>
> Especially during CS we only want to reserve everything once.
This function is called in gpu reset, not in cs ioctl.
>
> BTW: How do we handle swapping the PD/PTs in and out?
>
> E.g. we don't need to copy them from VRAM to GART any more.
Yes, we only need to copy from GART to VRAM when gpu reset.
Regards,
David Zhou
>
> Regards,
> Christian.
>
>> + vm->page_directory->shadow_flag =
>> AMDGPU_SHADOW_FLAG_SYNC_TO_PARENT;
>> + r = amdgpu_bo_sync_between_bo_and_shadow(adev, ring,
>> + vm->page_directory,
>> + NULL, &fence);
>> + if (r) {
>> + DRM_ERROR("recover page table failed!\n");
>> + goto err;
>> + }
>> + fence_put(vm->shadow_sync_fence);
>> + vm->shadow_sync_fence = fence_get(fence);
>> + fence_put(fence);
>> + for (pt_idx = 0; pt_idx <= vm->max_pde_used; ++pt_idx) {
>> + struct amdgpu_bo *bo = vm->page_tables[pt_idx].entry.robj;
>> +
>> + if (!bo)
>> + continue;
>> + bo->shadow_flag = AMDGPU_SHADOW_FLAG_SYNC_TO_PARENT;
>> + r = amdgpu_bo_sync_between_bo_and_shadow(adev, ring, bo,
>> + NULL, &fence);
>> + if (r) {
>> + DRM_ERROR("recover page table failed!\n");
>> + goto err;
>> + }
>> + fence_put(vm->shadow_sync_fence);
>> + vm->shadow_sync_fence = fence_get(fence);
>> + fence_put(fence);
>> + }
>> +
>> +err:
>> + amdgpu_bo_unreserve(vm->page_directory);
>> + return r;
>> +}
>> /**
>> * amdgpu_vm_frag_ptes - add fragment information to PTEs
>> *
>> @@ -1556,6 +1602,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev,
>> struct amdgpu_vm *vm)
>> if (r)
>> goto error_free_page_directory;
>> vm->last_eviction_counter = atomic64_read(&adev->num_evictions);
>> + vm->shadow_sync_fence = NULL;
>> return 0;
>> @@ -1604,6 +1651,7 @@ void amdgpu_vm_fini(struct amdgpu_device
>> *adev, struct amdgpu_vm *vm)
>> amdgpu_bo_unref(&vm->page_directory);
>> fence_put(vm->page_directory_fence);
>> + fence_put(vm->shadow_sync_fence);
>> }
>> /**
>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2016-08-11 8:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-05 9:38 [PATCH 00/19] shadow page table support V2 Chunming Zhou
[not found] ` <1470389926-5719-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-08-05 9:38 ` [PATCH 01/19] drm/amdgpu: add shadow bo support Chunming Zhou
2016-08-05 9:38 ` [PATCH 02/19] drm/amdgpu: validate shadow as well when validating bo Chunming Zhou
2016-08-05 9:38 ` [PATCH 03/19] drm/amdgpu: allocate shadow for pd/pt bo Chunming Zhou
2016-08-05 9:38 ` [PATCH 04/19] drm/amdgpu: add shadow flag Chunming Zhou
2016-08-05 9:38 ` [PATCH 05/19] drm/amdgpu: sync bo and shadow Chunming Zhou
2016-08-05 9:38 ` [PATCH 06/19] drm/amdgpu: implement vm recovery function from shadow Chunming Zhou
[not found] ` <1470389926-5719-7-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-08-11 8:39 ` Christian König
[not found] ` <17dc9ee4-35d0-3e20-8402-15524e667327-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-11 8:42 ` zhoucm1 [this message]
2016-08-05 9:38 ` [PATCH 07/19] drm/amdgpu: fix vm init error path Chunming Zhou
2016-08-05 9:38 ` [PATCH 08/19] drm/amdgpu: add shadow_entity for shadow page table updates Chunming Zhou
2016-08-05 9:38 ` [PATCH 09/19] drm/amdgpu: update pd shadow bo Chunming Zhou
2016-08-05 9:38 ` [PATCH 10/19] drm/amdgpu: update pt shadow Chunming Zhou
2016-08-05 9:38 ` [PATCH 11/19] drm/amd: add last fence in sched entity Chunming Zhou
2016-08-05 9:38 ` [PATCH 12/19] drm/amdgpu: link all vm clients Chunming Zhou
2016-08-05 9:38 ` [PATCH 13/19] drm/amdgpu: add vm_list_lock Chunming Zhou
2016-08-05 9:38 ` [PATCH 14/19] drm/amd: add block entity function Chunming Zhou
2016-08-05 9:38 ` [PATCH 15/19] drm/amdgpu: add shadow fence owner Chunming Zhou
2016-08-05 9:38 ` [PATCH 16/19] drm/amd: block entity Chunming Zhou
2016-08-05 9:38 ` [PATCH 17/19] drm/amdgpu: recover page tables after gpu reset Chunming Zhou
2016-08-05 9:38 ` [PATCH 18/19] drm/amdgpu: add need backup function Chunming Zhou
2016-08-05 9:38 ` [PATCH 19/19] drm/amdgpu: add backup condition for vm Chunming Zhou
2016-08-05 10:12 ` [PATCH 00/19] shadow page table support V2 Edward O'Callaghan
2016-08-08 11:04 ` Christian König
[not found] ` <9156b55f-8440-1003-6587-dc2e97a7a4cb-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-09 8:37 ` zhoucm1
2016-08-10 6:02 ` zhoucm1
[not found] ` <57AAC38B.7070101-5C7GfCeVMHo@public.gmane.org>
2016-08-10 11:14 ` Christian König
[not found] ` <ea9315d9-cbeb-c5ad-0589-04d04ce16f1e-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-10 21:19 ` Deucher, Alexander
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=57AC3A5D.4000906@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.