diff options
author | Zhipeng Gong <zhipeng.gong@intel.com> | 2018-04-04 03:43:52 +0300 |
---|---|---|
committer | Zhi Wang <zhi.a.wang@intel.com> | 2018-04-23 08:09:31 +0300 |
commit | 292bb0d38a5714440b59ef910404408d5e9a8017 (patch) | |
tree | 8b83b7f54e5273710fb9fc4fca5962ec81687fa9 /drivers/gpu/drm/i915/gvt/sched_policy.c | |
parent | fadec6eefe232696c5c471b40df33e6db616e854 (diff) | |
download | linux-292bb0d38a5714440b59ef910404408d5e9a8017.tar.xz |
drm/i915/gvt: Use real time to do timer check
intel_gvt_schedule check timer through a counter and is supposed
to wake up to increase the counter every ms.
In a system with heavy workload, gvt_service_thread can not get
a chance to run right after wake up and will be delayed several
milliseconds. As a result, one hundred counter interval means
several hundred milliseconds in real time.
This patch use real time instead of counter to do timer check.
v2: remove static variable. (Zhenyu)
v3: correct expire_time update. (Zhenyu)
Signed-off-by: Zhipeng Gong <zhipeng.gong@intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Min He <min.he@intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/gvt/sched_policy.c')
-rw-r--r-- | drivers/gpu/drm/i915/gvt/sched_policy.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c index 75b7bc7b344c..8876a57f407c 100644 --- a/drivers/gpu/drm/i915/gvt/sched_policy.c +++ b/drivers/gpu/drm/i915/gvt/sched_policy.c @@ -66,6 +66,7 @@ struct gvt_sched_data { struct hrtimer timer; unsigned long period; struct list_head lru_runq_head; + ktime_t expire_time; }; static void vgpu_update_timeslice(struct intel_vgpu *pre_vgpu) @@ -226,14 +227,18 @@ out: void intel_gvt_schedule(struct intel_gvt *gvt) { struct gvt_sched_data *sched_data = gvt->scheduler.sched_data; - static uint64_t timer_check; mutex_lock(&gvt->lock); if (test_and_clear_bit(INTEL_GVT_REQUEST_SCHED, (void *)&gvt->service_request)) { - if (!(timer_check++ % GVT_TS_BALANCE_PERIOD_MS)) + ktime_t cur_time = ktime_get(); + + if (cur_time >= sched_data->expire_time) { gvt_balance_timeslice(sched_data); + sched_data->expire_time = ktime_add_ms( + cur_time, GVT_TS_BALANCE_PERIOD_MS); + } } clear_bit(INTEL_GVT_REQUEST_EVENT_SCHED, (void *)&gvt->service_request); |