From 83076a08847a5a3607c3490592fd9e0806fb0b5d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 21 Apr 2015 09:49:43 +0100 Subject: [PATCH] free-rps-boosts-for-all --- drivers/gpu/drm/i915/i915_gem.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 3 ++- drivers/gpu/drm/i915/intel_pm.c | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 82926483c84f..e3c585cc5c2e 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1243,7 +1243,7 @@ int __i915_wait_request(struct drm_i915_gem_request *req, jiffies + nsecs_to_jiffies_timeout((u64)*timeout) : 0; if (INTEL_INFO(dev_priv)->gen >= 6) - gen6_rps_boost(dev_priv, rps); + gen6_rps_boost(dev_priv, rps, req->emitted_jiffies); /* Record current time in case interrupted by signal, or wedged */ trace_i915_gem_request_wait_begin(req); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 36dc6223d54a..5104e5b1f4dd 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1379,7 +1379,8 @@ void gen6_rps_busy(struct drm_i915_private *dev_priv); void gen6_rps_reset_ei(struct drm_i915_private *dev_priv); void gen6_rps_idle(struct drm_i915_private *dev_priv); void gen6_rps_boost(struct drm_i915_private *dev_priv, - struct intel_rps_client *rps); + struct intel_rps_client *rps, + unsigned long submitted); void intel_queue_rps_boost_for_request(struct drm_device *dev, struct drm_i915_gem_request *rq); void ilk_wm_get_hw_state(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 741267c4f64c..2d060f87934f 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -4128,10 +4128,17 @@ void gen6_rps_idle(struct drm_i915_private *dev_priv) } void gen6_rps_boost(struct drm_i915_private *dev_priv, - struct intel_rps_client *rps) + struct intel_rps_client *rps, + unsigned long submitted) { u32 val; + /* Force a RPS boost (and don't count it against the client) if + * the GPU is severely congested. + */ + if (rps && time_after(jiffies, submitted + msecs_to_jiffies(20))) + rps = NULL; + mutex_lock(&dev_priv->rps.hw_lock); val = dev_priv->rps.max_freq_softlimit; if (dev_priv->rps.enabled && @@ -6819,11 +6826,12 @@ struct request_boost { static void __intel_rps_boost_work(struct work_struct *work) { struct request_boost *boost = container_of(work, struct request_boost, work); + struct drm_i915_gem_request *rq = boost->rq; - if (!i915_gem_request_completed(boost->rq, true)) - gen6_rps_boost(boost->rq->i915, NULL); + if (!i915_gem_request_completed(rq, true)) + gen6_rps_boost(rq->i915, NULL, rq->emitted_jiffies); - i915_gem_request_unreference__unlocked(boost->rq); + i915_gem_request_unreference__unlocked(rq); kfree(boost); } -- 2.1.4