All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Imre Deak <imre.deak@linux.intel.com>, Akash Goel <akash.goel@intel.com>
Subject: Re: [PATCH] drm/i915: Migrate stolen objects before hibernation
Date: Tue, 30 Jun 2015 11:31:38 +0100	[thread overview]
Message-ID: <20150630103138.GF1381@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <1435658288-31656-1-git-send-email-chris@chris-wilson.co.uk>

On Tue, Jun 30, 2015 at 10:58:08AM +0100, Chris Wilson wrote:
> +int
> +i915_gem_freeze(struct drm_device *dev)
> +{
> +	/* Called before freeze when hibernating */
> +	struct drm_i915_private *i915 = to_i915(dev);
> +	struct drm_i915_gem_object *obj, *tmp;
> +	int ret;
> +
> +	/* Across hibernation, the stolen area is not preserved.
> +	 * Anything inside stolen must copied back to normal
> +	 * memory if we wish to preserve it.
> +	 */

And I forgot to add the double pass + reference/unreference dance here

> +	list_for_each_entry_safe(obj, tmp, &i915->mm.stolen_list, stolen_link) {
> +		if (obj->madv != I915_MADV_WILLNEED) {
> +			/* XXX any point in setting this? The objects for which
> +			 * we preserve never unset it afterwards.
> +			 */
> +			obj->madv = __I915_MADV_PURGED;
> +			continue;
> +		}
> +
> +		ret = i915_gem_object_migrate_stolen_to_shmemfs(obj);
> +		if (ret)
> +			return ret;
> +	}

should be

+	INIT_LIST_HEAD(&migrate);
+       list_for_each_entry_safe(obj, tmp, &i915->mm.stolen_list, stolen_link) {
+               if (obj->madv != I915_MADV_WILLNEED)
+                       continue;
+
+               /* In the general case, this object may only be alive due to
+                * an active reference, and that may disappear when we unbind
+                * any of the objects (and so wait upon the GPU and retire
+                * requests). To prevent one of the objects from disappearing
+                * beneath us, we need to take a reference to each as we
+                * build the migration list.
+                *
+                * This is similar to the strategy required whilst shrinking
+                * or evicting objects (for the same reason).
+                */
+               drm_gem_object_reference(&obj->base);
+               list_move(&obj->stolen_link, &migrate);
+       }
+
+       ret = 0;
+       list_for_each_entry_safe(obj, tmp, &migrate, stolen_link) {
+               if (ret == 0)
+                       ret = i915_gem_object_migrate_stolen_to_shmemfs(obj);
+               drm_gem_object_unreference(&obj->base);
+       }
+       list_splice(&migrate, &i915->mm.stolen_list);
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-06-30 10:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29 17:28 [PATCH] Revert "drm/i915: Allocate context objects from stolen" ville.syrjala
2015-06-29 19:53 ` Chris Wilson
2015-06-29 20:05   ` Chris Wilson
2015-06-30  6:37     ` Akash Goel
2015-06-30  8:31       ` Chris Wilson
2015-06-30  9:58       ` [PATCH] drm/i915: Migrate stolen objects before hibernation Chris Wilson
2015-06-30 10:11         ` Chris Wilson
2015-06-30 10:31         ` Chris Wilson [this message]
2015-06-30 10:54         ` Daniel Vetter
2015-06-30 11:03           ` Chris Wilson
2015-06-30 11:22             ` Daniel Vetter
2015-06-30 11:32               ` Chris Wilson
2015-06-30 11:54                 ` Daniel Vetter
2015-06-30 12:37                   ` Chris Wilson
2015-06-30 11:16           ` Chris Wilson
2015-06-30 12:00             ` Daniel Vetter
2015-06-30 11:20           ` Chris Wilson
2015-06-30 12:03             ` Daniel Vetter
2015-06-30 11:25           ` Chris Wilson
2015-06-30 12:07             ` Daniel Vetter
2015-06-30 12:47               ` Chris Wilson
2015-07-01 12:47                 ` Daniel Vetter
2015-07-01 12:59                   ` Chris Wilson
2015-07-01 13:49                     ` Daniel Vetter
2015-06-30  8:31 ` [PATCH] Revert "drm/i915: Allocate context objects from stolen" Jani Nikula
2015-06-30  9:44   ` Chris Wilson
2015-06-30 10:07     ` Ville Syrjälä

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=20150630103138.GF1381@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=akash.goel@intel.com \
    --cc=imre.deak@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.