[PATCH] drm/i915/gvt: force to active the high-performance mode during vGPU busy

Weinan Li weinan.z.li at intel.com
Wed Apr 18 02:31:33 UTC 2018


With the RPS interrupt, KMD can adjust the GPU frequency dynamically for
power saving. It works well in the non-virtualized environment, but there
is more latency imported by VMM and virtual interrupt handler which may
break the RPS policy work model, and GPU works in inefficient mode. Here
we force to active the high-performance mode when detect vgpu is busy until
the GPU runs into idle.

Signed-off-by: Weinan Li <weinan.z.li at intel.com>
---
 drivers/gpu/drm/i915/gvt/scheduler.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c
index d71e3de..7ba8703 100644
--- a/drivers/gpu/drm/i915/gvt/scheduler.c
+++ b/drivers/gpu/drm/i915/gvt/scheduler.c
@@ -222,6 +222,17 @@ static void save_ring_hw_state(struct intel_vgpu *vgpu, int ring_id)
 	vgpu_vreg(vgpu, i915_mmio_reg_offset(reg)) = I915_READ_FW(reg);
 }
 
+static int active_high_performance_mode(struct drm_i915_private *dev_priv)
+{
+	struct intel_rps rps = dev_priv->gt_pm.rps;
+
+	if (rps.cur_freq != rps.max_freq || rps.interrupts_enabled) {
+		intel_set_rps(dev_priv, rps.max_freq);
+		gen6_disable_rps_interrupts(dev_priv);
+		trace_printk("active high performance mode for GVT-g.\n");
+	}
+}
+
 static int shadow_context_status_change(struct notifier_block *nb,
 		unsigned long action, void *data)
 {
@@ -263,6 +274,7 @@ static int shadow_context_status_change(struct notifier_block *nb,
 			gvt_dbg_sched("skip ring %d mmio switch for vgpu%d\n",
 				      ring_id, workload->vgpu->id);
 		spin_unlock_irqrestore(&scheduler->mmio_context_lock, flags);
+		active_high_performance_mode(gvt->dev_priv);
 		atomic_set(&workload->shadow_ctx_active, 1);
 		break;
 	case INTEL_CONTEXT_SCHEDULE_OUT:
-- 
1.9.1



More information about the intel-gvt-dev mailing list