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 1/4] drm/amdgpu: add sched sync for amdgpu job
Date: Wed, 10 May 2017 16:38:39 +0800 [thread overview]
Message-ID: <5912D18F.8050204@amd.com> (raw)
In-Reply-To: <6c8f4299-d251-a0fe-c76f-b9124482fa0a-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
On 2017年05月10日 16:26, Christian König wrote:
> Am 10.05.2017 um 09:31 schrieb Chunming Zhou:
>> this is an improvement for previous patch, the sched_sync is to store
>> fence
>> that could be skipped as scheduled, when job is executed, we didn't need
>> pipeline_sync if all fences in sched_sync are signalled, otherwise
>> insert
>> pipeline_sync still.
>>
>> Change-Id: I26d3a2794272ba94b25753d4bf367326d12f6939
>> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++++++-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 ++++-
>> 3 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index 787acd7..ef018bf 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -1162,6 +1162,7 @@ struct amdgpu_job {
>> struct amdgpu_vm *vm;
>> struct amdgpu_ring *ring;
>> struct amdgpu_sync sync;
>> + struct amdgpu_sync sched_sync;
>> struct amdgpu_ib *ibs;
>> struct fence *fence; /* the hw fence */
>> uint32_t preamble_status;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> index 2c6624d..86ad507 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> @@ -121,6 +121,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,
>> unsigned num_ibs,
>> {
>> struct amdgpu_device *adev = ring->adev;
>> struct amdgpu_ib *ib = &ibs[0];
>> + struct fence *tmp;
>> bool skip_preamble, need_ctx_switch;
>> unsigned patch_offset = ~0;
>> struct amdgpu_vm *vm;
>> @@ -167,8 +168,12 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,
>> unsigned num_ibs,
>> return r;
>> }
>> - if (ring->funcs->emit_pipeline_sync && job &&
>> job->need_pipeline_sync)
>> + if (ring->funcs->emit_pipeline_sync && job &&
>> + (tmp = amdgpu_sync_get_fence(&job->sched_sync))) {
>> + job->need_pipeline_sync = true;
>> amdgpu_ring_emit_pipeline_sync(ring);
>> + fence_put(tmp);
>> + }
>> if (vm) {
>> amdgpu_ring_insert_nop(ring, extra_nop); /* prevent CE go
>> too fast than DE */
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> index cfa97ab..fa0c8b1 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> @@ -60,6 +60,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev,
>> unsigned num_ibs,
>> (*job)->need_pipeline_sync = false;
>> amdgpu_sync_create(&(*job)->sync);
>> + amdgpu_sync_create(&(*job)->sched_sync);
>> return 0;
>> }
>> @@ -98,6 +99,7 @@ static void amdgpu_job_free_cb(struct amd_sched_job
>> *s_job)
>> fence_put(job->fence);
>> amdgpu_sync_free(&job->sync);
>> + amdgpu_sync_free(&job->sched_sync);
>> kfree(job);
>> }
>> @@ -107,6 +109,7 @@ void amdgpu_job_free(struct amdgpu_job *job)
>> fence_put(job->fence);
>> amdgpu_sync_free(&job->sync);
>> + amdgpu_sync_free(&job->sched_sync);
>> kfree(job);
>> }
>> @@ -154,7 +157,7 @@ static struct fence
>> *amdgpu_job_dependency(struct amd_sched_job *sched_job)
>> }
>> if (amd_sched_dependency_optimized(fence, sched_job->s_entity))
>> - job->need_pipeline_sync = true;
>> + amdgpu_sync_fence(job->adev, &job->sched_sync, fence);
>
> This can result in an -ENOMEM
will handle it.
> and additional to that we only need to remember the last fence
> optimized like this, not all of them.
>
> So just keep the last one found here in job->sched_fence instead.
I guess this isn't enough.
The dependency is not in order when calling, so the last one is not
always the last scheduled fence.
And they could be sched fence not hw fence, although they are handled by
same hw ring, but the sched fence context isn't same.
so we still need sched_sync here, right?
Regards,
David zhou
>
> Regards,
> Christian.
>
>> return fence;
>> }
>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-05-10 8:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 7:31 [PATCH 1/4] drm/amdgpu: add sched sync for amdgpu job Chunming Zhou
[not found] ` <1494401509-7198-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-05-10 7:31 ` [PATCH 2/4] drm/amdgpu: make pipeline sync be in same place Chunming Zhou
[not found] ` <1494401509-7198-2-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-05-10 8:08 ` Zhang, Jerry (Junwei)
2017-05-10 8:28 ` Christian König
2017-05-10 7:31 ` [PATCH 3/4] drm/amdgpu: id reset count only is updated when used end Chunming Zhou
[not found] ` <1494401509-7198-3-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-05-10 8:14 ` Zhang, Jerry (Junwei)
2017-05-10 8:20 ` Christian König
2017-05-10 7:31 ` [PATCH 4/4] drm/amdgpu: check whether the vmid can be reused first Chunming Zhou
[not found] ` <1494401509-7198-4-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-05-10 8:11 ` Zhang, Jerry (Junwei)
2017-05-10 8:18 ` Christian König
2017-05-10 8:00 ` [PATCH 1/4] drm/amdgpu: add sched sync for amdgpu job Zhang, Jerry (Junwei)
2017-05-10 8:26 ` Christian König
[not found] ` <6c8f4299-d251-a0fe-c76f-b9124482fa0a-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-10 8:38 ` zhoucm1 [this message]
[not found] ` <5912D18F.8050204-5C7GfCeVMHo@public.gmane.org>
2017-05-10 8:50 ` Christian König
[not found] ` <7769dbea-68ad-e6a0-81be-f4e07677c731-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-10 9:00 ` zhoucm1
[not found] ` <5912D6BB.2080303-5C7GfCeVMHo@public.gmane.org>
2017-05-10 9:21 ` Christian König
[not found] ` <ab63e653-6eb3-c42f-1674-ac26528fd202-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-10 9:20 ` zhoucm1
[not found] ` <5912DB4F.7080607-5C7GfCeVMHo@public.gmane.org>
2017-05-10 9:44 ` 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=5912D18F.8050204@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.