All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Intel GFX <intel-gfx@lists.freedesktop.org>
Cc: Ben Widawsky <ben@bwidawsk.net>
Subject: [PATCH 3/5] [v2] drm/i915: Create a global list of vms
Date: Tue, 16 Jul 2013 16:50:07 -0700	[thread overview]
Message-ID: <1374018609-1047-3-git-send-email-ben@bwidawsk.net> (raw)
In-Reply-To: <1374018609-1047-1-git-send-email-ben@bwidawsk.net>

After we plumb our code to support multiple address spaces (VMs), there
are a few situations where we want to be able to traverse the list of
all address spaces in the system. Cases like eviction, or error state
collection are obvious example.

v2: Delete the global link instead of the list head. While this in and
of itself shouldn't be really be a problem, doing this allows us to WARN
on an non-empty list, which is a problem. (Daniel)

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_dma.c | 6 ++++++
 drivers/gpu/drm/i915/i915_drv.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 5dd4fa5..fd52de7 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1492,6 +1492,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 
 	i915_dump_device_info(dev_priv);
 
+	INIT_LIST_HEAD(&dev_priv->vm_list);
+	INIT_LIST_HEAD(&dev_priv->gtt.base.global_link);
+	list_add(&dev_priv->gtt.base.global_link, &dev_priv->vm_list);
+
 	if (i915_get_bridge_dev(dev)) {
 		ret = -EIO;
 		goto free_priv;
@@ -1758,6 +1762,8 @@ int i915_driver_unload(struct drm_device *dev)
 			i915_free_hws(dev);
 	}
 
+	list_del(&dev_priv->gtt.base.global_link);
+	WARN_ON(!list_empty(&dev_priv->vm_list));
 	drm_mm_takedown(&dev_priv->gtt.base.mm);
 	if (dev_priv->regs != NULL)
 		pci_iounmap(dev->pdev, dev_priv->regs);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 680eac7..c44e6c0 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -449,6 +449,7 @@ typedef uint32_t gen6_gtt_pte_t;
 struct i915_address_space {
 	struct drm_mm mm;
 	struct drm_device *dev;
+	struct list_head global_link;
 	unsigned long start;		/* Start offset always 0 for dri2 */
 	size_t total;		/* size addr space maps (ex. 2GB for ggtt) */
 
@@ -1120,6 +1121,7 @@ typedef struct drm_i915_private {
 	enum modeset_restore modeset_restore;
 	struct mutex modeset_restore_lock;
 
+	struct list_head vm_list; /* Global list of all address spaces */
 	struct i915_gtt gtt; /* VMA representing the global address space */
 
 	struct i915_gem_mm mm;
-- 
1.8.3.3

  parent reply	other threads:[~2013-07-16 23:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 23:50 [PATCH 1/5] [v3] drm/i915: Move gtt and ppgtt under address space umbrella Ben Widawsky
2013-07-16 23:50 ` [PATCH 2/5] [v2] drm/i915: Put the mm in the parent address space Ben Widawsky
2013-07-16 23:50 ` Ben Widawsky [this message]
2013-07-16 23:50 ` [PATCH 4/5] [v2] drm/i915: Move active/inactive lists to new mm Ben Widawsky
2013-07-16 23:50 ` [PATCH 5/5] [v5] drm/i915: Create VMAs Ben Widawsky
2013-07-17 14:43   ` Imre Deak
2013-07-17 19:19   ` [PATCH 5/6] drm/i915: Free stolen node on failed preallocation Ben Widawsky
2013-07-17 19:19     ` [PATCH 6/6] drm/i915: Create VMAs Ben Widawsky
2013-07-17 20:27       ` Daniel Vetter
2013-07-18  0:12       ` Chris Wilson
2013-07-18  2:31         ` Ben Widawsky
2013-07-18  8:19           ` Chris Wilson
2013-07-18  2:32         ` [PATCH] drm/i915: Don't try to deref an unbound VMA Ben Widawsky
2013-07-18  6:47           ` Daniel Vetter
2013-07-18 12:08       ` [PATCH 6/6] drm/i915: Create VMAs 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=1374018609-1047-3-git-send-email-ben@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --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.