drm/i915/gvt: control the scheduler by timeslice usage
authorPing Gao <ping.a.gao@intel.com>
Wed, 29 Mar 2017 16:36:40 +0000 (00:36 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Thu, 30 Mar 2017 05:34:10 +0000 (13:34 +0800)
The timeslice usage will determine vGPU whether has chance to
schedule or not at every vGPU switch checkpoint.

Signed-off-by: Ping Gao <ping.a.gao@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/sched_policy.c

index dd5b38c3e4edde9b4d2bd64e5e68651d53cb52cb..f8495917067486e1ca0c124c187a9351e09c49a4 100644 (file)
@@ -187,8 +187,11 @@ static struct intel_vgpu *find_busy_vgpu(struct gvt_sched_data *sched_data)
                if (!vgpu_has_pending_workload(vgpu_data->vgpu))
                        continue;
 
-               vgpu = vgpu_data->vgpu;
-               break;
+               /* Return the vGPU only if it has time slice left */
+               if (vgpu_data->left_ts > 0) {
+                       vgpu = vgpu_data->vgpu;
+                       break;
+               }
        }
 
        return vgpu;
@@ -223,6 +226,8 @@ static void tbs_sched_func(struct gvt_sched_data *sched_data)
                                &sched_data->lru_runq_head);
 
                gvt_dbg_sched("pick next vgpu %d\n", vgpu->id);
+       } else {
+               scheduler->next_vgpu = gvt->idle_vgpu;
        }
 out:
        if (scheduler->next_vgpu) {