drm/i915/gvt: cancel scheduler timer when no vGPU exists
authorZhenyu Wang <zhenyuw@linux.intel.com>
Mon, 15 Jan 2018 08:36:12 +0000 (16:36 +0800)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 1 Feb 2018 15:32:16 +0000 (07:32 -0800)
Stop gvt scheduler timer if no vGPU exists, otherwise it keeps
gvt service thread busy to handle request schedule event but no
actual schedule activity required.

Reviewed-by: Zhi Wang <zhi.a.wang@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/gvt/sched_policy.c

index eea1a2f920990a17f9ead7f91187b83c01e85eb6..d031f6486ce3fa19b602a7535f25c17efa82ba6a 100644 (file)
@@ -308,8 +308,15 @@ static int tbs_sched_init_vgpu(struct intel_vgpu *vgpu)
 
 static void tbs_sched_clean_vgpu(struct intel_vgpu *vgpu)
 {
+       struct intel_gvt *gvt = vgpu->gvt;
+       struct gvt_sched_data *sched_data = gvt->scheduler.sched_data;
+
        kfree(vgpu->sched_data);
        vgpu->sched_data = NULL;
+
+       /* this vgpu id has been removed */
+       if (idr_is_empty(&gvt->vgpu_idr))
+               hrtimer_cancel(&sched_data->timer);
 }
 
 static void tbs_sched_start_schedule(struct intel_vgpu *vgpu)