Skip to contentSkip to conversation

drm/sched: implement drm_sched_entity_num_jobs

RFC PATCH In review Nirmoy Das 4 participants 7 messages Mar 11, 2020

Subsystems (4)
lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

RFC PATCH 1/2 drm/sched: implement drm_sched_entity_num_jobs

Implement drm_sched_entity_num_jobs() so that drm drivers can query number of jobs in an entity.

---
 drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++
 include/drm/gpu_scheduler.h              |  1 +
 2 files changed, 16 insertions(+)
drivers/gpu/drm/scheduler/sched_entity.c +15 -0
index 90fd9c30ae5a..dfe8216f2d52 100644
@@ -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
  *
include/drm/gpu_scheduler.h +1 -0
index d8972836d248..b5ceff75cbbe 100644
@@ -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
Signature · 6 lines
2.25.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

RFC PATCH 2/2 drm/amdgpu: disable gpu load balancer for vcn jobs

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.

---
 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(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -0
index 8304d0c87899..00032093d8a9 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +25 -0
index fa575bdc03c8..57b49188306d 100644
@@ -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 = &centity->entity.rq->sched;
+
+	if (drm_sched_entity_num_jobs(&centity->entity) == 1)
+		drm_sched_entity_modify_sched(&centity->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)
 {
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h +2 -0
index de490f183af2..d52d8d562d77 100644
@@ -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
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
index 4981e443a884..955d12bc89ae 100644
@@ -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;
 }
Signature · 6 lines
2.25.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw

Re: [RFC PATCH 2/2] drm/amdgpu: disable gpu load balancer for vcn jobs

Am 11.03.20 um 18:18 schrieb Nirmoy Das:

Quoted 37 lines

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.

---
  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(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -0
index 8304d0c87899..00032093d8a9 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +1 -0
index fa575bdc03c8..57b49188306d 100644
@@ -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;
 

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx, · line 567

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +5 -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 = &centity->entity.rq->sched;
+
+	if (drm_sched_entity_num_jobs(&centity->entity) == 1)

That check doesn't work correctly, the job might actually already be processed when we hit here.

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx, · line 568

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +1 -0
+		drm_sched_entity_modify_sched(&centity->entity, scheds, 1);

Just always update the scheduler here.

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx, · line 577

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +9 -0
+
+}
+
+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.

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx, · line 579

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +2 -0
+
+	switch (centity->hw_ip) {

Better get the ring from entity->rq->sched instead.

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx, · line 581

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +2 -0
+	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.

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +5 -0
+		limit_vcn_load_balance(centity);
+	}
+
+}
+
  int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx,
  			       struct drm_sched_entity *entity)
  {
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h +2 -0
index de490f183af2..d52d8d562d77 100644
@@ -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
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -0
index 4981e443a884..955d12bc89ae 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity, · line 160

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw

Re: [RFC PATCH 2/2] drm/amdgpu: disable gpu load balancer for vcn jobs

Quoted 37 lines · Christian König

Am 11.03.20 um 18:18 schrieb Nirmoy Das:

Quoted 36 lines

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.

---
  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(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
index 8304d0c87899..00032093d8a9 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0 -0
index fa575bdc03c8..57b49188306d 100644
@@ -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, }

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx, · line 567

Quoted 6 lines

  }
  +static void limit_vcn_load_balance(struct amdgpu_ctx_entity *centity)

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +4 -0
+{
+    struct drm_gpu_scheduler **scheds = &centity->entity.rq->sched;
+
+    if (drm_sched_entity_num_jobs(&centity->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

Quoted 57 lines
Quoted 2 lines

+ drm_sched_entity_modify_sched(&centity->entity, scheds, 1);

Just always update the scheduler here.

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c void amdgpu_ctx_priority_override(struct amdgpu_ctx *ctx, · line 577

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +9 -0
+
+}
+
+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.

Quoted 2 lines

+
+    switch (centity->hw_ip) {

Better get the ring from entity->rq->sched instead.

Quoted 2 lines

+    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.

Quoted 27 lines

+        limit_vcn_load_balance(centity);
+    }

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3 -0
+
+}
+

  int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx, struct drm_sched_entity *entity) {

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h +1 -0
index de490f183af2..d52d8d562d77 100644
@@ -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
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -0
index 4981e443a884..955d12bc89ae 100644
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c int amdgpu_job_submit(struct amdgpu_job *job, · line 160

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw
In reply to Nirmoy Das
Quoted 21 lines · Nirmoy Das

Implement drm_sched_entity_num_jobs() so that drm drivers can query number of jobs in an entity.

---
  drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++
  include/drm/gpu_scheduler.h              |  1 +
  2 files changed, 16 insertions(+)
drivers/gpu/drm/scheduler/sched_entity.c +4 -0
index 90fd9c30ae5a..dfe8216f2d52 100644
@@ -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

drivers/gpu/drm/scheduler/sched_entity.c static bool drm_sched_entity_is_idle(struct drm_sched_entity *entity) · line 135

Quoted 10 lines
drivers/gpu/drm/scheduler/sched_entity.c +10 -0
+ *
+ * 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

Quoted 9 lines
drivers/gpu/drm/scheduler/sched_entity.c +1 -0
+EXPORT_SYMBOL(drm_sched_entity_num_jobs);
  /**
   * drm_sched_entity_is_ready - Check if entity is ready
   *
include/drm/gpu_scheduler.h +0 -0
index d8972836d248..b5ceff75cbbe 100644

include/drm/gpu_scheduler.h void drm_sched_fence_finished(struct drm_sched_fence *fence); · line 346

Quoted 6 lines
include/drm/gpu_scheduler.h +1 -0
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw
Quoted 11 lines · Andrey Grodzovsky
Quoted 9 lines · Nirmoy Das

Implement drm_sched_entity_num_jobs() so that drm drivers can query number of jobs in an entity.

---
  drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++ include/drm/gpu_scheduler.h              |  1 +

  2 files changed, 16 insertions(+)
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/scheduler/sched_entity.c +0 -0
index 90fd9c30ae5a..dfe8216f2d52 100644
@@ -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

Quoted 7 lines
Quoted 7 lines

+ *
+ * @entity: scheduler entity
+ *
+ * Returns number of jobs in the entity
+ */

drivers/gpu/drm/scheduler/sched_entity.c +2 -0
+int drm_sched_entity_num_jobs(struct drm_sched_entity *entity)
+{
Quoted 8 lines

drivers/gpu/drm/scheduler/sched_entity.c static bool drm_sched_entity_is_idle(struct drm_sched_entity *entity) · line 135

Quoted 5 lines

+    if (drm_sched_entity_is_idle(entity))
+        return 0;

drivers/gpu/drm/scheduler/sched_entity.c +3 -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

Quoted 5 lines

Andrey

Quoted 15 lines
Quoted 9 lines

+EXPORT_SYMBOL(drm_sched_entity_num_jobs);
  /**
   * drm_sched_entity_is_ready - Check if entity is ready *

include/drm/gpu_scheduler.h +0 -0
index d8972836d248..b5ceff75cbbe 100644

include/drm/gpu_scheduler.h void drm_sched_fence_finished(struct · line 346

Quoted 6 lines
include/drm/gpu_scheduler.h +1 -0
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#6 lore raw

Am 11.03.20 um 18:58 schrieb Nirmoy:

Quoted 44 lines · Andrey Grodzovsky
Quoted 11 lines · Nirmoy Das
Quoted 9 lines

Implement drm_sched_entity_num_jobs() so that drm drivers can query number of jobs in an entity.

---
  drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++ include/drm/gpu_scheduler.h              |  1 +

  2 files changed, 16 insertions(+)
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/scheduler/sched_entity.c +0 -0
index 90fd9c30ae5a..dfe8216f2d52 100644
@@ -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

Quoted 7 lines
Quoted 7 lines

+ *
+ * @entity: scheduler entity
+ *
+ * Returns number of jobs in the entity
+ */

drivers/gpu/drm/scheduler/sched_entity.c +2 -0
+int drm_sched_entity_num_jobs(struct drm_sched_entity *entity)
+{
Quoted 8 lines

drivers/gpu/drm/scheduler/sched_entity.c static bool drm_sched_entity_is_idle(struct drm_sched_entity *entity) · line 135

Quoted 5 lines

+    if (drm_sched_entity_is_idle(entity))
+        return 0;

drivers/gpu/drm/scheduler/sched_entity.c +3 -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 ?

Quoted 5 lines

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.

Quoted 23 lines

Regards,

Nirmoy

Quoted 16 lines

Andrey

Quoted 11 lines

+EXPORT_SYMBOL(drm_sched_entity_num_jobs);
  /**
   * drm_sched_entity_is_ready - Check if entity is ready *

include/drm/gpu_scheduler.h +0 -0
index d8972836d248..b5ceff75cbbe 100644
@@ -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);
Quoted 8 lines
Quoted 4 lines

include/drm/gpu_scheduler.h void drm_sched_fence_finished(struct drm_sched_fence *fence); · line 346

Quoted 4 lines
include/drm/gpu_scheduler.h +1 -0
   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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx