public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] RFC: drm/i915: Take runtime pm wakelock during hangcheck
Date: Wed, 09 Dec 2015 16:02:53 +0200	[thread overview]
Message-ID: <1449669773.5354.9.camel@linux.intel.com> (raw)
In-Reply-To: <1449663763-915-1-git-send-email-chris@chris-wilson.co.uk>

On ke, 2015-12-09 at 12:22 +0000, Chris Wilson wrote:
> During hangcheck we access the hardware registers, for which we must
> hold a runtime pm reference. Hangcheck also should only be running
> whilst the GPU is active, and we hold a runtime pm whilst the GPU is
> busy. Therefore, if the runtime pm is suspended (no wakelocks held
> anywhere) we know the GPU is already idle and we can skip the
> hangcheck
> (and all further hangchecks until the next request is submitted to
> the
> GPU, waking it up).
> 
> Currently, hangcheck relies upon being flushed during
> intel_runtime_suspend() but is being done so too late causing invalid
> hardware access whilst the device is being suspend. By taking an
> explicit wakelock (albeit only if already awake) inside hangcheck we
> can
> remove the synchronous cancellation from the suspend function.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93121
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c         |  1 -
>  drivers/gpu/drm/i915/i915_irq.c         |  9 +++++++++
>  drivers/gpu/drm/i915/intel_drv.h        |  1 +
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 13 +++++++++++++
>  4 files changed, 23 insertions(+), 1 deletion(-)
> 

<SNIP>

> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -2233,6 +2233,19 @@ void intel_runtime_pm_get(struct
> drm_i915_private *dev_priv)
>  	WARN(dev_priv->pm.suspended, "Device still suspended.\n");
>  }
>  
> +bool intel_runtime_pm_tryget(struct drm_i915_private *dev_priv)
> +{
> +	/* XXX Ideally we would push this to pm_runtime_tryget() */

I think we first need to have that function upstream, I sent another
patch which fixes the same bug in a cleaner manner.

This could be incorporated to the series Imre is working on.

Regards, Joonas

> +#ifdef CONFIG_PM
> +	if (HAS_RUNTIME_PM(dev_priv)) {
> +		struct device *device = &dev_priv->dev->pdev->dev;
> +		return atomic_inc_unless_zero(&dev
> ->power.usage_count);
> +	}
> +#else
> +	return true;
> +#endif
> +}
> +
>  /**
>   * intel_runtime_pm_get_noresume - grab a runtime pm reference
>   * @dev_priv: i915 device instance
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2015-12-09 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 12:22 [PATCH] RFC: drm/i915: Take runtime pm wakelock during hangcheck Chris Wilson
2015-12-09 14:02 ` Joonas Lahtinen [this message]

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=1449669773.5354.9.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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