Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Subject: Re: [PATCH] drm/i915: Balance assert_rpm_wakelock_held() for !IS_ENABLED(CONFIG_PM)
Date: Fri, 26 Feb 2016 00:20:23 +0200	[thread overview]
Message-ID: <1456438823.24498.10.camel@intel.com> (raw)
In-Reply-To: <1456434628-22574-1-git-send-email-chris@chris-wilson.co.uk>

On Thu, 2016-02-25 at 21:10 +0000, Chris Wilson wrote:
> commit 09731280028ce03e6a27e1998137f1775a2839f3
> Author: Imre Deak <imre.deak@intel.com>
> Date:   Wed Feb 17 14:17:42 2016 +0200
> 
>     drm/i915: Add helper to get a display power ref if it was already
> enabled
> 
> left the rpm wakelock assertions unbalanced if CONFIG_PM was disabled
> as
> intel_runtime_pm_get_if_in_use() would return true without
> incrementing
> the local bookkeeping required for the assertions.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> CC: Mika Kuoppala <mika.kuoppala@intel.com>
> CC: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> CC: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Imre Deak <imre.deak@intel.com>

Arg, I broke this in v3. Thanks for catching it:
Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 26 ++++++++++++-----------
> ---
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c
> b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index e2329768902c..4172e73212cd 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -2365,22 +2365,20 @@ bool intel_runtime_pm_get_if_in_use(struct
> drm_i915_private *dev_priv)
>  {
>  	struct drm_device *dev = dev_priv->dev;
>  	struct device *device = &dev->pdev->dev;
> -	int ret;
>  
> -	if (!IS_ENABLED(CONFIG_PM))
> -		return true;
> +	if (IS_ENABLED(CONFIG_PM)) {
> +		int ret = pm_runtime_get_if_in_use(device);
>  
> -	ret = pm_runtime_get_if_in_use(device);
> -
> -	/*
> -	 * In cases runtime PM is disabled by the RPM core and we
> get an
> -	 * -EINVAL return value we are not supposed to call this
> function,
> -	 * since the power state is undefined. This applies atm to
> the
> -	 * late/early system suspend/resume handlers.
> -	 */
> -	WARN_ON_ONCE(ret < 0);
> -	if (ret <= 0)
> -		return false;
> +		/*
> +		 * In cases runtime PM is disabled by the RPM core
> and we get
> +		 * an -EINVAL return value we are not supposed to
> call this
> +		 * function, since the power state is undefined.
> This applies
> +		 * atm to the late/early system suspend/resume
> handlers.
> +		 */
> +		WARN_ON_ONCE(ret < 0);
> +		if (ret <= 0)
> +			return false;
> +	}
>  
>  	atomic_inc(&dev_priv->pm.wakeref_count);
>  	assert_rpm_wakelock_held(dev_priv);
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-02-25 22:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 21:10 [PATCH] drm/i915: Balance assert_rpm_wakelock_held() for !IS_ENABLED(CONFIG_PM) Chris Wilson
2016-02-25 22:20 ` Imre Deak [this message]
2016-02-26 14:05   ` [Intel-gfx] " Imre Deak
2016-02-26  7:00 ` ✗ Fi.CI.BAT: failure for " Patchwork
2016-02-26 11:02   ` Imre Deak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456438823.24498.10.camel@intel.com \
    --to=imre.deak@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox