* [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs @ 2020-03-11 17:18 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 17:23 ` [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs Andrey Grodzovsky 0 siblings, 2 replies; 7+ messages in thread From: Nirmoy Das @ 2020-03-11 17:18 UTC (permalink / raw) To: amd-gfx Cc: Boyuan.Zhang, nirmoy.das, alexander.deucher, James.Zhu, Leo.Liu, christian.koenig Implement drm_sched_entity_num_jobs() so that drm drivers can query number of jobs in an entity. Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> --- drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++ include/drm/gpu_scheduler.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index 90fd9c30ae5a..dfe8216f2d52 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -119,6 +119,21 @@ static bool drm_sched_entity_is_idle(struct drm_sched_entity *entity) return false; } +/** + * drm_sched_entity_num_job - Get number of jobs in the entity + * + * @entity: scheduler entity + * + * Returns number of jobs in the entity + */ +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity) +{ + if (drm_sched_entity_is_idle(entity)) + return 0; + + return spsc_queue_count(&entity->job_queue); +} +EXPORT_SYMBOL(drm_sched_entity_num_jobs); /** * drm_sched_entity_is_ready - Check if entity is ready * diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index d8972836d248..b5ceff75cbbe 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -341,5 +341,6 @@ void drm_sched_fence_finished(struct drm_sched_fence *fence); unsigned long drm_sched_suspend_timeout(struct drm_gpu_scheduler *sched); void drm_sched_resume_timeout(struct drm_gpu_scheduler *sched, unsigned long remaining); +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity); #endif -- 2.25.0 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH 2/2] drm/amdgpu: disable gpu load balancer for vcn jobs 2020-03-11 17:18 [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs Nirmoy Das @ 2020-03-11 17:18 ` Nirmoy Das 2020-03-11 18:03 ` Christian König 2020-03-11 17:23 ` [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs Andrey Grodzovsky 1 sibling, 1 reply; 7+ messages in thread From: Nirmoy Das @ 2020-03-11 17:18 UTC (permalink / raw) To: amd-gfx Cc: Boyuan.Zhang, nirmoy.das, alexander.deucher, James.Zhu, Leo.Liu, christian.koenig 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) + drm_sched_entity_modify_sched(¢ity->entity, scheds, 1); + +} + +void amdgpu_ctx_limit_load_balance(struct drm_sched_entity *entity) +{ + struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity); + + if (!centity) + return; + + switch (centity->hw_ip) { + case AMDGPU_HW_IP_VCN_DEC: + case AMDGPU_HW_IP_VCN_ENC: + 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; } -- 2.25.0 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RFC PATCH 2/2] drm/amdgpu: disable gpu load balancer for vcn jobs 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 2020-03-11 18:47 ` Nirmoy 0 siblings, 1 reply; 7+ messages in thread From: Christian König @ 2020-03-11 18:03 UTC (permalink / raw) To: Nirmoy Das, amd-gfx Cc: Boyuan.Zhang, nirmoy.das, alexander.deucher, James.Zhu, Leo.Liu, christian.koenig 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH 2/2] drm/amdgpu: disable gpu load balancer for vcn jobs 2020-03-11 18:03 ` Christian König @ 2020-03-11 18:47 ` Nirmoy 0 siblings, 0 replies; 7+ messages in thread From: Nirmoy @ 2020-03-11 18:47 UTC (permalink / raw) To: christian.koenig, Nirmoy Das, amd-gfx Cc: Andrey Grodzovsky, Boyuan.Zhang, nirmoy.das, alexander.deucher, James.Zhu, Leo.Liu On 3/11/20 7:03 PM, Christian König wrote: > 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. Okay now I know what Andrey meant. I will resend a updated patch. Thanks, Nirmoy > >> + 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs 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 17:23 ` Andrey Grodzovsky 2020-03-11 17:58 ` Nirmoy 1 sibling, 1 reply; 7+ messages in thread From: Andrey Grodzovsky @ 2020-03-11 17:23 UTC (permalink / raw) To: Nirmoy Das, amd-gfx Cc: Boyuan.Zhang, nirmoy.das, alexander.deucher, James.Zhu, Leo.Liu, christian.koenig On 3/11/20 1:18 PM, Nirmoy Das wrote: > Implement drm_sched_entity_num_jobs() so that drm drivers can > query number of jobs in an entity. > > Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> > --- > drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++ > include/drm/gpu_scheduler.h | 1 + > 2 files changed, 16 insertions(+) > > diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c > index 90fd9c30ae5a..dfe8216f2d52 100644 > --- a/drivers/gpu/drm/scheduler/sched_entity.c > +++ b/drivers/gpu/drm/scheduler/sched_entity.c > @@ -119,6 +119,21 @@ static bool drm_sched_entity_is_idle(struct drm_sched_entity *entity) > return false; > } > > +/** > + * drm_sched_entity_num_job - Get number of jobs in the entity > + * > + * @entity: scheduler entity > + * > + * Returns number of jobs in the entity > + */ > +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity) > +{ > + if (drm_sched_entity_is_idle(entity)) > + return 0; > + > + return spsc_queue_count(&entity->job_queue); > +} What about the jobs which already have been dequeued from job_queue and are in progress in the HW ring but yet to complete - don't they count ? Andrey > +EXPORT_SYMBOL(drm_sched_entity_num_jobs); > /** > * drm_sched_entity_is_ready - Check if entity is ready > * > diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h > index d8972836d248..b5ceff75cbbe 100644 > --- a/include/drm/gpu_scheduler.h > +++ b/include/drm/gpu_scheduler.h > @@ -341,5 +341,6 @@ void drm_sched_fence_finished(struct drm_sched_fence *fence); > unsigned long drm_sched_suspend_timeout(struct drm_gpu_scheduler *sched); > void drm_sched_resume_timeout(struct drm_gpu_scheduler *sched, > unsigned long remaining); > +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity); > > #endif _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs 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 0 siblings, 1 reply; 7+ messages in thread From: Nirmoy @ 2020-03-11 17:58 UTC (permalink / raw) To: Andrey Grodzovsky, Nirmoy Das, amd-gfx Cc: Boyuan.Zhang, nirmoy.das, alexander.deucher, James.Zhu, Leo.Liu, christian.koenig On 3/11/20 6:23 PM, Andrey Grodzovsky wrote: > > On 3/11/20 1:18 PM, Nirmoy Das wrote: >> Implement drm_sched_entity_num_jobs() so that drm drivers can >> query number of jobs in an entity. >> >> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> >> --- >> drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++ >> include/drm/gpu_scheduler.h | 1 + >> 2 files changed, 16 insertions(+) >> >> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c >> b/drivers/gpu/drm/scheduler/sched_entity.c >> index 90fd9c30ae5a..dfe8216f2d52 100644 >> --- a/drivers/gpu/drm/scheduler/sched_entity.c >> +++ b/drivers/gpu/drm/scheduler/sched_entity.c >> @@ -119,6 +119,21 @@ static bool drm_sched_entity_is_idle(struct >> drm_sched_entity *entity) >> return false; >> } >> +/** >> + * drm_sched_entity_num_job - Get number of jobs in the entity typo s/drm_sched_entity_num_job/drm_sched_entity_num_jobs >> + * >> + * @entity: scheduler entity >> + * >> + * Returns number of jobs in the entity >> + */ >> +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity) >> +{ >> + if (drm_sched_entity_is_idle(entity)) >> + return 0; >> + >> + return spsc_queue_count(&entity->job_queue); >> +} > > > What about the jobs which already have been dequeued from job_queue > and are in progress in the HW ring but yet to complete - don't they > count ? Hi Andrey, I am thinking in terms of software side of the counting because for an entity once a job dequeued, that job is completely lost. I might be wrong here that's why tagged RFC :) Regards, Nirmoy > > Andrey > > > >> +EXPORT_SYMBOL(drm_sched_entity_num_jobs); >> /** >> * drm_sched_entity_is_ready - Check if entity is ready >> * >> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h >> index d8972836d248..b5ceff75cbbe 100644 >> --- a/include/drm/gpu_scheduler.h >> +++ b/include/drm/gpu_scheduler.h >> @@ -341,5 +341,6 @@ void drm_sched_fence_finished(struct >> drm_sched_fence *fence); >> unsigned long drm_sched_suspend_timeout(struct drm_gpu_scheduler >> *sched); >> void drm_sched_resume_timeout(struct drm_gpu_scheduler *sched, >> unsigned long remaining); >> +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity); >> #endif _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs 2020-03-11 17:58 ` Nirmoy @ 2020-03-11 17:57 ` Christian König 0 siblings, 0 replies; 7+ messages in thread From: Christian König @ 2020-03-11 17:57 UTC (permalink / raw) To: Nirmoy, Andrey Grodzovsky, Nirmoy Das, amd-gfx Cc: Boyuan.Zhang, nirmoy.das, alexander.deucher, James.Zhu, Leo.Liu, christian.koenig Am 11.03.20 um 18:58 schrieb Nirmoy: > > On 3/11/20 6:23 PM, Andrey Grodzovsky wrote: >> >> On 3/11/20 1:18 PM, Nirmoy Das wrote: >>> Implement drm_sched_entity_num_jobs() so that drm drivers can >>> query number of jobs in an entity. >>> >>> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> >>> --- >>> drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++ >>> include/drm/gpu_scheduler.h | 1 + >>> 2 files changed, 16 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c >>> b/drivers/gpu/drm/scheduler/sched_entity.c >>> index 90fd9c30ae5a..dfe8216f2d52 100644 >>> --- a/drivers/gpu/drm/scheduler/sched_entity.c >>> +++ b/drivers/gpu/drm/scheduler/sched_entity.c >>> @@ -119,6 +119,21 @@ static bool drm_sched_entity_is_idle(struct >>> drm_sched_entity *entity) >>> return false; >>> } >>> +/** >>> + * drm_sched_entity_num_job - Get number of jobs in the entity > > > typo s/drm_sched_entity_num_job/drm_sched_entity_num_jobs > > >>> + * >>> + * @entity: scheduler entity >>> + * >>> + * Returns number of jobs in the entity >>> + */ >>> +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity) >>> +{ >>> + if (drm_sched_entity_is_idle(entity)) >>> + return 0; >>> + >>> + return spsc_queue_count(&entity->job_queue); >>> +} >> >> >> What about the jobs which already have been dequeued from job_queue >> and are in progress in the HW ring but yet to complete - don't they >> count ? > > Hi Andrey, > > I am thinking in terms of software side of the counting because for an > entity once a job dequeued, that job is completely lost. > > I might be wrong here that's why tagged RFC :) My question is rather what do we need that for in the first place? Thanks, Christian. > > > Regards, > > Nirmoy > > >> >> Andrey >> >> >> >>> +EXPORT_SYMBOL(drm_sched_entity_num_jobs); >>> /** >>> * drm_sched_entity_is_ready - Check if entity is ready >>> * >>> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h >>> index d8972836d248..b5ceff75cbbe 100644 >>> --- a/include/drm/gpu_scheduler.h >>> +++ b/include/drm/gpu_scheduler.h >>> @@ -341,5 +341,6 @@ void drm_sched_fence_finished(struct >>> drm_sched_fence *fence); >>> unsigned long drm_sched_suspend_timeout(struct drm_gpu_scheduler >>> *sched); >>> void drm_sched_resume_timeout(struct drm_gpu_scheduler *sched, >>> unsigned long remaining); >>> +int drm_sched_entity_num_jobs(struct drm_sched_entity *entity); >>> #endif > _______________________________________________ > 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-03-11 18:43 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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
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.