[PATCH v2 3/9] drm/i915/gvt: insert the dummy vGPU into scheduler

Ping Gao ping.a.gao at intel.com
Tue Feb 14 04:25:49 UTC 2017


Let the dummy vGPU take part in scheduling, it has no real HW effect
as it's workload queue is always empty.

Signed-off-by: Ping Gao <ping.a.gao at intel.com>
---
 drivers/gpu/drm/i915/gvt/gvt.c          | 1 +
 drivers/gpu/drm/i915/gvt/sched_policy.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
index 7cd23dc..e41aa18 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.c
+++ b/drivers/gpu/drm/i915/gvt/gvt.c
@@ -301,6 +301,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
 		goto out_clean_types;
 	}
 	gvt->dummy_vgpu = vgpu;
+	intel_vgpu_start_schedule(vgpu);
 
 	gvt_dbg_core("gvt device initialization is done\n");
 	dev_priv->gvt = gvt;
diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c
index e48bbad..ff6e104 100644
--- a/drivers/gpu/drm/i915/gvt/sched_policy.c
+++ b/drivers/gpu/drm/i915/gvt/sched_policy.c
@@ -114,7 +114,7 @@ static void tbs_sched_func(struct tbs_sched_data *sched_data)
 	struct list_head *pos, *head;
 
 	/* no vgpu or has already had a target */
-	if (list_empty(&sched_data->runq_head) || scheduler->next_vgpu)
+	if (gvt->num_vgpu_sched <= 1 || scheduler->next_vgpu)
 		goto out;
 
 	if (scheduler->current_vgpu) {
@@ -237,7 +237,7 @@ static void tbs_sched_start_schedule(struct intel_vgpu *vgpu)
 	list_add_tail(&vgpu_data->list, &sched_data->runq_head);
 
 	vgpu->gvt->num_vgpu_sched++;
-	if (vgpu->gvt->num_vgpu_sched == 1)
+	if (vgpu->gvt->num_vgpu_sched == 2)
 		hrtimer_start(&sched_data->timer, ktime_add_ns(ktime_get(),
 			sched_data->period), HRTIMER_MODE_ABS);
 }
@@ -253,7 +253,7 @@ static void tbs_sched_stop_schedule(struct intel_vgpu *vgpu)
 	list_del_init(&vgpu_data->list);
 
 	vgpu->gvt->num_vgpu_sched--;
-	if (vgpu->gvt->num_vgpu_sched == 0)
+	if (vgpu->gvt->num_vgpu_sched == 1)
 		hrtimer_cancel(&sched_data->timer);
 }
 
-- 
2.7.4



More information about the intel-gvt-dev mailing list