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
Cc: David Weinehall <david.weinehall@intel.com>
Subject: Re: [PATCH v2 2/4] drm/i915: Update domain tracking for GEM objects on hibernation
Date: Fri, 13 May 2016 10:40:51 +0300	[thread overview]
Message-ID: <1463125251.5008.3.camel@linux.intel.com> (raw)
In-Reply-To: <1463063296-7722-2-git-send-email-chris@chris-wilson.co.uk>

On to, 2016-05-12 at 15:28 +0100, Chris Wilson wrote:
> When creating the hibernation image, the CPU will read the pages of all
> objects and thus conflict with our domain tracking. We need to update
> our domain tracking to accurately reflect the state on restoration.
> 
> v2: Perform the domain tracking inside freeze, before the image is
> written, rather than upon restoration.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: David Weinehall <david.weinehall@intel.com>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_drv.c | 12 +++++++++++-
>  drivers/gpu/drm/i915/i915_drv.h |  2 ++
>  drivers/gpu/drm/i915/i915_gem.c | 28 ++++++++++++++++++++++++++++
>  3 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 6a2e7f84276b..dba03c026151 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1123,7 +1123,17 @@ static int i915_pm_freeze(struct device *dev)
>  
>  static int i915_pm_freeze_late(struct device *dev)
>  {
> -	return i915_pm_suspend_late(dev);
> +	int ret;
> +
> +	ret = i915_pm_suspend_late(dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = i915_gem_freeze_late(dev_to_i915(dev));
> +	if (ret)
> +		return ret;
> +
> +	return 0;
>  }
>  
>  /* thaw: called after creating the hibernation image, but before turning off. */
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 7a0b51301337..0a4255fa8895 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2961,6 +2961,8 @@ int i915_gem_wait_ioctl(struct drm_device *dev, void *data,
>  void i915_gem_load_init(struct drm_device *dev);
>  void i915_gem_load_cleanup(struct drm_device *dev);
>  void i915_gem_load_init_fences(struct drm_i915_private *dev_priv);
> +int i915_gem_freeze_late(struct drm_i915_private *dev_priv);
> +
>  void *i915_gem_object_alloc(struct drm_device *dev);
>  void i915_gem_object_free(struct drm_i915_gem_object *obj);
>  void i915_gem_object_init(struct drm_i915_gem_object *obj,
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index be75689455b2..7bd670e34ee5 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -5053,6 +5053,34 @@ void i915_gem_load_cleanup(struct drm_device *dev)
>  	kmem_cache_destroy(dev_priv->objects);
>  }
>  
> +int i915_gem_freeze_late(struct drm_i915_private *dev_priv)
> +{
> +	struct drm_i915_gem_object *obj;
> +
> +	/* Called just before we write the hibernation image.
> +	 *
> +	 * We need to update the domain tracking to reflect that the CPU
> +	 * will be accessing all the pages to create and restore from the
> +	 * hibernation, and so upon restoration those pages will be in the
> +	 * CPU domain.
> +	 *
> +	 * To make sure the hibernation image contains the latest state,
> +	 * we update that state just before writing out the image.
> +	 */
> +
> +	list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) {
> +		obj->base.read_domains = I915_GEM_DOMAIN_CPU;
> +		obj->base.write_domain = I915_GEM_DOMAIN_CPU;
> +	}
> +
> +	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
> +		obj->base.read_domains = I915_GEM_DOMAIN_CPU;
> +		obj->base.write_domain = I915_GEM_DOMAIN_CPU;
> +	}
> +
> +	return 0;
> +}
> +
>  void i915_gem_release(struct drm_device *dev, struct drm_file *file)
>  {
>  	struct drm_i915_file_private *file_priv = file->driver_priv;
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-05-13  7:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 11:41 Speed up resume by focused clflushing Chris Wilson
2016-05-12 11:41 ` [PATCH 1/4] drm/i915: Add distinct stubs for PM hibernation phases Chris Wilson
2016-05-12 11:52   ` Imre Deak
2016-05-12 12:01     ` Chris Wilson
2016-05-12 11:41 ` [PATCH 2/4] drm/i915: Update domain tracking for GEM objects on hibernation Chris Wilson
2016-05-12 11:41 ` [PATCH 3/4] drm/i915: Lazily migrate the objects after hibernation Chris Wilson
2016-05-12 11:41 ` [PATCH 4/4] drm/i915: Skip clearing the GGTT on full-ppgtt systems Chris Wilson
2016-05-12 12:27 ` ✓ Ro.CI.BAT: success for series starting with [1/4] drm/i915: Add distinct stubs for PM hibernation phases Patchwork
2016-05-12 12:37   ` Chris Wilson
2016-05-12 14:28 ` [PATCH v2 1/4] " Chris Wilson
2016-05-12 14:28   ` [PATCH v2 2/4] drm/i915: Update domain tracking for GEM objects on hibernation Chris Wilson
2016-05-13  7:40     ` Joonas Lahtinen [this message]
2016-05-12 14:28   ` [PATCH v2 3/4] drm/i915: Lazily migrate the objects after hibernation Chris Wilson
2016-05-13  7:46     ` Joonas Lahtinen
2016-05-13 13:17     ` David Weinehall
2016-05-12 14:28   ` [PATCH v2 4/4] drm/i915: Skip clearing the GGTT on full-ppgtt systems Chris Wilson
2016-05-13  7:46     ` Joonas Lahtinen
2016-05-13 13:17     ` David Weinehall
2016-05-13  7:39   ` [PATCH v2 1/4] drm/i915: Add distinct stubs for PM hibernation phases Joonas Lahtinen
2016-05-13 14:30 ` [CI " Chris Wilson
2016-05-13 14:30   ` [CI 2/4] drm/i915: Update domain tracking for GEM objects on hibernation Chris Wilson
2016-05-13 14:30   ` [CI 3/4] drm/i915: Lazily migrate the objects after hibernation Chris Wilson
2016-05-13 14:30   ` [CI 4/4] drm/i915: Skip clearing the GGTT on full-ppgtt systems Chris Wilson
2016-05-13 16:10 ` ✗ Ro.CI.BAT: failure for series starting with [1/4] drm/i915: Add distinct stubs for PM hibernation phases (rev4) Patchwork
2016-05-13 17:52 ` [CI 1/4] drm/i915: Add distinct stubs for PM hibernation phases Chris Wilson
2016-05-13 17:52   ` [CI 2/4] drm/i915: Update domain tracking for GEM objects on hibernation Chris Wilson
2016-05-13 17:52   ` [CI 3/4] drm/i915: Lazily migrate the objects after hibernation Chris Wilson
2016-05-13 17:52   ` [CI 4/4] drm/i915: Skip clearing the GGTT on full-ppgtt systems Chris Wilson
2016-05-13 19:30 ` ✗ Ro.CI.BAT: failure for series starting with [1/4] drm/i915: Add distinct stubs for PM hibernation phases (rev7) Patchwork

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=1463125251.5008.3.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=david.weinehall@intel.com \
    --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