drm/i915/gvt: cancel scheduler timer when no vGPU exists

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/61a669473f82cd5cac66146644b829b370c791ca
Commit:     61a669473f82cd5cac66146644b829b370c791ca
Parent:     14b4434bff1aab69f3785bc67276efbff7fffa3d
Refname:    refs/heads/master
Author:     Zhenyu Wang <[email protected]>
AuthorDate: Mon Jan 15 16:36:12 2018 +0800
Committer:  Rodrigo Vivi <[email protected]>
CommitDate: Thu Feb 1 07:32:16 2018 -0800

    drm/i915/gvt: cancel scheduler timer when no vGPU exists
    
    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 <[email protected]>
    Signed-off-by: Zhenyu Wang <[email protected]>
    Signed-off-by: Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/gvt/sched_policy.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c
index eea1a2f92099..d031f6486ce3 100644
--- a/drivers/gpu/drm/i915/gvt/sched_policy.c
+++ b/drivers/gpu/drm/i915/gvt/sched_policy.c
@@ -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)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.