From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Nirmoy Das <nirmoy.aiemd@gmail.com>, amd-gfx@lists.freedesktop.org
Cc: Boyuan.Zhang@amd.com, nirmoy.das@amd.com,
alexander.deucher@amd.com, James.Zhu@amd.com, Leo.Liu@amd.com,
christian.koenig@amd.com
Subject: Re: [RFC PATCH 2/2] drm/amdgpu: disable gpu load balancer for vcn jobs
Date: Wed, 11 Mar 2020 19:03:00 +0100 [thread overview]
Message-ID: <09a20385-ef17-f2df-bd0b-ca60bb82cbcc@gmail.com> (raw)
In-Reply-To: <20200311171809.7115-2-nirmoy.das@amd.com>
Am 11.03.20 um 18:18 schrieb Nirmoy Das:
> VCN HW doesn't support dynamic load balance on multiple
> instances for a context. This modifies the entity's sched_list
> to a sched_list consist of only one drm scheduler.
>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 25 +++++++++++++++++++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h | 2 ++
> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 +
> 4 files changed, 29 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 8304d0c87899..00032093d8a9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1257,6 +1257,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
> priority = job->base.s_priority;
> drm_sched_entity_push_job(&job->base, entity);
>
> + amdgpu_ctx_limit_load_balance(entity);
> amdgpu_vm_move_to_lru_tail(p->adev, &fpriv->vm);
>
> ttm_eu_fence_buffer_objects(&p->ticket, &p->validated, p->fence);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index fa575bdc03c8..57b49188306d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -139,6 +139,7 @@ static int amdgpu_ctx_init_entity(struct amdgpu_ctx *ctx, const u32 hw_ip, const
> if (r)
> goto error_free_entity;
>
> + entity->hw_ip = hw_ip;
> ctx->entities[hw_ip][ring] = entity;
> return 0;
>
> @@ -559,6 +560,30 @@ void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx,
> }
> }
>
> +static void limit_vcn_load_balance(struct amdgpu_ctx_entity *centity)
> +{
> + struct drm_gpu_scheduler **scheds = ¢ity->entity.rq->sched;
> +
> + if (drm_sched_entity_num_jobs(¢ity->entity) == 1)
That check doesn't work correctly, the job might actually already be
processed when we hit here.
> + drm_sched_entity_modify_sched(¢ity->entity, scheds, 1);
Just always update the scheduler here.
> +
> +}
> +
> +void amdgpu_ctx_limit_load_balance(struct drm_sched_entity *entity)
> +{
> + struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity);
> +
> + if (!centity)
> + return;
That check looks superfluous to me.
> +
> + switch (centity->hw_ip) {
Better get the ring from entity->rq->sched instead.
> + case AMDGPU_HW_IP_VCN_DEC:
> + case AMDGPU_HW_IP_VCN_ENC:
Maybe better to make that a flag in the ring functions, but this way
works as well.
Regards,
Christian.
> + limit_vcn_load_balance(centity);
> + }
> +
> +}
> +
> int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx,
> struct drm_sched_entity *entity)
> {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
> index de490f183af2..d52d8d562d77 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
> @@ -33,6 +33,7 @@ struct amdgpu_fpriv;
>
> struct amdgpu_ctx_entity {
> uint64_t sequence;
> + uint32_t hw_ip;
> struct drm_sched_entity entity;
> struct dma_fence *fences[];
> };
> @@ -90,5 +91,6 @@ void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr);
>
> void amdgpu_ctx_init_sched(struct amdgpu_device *adev);
>
> +void amdgpu_ctx_limit_load_balance(struct drm_sched_entity *entity);
>
> #endif
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index 4981e443a884..955d12bc89ae 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -154,6 +154,7 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,
> amdgpu_job_free_resources(job);
> priority = job->base.s_priority;
> drm_sched_entity_push_job(&job->base, entity);
> + amdgpu_ctx_limit_load_balance(entity);
>
> return 0;
> }
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-03-11 18:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 17:18 [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs Nirmoy Das
2020-03-11 17:18 ` [RFC PATCH 2/2] drm/amdgpu: disable gpu load balancer for vcn jobs Nirmoy Das
2020-03-11 18:03 ` Christian König [this message]
2020-03-11 18:47 ` Nirmoy
2020-03-11 17:23 ` [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs Andrey Grodzovsky
2020-03-11 17:58 ` Nirmoy
2020-03-11 17:57 ` 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=09a20385-ef17-f2df-bd0b-ca60bb82cbcc@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Boyuan.Zhang@amd.com \
--cc=James.Zhu@amd.com \
--cc=Leo.Liu@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=nirmoy.aiemd@gmail.com \
--cc=nirmoy.das@amd.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox