diff mbox

[v3] drm/i915: Set softmin frequency on idle->busy transition

Message ID 1466409076-19166-1-git-send-email-michal.winiarski@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michał Winiarski June 20, 2016, 7:51 a.m. UTC
If the GPU load is low enough, it's possible that we'll be stuck at idle
frequency rather than transition into softmin frequency requested by
userspace.

v2: Use intel_set_rps, drop vlv_set_idle
v3: Back to vlv_set_idle, clamp to valid range

References: https://bugs.freedesktop.org/show_bug.cgi?id=89728
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Chris Wilson June 20, 2016, 8:16 a.m. UTC | #1
On Mon, Jun 20, 2016 at 09:51:16AM +0200, Michał Winiarski wrote:
> If the GPU load is low enough, it's possible that we'll be stuck at idle
> frequency rather than transition into softmin frequency requested by
> userspace.
> 
> v2: Use intel_set_rps, drop vlv_set_idle
> v3: Back to vlv_set_idle, clamp to valid range
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=89728
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 658a756..a71f946 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -4840,6 +4840,11 @@ void gen6_rps_busy(struct drm_i915_private *dev_priv)
>  {
>  	mutex_lock(&dev_priv->rps.hw_lock);
>  	if (dev_priv->rps.enabled) {
> +		/* Ensure we start at the user's desired frequency */
> +		intel_set_rps(dev_priv,
> +			      clamp(dev_priv->rps.cur_freq,
> +				    dev_priv->rps.min_freq_softlimit,
> +				    dev_priv->rps.max_freq_softlimit));

Make this last (after gen6_enable_rps_interrupts), then r.b

Moving it last means that we have onion placement with rps_idle, and we
don't need a silly comment explaining the apparent duplication of the
PMINTRMSK update.
-Chris
Michał Winiarski June 20, 2016, 10 a.m. UTC | #2
On Mon, 2016-06-20 at 09:16 +0100, Chris Wilson wrote:
> On Mon, Jun 20, 2016 at 09:51:16AM +0200, Michał Winiarski wrote:

> > 

> > If the GPU load is low enough, it's possible that we'll be stuck at

> > idle

> > frequency rather than transition into softmin frequency requested

> > by

> > userspace.

> > 

> > v2: Use intel_set_rps, drop vlv_set_idle

> > v3: Back to vlv_set_idle, clamp to valid range

> > 

> > References: https://bugs.freedesktop.org/show_bug.cgi?id=89728

> > Cc: Chris Wilson <chris@chris-wilson.co.uk>

> > Cc: Imre Deak <imre.deak@intel.com>

> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

> > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>

> > ---

> >  drivers/gpu/drm/i915/intel_pm.c | 5 +++++

> >  1 file changed, 5 insertions(+)

> > 

> > diff --git a/drivers/gpu/drm/i915/intel_pm.c

> > b/drivers/gpu/drm/i915/intel_pm.c

> > index 658a756..a71f946 100644

> > --- a/drivers/gpu/drm/i915/intel_pm.c

> > +++ b/drivers/gpu/drm/i915/intel_pm.c

> > @@ -4840,6 +4840,11 @@ void gen6_rps_busy(struct drm_i915_private

> > *dev_priv)

> >  {

> >  	mutex_lock(&dev_priv->rps.hw_lock);

> >  	if (dev_priv->rps.enabled) {

> > +		/* Ensure we start at the user's desired frequency

> > */

> > +		intel_set_rps(dev_priv,

> > +			      clamp(dev_priv->rps.cur_freq,

> > +				    dev_priv-

> > >rps.min_freq_softlimit,

> > +				    dev_priv-

> > >rps.max_freq_softlimit));

> Make this last (after gen6_enable_rps_interrupts), then r.b

> 

> Moving it last means that we have onion placement with rps_idle, and

> we

> don't need a silly comment explaining the apparent duplication of the

> PMINTRMSK update.

> -Chris


drm-intel tree is not doing gen6_enable_rps_interrupts there yet ;)

-Michał
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 658a756..a71f946 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4840,6 +4840,11 @@  void gen6_rps_busy(struct drm_i915_private *dev_priv)
 {
 	mutex_lock(&dev_priv->rps.hw_lock);
 	if (dev_priv->rps.enabled) {
+		/* Ensure we start at the user's desired frequency */
+		intel_set_rps(dev_priv,
+			      clamp(dev_priv->rps.cur_freq,
+				    dev_priv->rps.min_freq_softlimit,
+				    dev_priv->rps.max_freq_softlimit));
 		if (dev_priv->pm_rps_events & (GEN6_PM_RP_DOWN_EI_EXPIRED | GEN6_PM_RP_UP_EI_EXPIRED))
 			gen6_rps_reset_ei(dev_priv);
 		I915_WRITE(GEN6_PMINTRMSK,