From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: "Zhang,
Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 5/6] drm/amdgpu: implement grab dedicated vmid V2
Date: Thu, 27 Apr 2017 12:42:10 +0800 [thread overview]
Message-ID: <590176A2.70304@amd.com> (raw)
In-Reply-To: <59015CD8.3000303-5C7GfCeVMHo@public.gmane.org>
On 2017年04月27日 10:52, Zhang, Jerry (Junwei) wrote:
> On 04/26/2017 07:10 PM, Chunming Zhou wrote:
>> v2: move sync waiting only when flush needs
>>
>> Change-Id: I64da2701c9fdcf986afb90ba1492a78d5bef1b6c
>> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 61
>> ++++++++++++++++++++++++++++++++++
>> 1 file changed, 61 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> index 214ac50..bce7701 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> @@ -402,6 +402,63 @@ static bool
>> amdgpu_vm_dedicated_vmid_ready(struct amdgpu_vm *vm, unsigned vmhub)
>> return !!vm->dedicated_vmid[vmhub];
>> }
>>
>> +static int amdgpu_vm_grab_dedicated_vmid(struct amdgpu_vm *vm,
>> + struct amdgpu_ring *ring,
>> + struct amdgpu_sync *sync,
>> + struct fence *fence,
>> + struct amdgpu_job *job)
>> +{
>> + struct amdgpu_device *adev = ring->adev;
>> + unsigned vmhub = ring->funcs->vmhub;
>> + struct amdgpu_vm_id *id = vm->dedicated_vmid[vmhub];
>> + struct amdgpu_vm_id_manager *id_mgr =
>> &adev->vm_manager.id_mgr[vmhub];
>> + struct fence *updates = sync->last_vm_update;
>> + int r = 0;
>> + struct fence *flushed, *tmp;
>> + bool needs_flush = false;
>> +
>> + mutex_lock(&id_mgr->lock);
>> + if (amdgpu_vm_had_gpu_reset(adev, id))
>> + needs_flush = true;
>> +
>> + flushed = id->flushed_updates;
>> + if (updates && (!flushed || updates->context != flushed->context ||
>> + fence_is_later(updates, flushed)))
>> + needs_flush = true;
>
> Just question:
> Do we need to consider concurrent flush for Vega10 like grab id func?
Christian has pointed that old asic has hardware bug.
Regards,
David Zhou
>
> Jerry
>
>> + if (needs_flush) {
>> + tmp = amdgpu_sync_get_fence(&id->active);
>> + if (tmp) {
>> + r = amdgpu_sync_fence(adev, sync, tmp);
>> + fence_put(tmp);
>> + mutex_unlock(&id_mgr->lock);
>> + return r;
>> + }
>> + }
>> +
>> + /* Good we can use this VMID. Remember this submission as
>> + * user of the VMID.
>> + */
>> + r = amdgpu_sync_fence(ring->adev, &id->active, fence);
>> + if (r)
>> + goto out;
>> +
>> + if (updates && (!flushed || updates->context != flushed->context ||
>> + fence_is_later(updates, flushed))) {
>> + fence_put(id->flushed_updates);
>> + id->flushed_updates = fence_get(updates);
>> + }
>> + id->pd_gpu_addr = job->vm_pd_addr;
>> + id->current_gpu_reset_count =
>> atomic_read(&adev->gpu_reset_counter);
>> + atomic64_set(&id->owner, vm->client_id);
>> + job->vm_needs_flush = needs_flush;
>> +
>> + job->vm_id = id - id_mgr->ids;
>> + trace_amdgpu_vm_grab_id(vm, ring, job);
>> +out:
>> + mutex_unlock(&id_mgr->lock);
>> + return r;
>> +}
>> +
>> /**
>> * amdgpu_vm_grab_id - allocate the next free VMID
>> *
>> @@ -426,6 +483,10 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm,
>> struct amdgpu_ring *ring,
>> unsigned i;
>> int r = 0;
>>
>> + if (amdgpu_vm_dedicated_vmid_ready(vm, vmhub))
>> + return amdgpu_vm_grab_dedicated_vmid(vm, ring, sync,
>> + fence, job);
>> +
>> fences = kmalloc_array(sizeof(void *), id_mgr->num_ids,
>> GFP_KERNEL);
>> if (!fences)
>> return -ENOMEM;
>>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-04-27 4:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 11:10 [PATCH 0/6 v3] *** Dedicated vmid per process v3 *** Chunming Zhou
[not found] ` <1493205039-3721-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-04-26 11:10 ` [PATCH 1/6] drm/amdgpu: add vm ioctl Chunming Zhou
2017-04-26 11:10 ` [PATCH 2/6] drm/amdgpu: add dedicated vmid field in vm struct Chunming Zhou
2017-04-26 11:10 ` [PATCH 3/6] drm/amdgpu: reserve/unreserve vmid by vm ioctl v3 Chunming Zhou
[not found] ` <1493205039-3721-4-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-04-26 12:26 ` Christian König
[not found] ` <bf812c57-d9ee-8a15-1198-acc687145fea-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-27 2:13 ` zhoucm1
[not found] ` <590153B1.3070305-5C7GfCeVMHo@public.gmane.org>
2017-04-27 2:24 ` Zhang, Jerry (Junwei)
[not found] ` <59015648.5010403-5C7GfCeVMHo@public.gmane.org>
2017-04-27 4:29 ` zhoucm1
2017-04-27 9:13 ` Christian König
2017-04-27 2:18 ` Zhang, Jerry (Junwei)
2017-04-26 11:10 ` [PATCH 4/6] drm/amdgpu: add limitation for dedicated vm number v3 Chunming Zhou
2017-04-26 11:10 ` [PATCH 5/6] drm/amdgpu: implement grab dedicated vmid V2 Chunming Zhou
[not found] ` <1493205039-3721-6-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-04-26 12:57 ` Christian König
2017-04-27 2:52 ` Zhang, Jerry (Junwei)
[not found] ` <59015CD8.3000303-5C7GfCeVMHo@public.gmane.org>
2017-04-27 4:42 ` zhoucm1 [this message]
[not found] ` <590176A2.70304-5C7GfCeVMHo@public.gmane.org>
2017-04-27 9:14 ` Christian König
2017-04-26 11:10 ` [PATCH 6/6] drm/amdgpu: bump module verion for reserved vmid Chunming Zhou
-- strict thread matches above, loose matches on Subject: below --
2017-04-24 5:57 [PATCH 0/6] *** Dedicated vmid per process v2 *** Chunming Zhou
[not found] ` <1493013460-13344-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-04-24 5:57 ` [PATCH 5/6] drm/amdgpu: implement grab dedicated vmid V2 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=590176A2.70304@amd.com \
--to=david1.zhou-5c7gfcevmho@public.gmane.org \
--cc=Jerry.Zhang-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.