Skip to contentSkip to conversation

drm/i915: Demote unknown param to DRM_DEBUG

PATCH In review Ben Widawsky 3 participants 20 messages May 31, 2013 – Jun 3, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 drm/i915: Demote unknown param to DRM_DEBUG

It's not terribly interesting to know that a parameter doesn't exist, and it can get in the way of interesting messages, especially with the staggered VECS merging as we've done.

---
 drivers/gpu/drm/i915/i915_dma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +1 -2
index 3cd2b60..57d2ba9 100644
@@ -999,8 +999,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
 		value = 1;
 		break;
 	default:
-		DRM_DEBUG_DRIVER("Unknown parameter %d\n",
-				 param->param);
+		DRM_DEBUG("Unknown parameter %d\n", param->param);
 		return -EINVAL;
 	}
 
Signature · 1 line
1.8.3
#1 lore raw

PATCH 2/4 drm/i915: Unbind the fb

This is the only place I could find where we don't already unbind the object before freeing it. This change will allow us to have a nice assertion on free about whether or not an object still has pinned pages.

---
 drivers/gpu/drm/i915/intel_fb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_fb.c +1 -0
index 6b7c3ca..cd92889 100644
@@ -209,6 +209,7 @@ static void intel_fbdev_destroy(struct drm_device *dev,
 	drm_framebuffer_unregister_private(&ifb->base);
 	drm_framebuffer_cleanup(&ifb->base);
 	if (ifb->obj) {
+		i915_gem_object_unbind(to_intel_bo(&ifb->obj->base));
 		drm_gem_object_unreference_unlocked(&ifb->obj->base);
 		ifb->obj = NULL;
 	}
Signature · 1 line
1.8.3
#2 lore raw

PATCH v2 2/4 drm/i915: Unbind the fb

This is the only place I could find where we don't already unbind the object before freeing it. This change will allow us to have a nice assertion on free about whether or not an object still has pinned pages.

v2: Just use the i915 object instead of casting

---
 drivers/gpu/drm/i915/intel_fb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_fb.c +1 -0
index 6b7c3ca..bc81de6 100644
@@ -209,6 +209,7 @@ static void intel_fbdev_destroy(struct drm_device *dev,
 	drm_framebuffer_unregister_private(&ifb->base);
 	drm_framebuffer_cleanup(&ifb->base);
 	if (ifb->obj) {
+		i915_gem_object_unbind(ifb->obj);
 		drm_gem_object_unreference_unlocked(&ifb->obj->base);
 		ifb->obj = NULL;
 	}
Signature · 1 line
1.8.3
#3 lore raw

Re: [PATCH 2/4] [v2] drm/i915: Unbind the fb

Quoted 5 lines · Ben Widawsky

This is the only place I could find where we don't already unbind the object before freeing it. This change will allow us to have a nice assertion on free about whether or not an object still has pinned pages.

v2: Just use the i915 object instead of casting

The patch is flawed in that we try to do the unbind without mutex protection. But it should already be unbound in free_object() anyway - and doing so here is unlikely to fix the WARN_ON (presuming that is what you are chasing).
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#4 lore raw

Re: [PATCH 2/4] [v2] drm/i915: Unbind the fb

Quoted 5 lines · Chris Wilson
Quoted 4 lines · Ben Widawsky

This is the only place I could find where we don't already unbind the object before freeing it. This change will allow us to have a nice assertion on free about whether or not an object still has pinned pages.

Quoted 10 lines
Quoted 1 line

v2: Just use the i915 object instead of casting

The patch is flawed in that we try to do the unbind without mutex protection. But it should already be unbound in free_object() anyway - and doing so here is unlikely to fix the WARN_ON (presuming that is what you are chasing).
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre

Agreed. This patch is junk. I made the mistake of working on it when I should have been in bed.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#5 lore raw

PATCH 3/4 drm/i915: unpin pages at unbind

In reply to Ben Widawsky

If we properly keep track of the pages_pin_count, then when we later add multiple address spaces, the put_pages doesn't need any special checks to be able to perform it's job.

---
 drivers/gpu/drm/i915/i915_gem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +3 -2
index e5b6a92..ad0c69d 100644
@@ -2508,6 +2508,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
 		obj->has_aliasing_ppgtt_mapping = 0;
 	}
 	i915_gem_gtt_finish_object(obj);
+	i915_gem_object_unpin_pages(obj);
 
 	list_del(&obj->mm_list);
 	list_move_tail(&obj->gtt_list, &dev_priv->mm.unbound_list);
@@ -3057,7 +3058,6 @@ search_free:
 
 	obj->map_and_fenceable = mappable && fenceable;
 
-	i915_gem_object_unpin_pages(obj);
 	trace_i915_gem_object_bind(obj, map_and_fenceable);
 	i915_gem_verify_gtt(dev);
 	return 0;
@@ -3857,7 +3857,8 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
 		dev_priv->mm.interruptible = was_interruptible;
 	}
 
-	obj->pages_pin_count = 0;
+	if (WARN_ON(obj->pages_pin_count))
+		obj->pages_pin_count = 0;
 	i915_gem_object_put_pages(obj);
 	i915_gem_object_free_mmap_offset(obj);
 	i915_gem_object_release_stolen(obj);
Signature · 1 line
1.8.3
Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] drm/i915: unpin pages at unbind

Quoted 6 lines · Ben Widawsky

If we properly keep track of the pages_pin_count, then when we later add multiple address spaces, the put_pages doesn't need any special checks to be able to perform it's job.

Like. Since we don't expose the pages_pin_count to the user (unlike the regular pin_count & pin_ioctl), then we should never have to perform a cleanup in free_object(). Though as you have seen, we obviously need to let this patch soak for a bit in case we missed some.

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#7 lore raw

PATCH 1/2 drm/i915: Make stolen use pin pages

This makes it easier to catch leaks.

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -1
index 89cbfab..bc593e3 100644
@@ -279,7 +279,7 @@ _i915_gem_object_create_stolen(struct drm_device *dev,
 		goto cleanup;
 
 	obj->has_dma_mapping = true;
-	obj->pages_pin_count = 1;
+	i915_gem_object_pin_pages(obj);
 	obj->stolen = stolen;
 
 	obj->base.write_domain = I915_GEM_DOMAIN_GTT;
Signature · 1 line
1.8.3
#8 lore raw

PATCH 2/2 drm/i915: Unpin stolen pages

The way the stolen handling works is we take a pin on the backing pages, but we never actually get a reference to the bo. On freeing objects allocated with stolen memory, the final unref will end up freeing the object with pinned pages count left. To enable an assertion to catch bugs in this code path, this patch cleans up that remaining pin.

---
 drivers/gpu/drm/i915/i915_gem.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +5 -0
index e5b6a92..a18a485 100644
@@ -3857,6 +3857,11 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
 		dev_priv->mm.interruptible = was_interruptible;
 	}
 
+	/* Stolen objects don't hold a ref, but do hold pin count. Fix that up
+	 * before progressing. */
+	if (obj->stolen)
+		i915_gem_object_unpin_pages(obj);
+
 	obj->pages_pin_count = 0;
 	i915_gem_object_put_pages(obj);
 	i915_gem_object_free_mmap_offset(obj);
Signature · 1 line
1.8.3
Reviewed-by on v1 2/2
#9 lore raw

Re: [PATCH 2/2] drm/i915: Unpin stolen pages

Quoted 7 lines · Ben Widawsky

The way the stolen handling works is we take a pin on the backing pages, but we never actually get a reference to the bo. On freeing objects allocated with stolen memory, the final unref will end up freeing the object with pinned pages count left. To enable an assertion to catch bugs in this code path, this patch cleans up that remaining pin.

That neatly explains the WARN. Not too happy about accumulating lots of backing storage specific processing into free_object, but that can be fixed up later (there is an obj->ops->release() pending).

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#10 lore raw

Re: [PATCH 2/2] drm/i915: Unpin stolen pages

Quoted 7 lines · Chris Wilson
Quoted 6 lines · Ben Widawsky

The way the stolen handling works is we take a pin on the backing pages, but we never actually get a reference to the bo. On freeing objects allocated with stolen memory, the final unref will end up freeing the object with pinned pages count left. To enable an assertion to catch bugs in this code path, this patch cleans up that remaining pin.

Quoted 5 lines
Quoted 1 line

That neatly explains the WARN. Not too happy about accumulating lots of backing storage specific processing into free_object, but that can be fixed up later (there is an obj->ops->release() pending).

I'm more irked with the semantic overloading of object pinning. Might be cleaner to otherwise mark stolen obejcts as not shrinkable instead of pinning them for their entire lifetime. But we can bikeshed that later on ;-)
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#11 lore raw

Re: [PATCH 2/2] drm/i915: Unpin stolen pages

Quoted 9 lines · Daniel Vetter
Quoted 3 lines · Chris Wilson

That neatly explains the WARN. Not too happy about accumulating lots of backing storage specific processing into free_object, but that can be fixed up later (there is an obj->ops->release() pending).

I'm more irked with the semantic overloading of object pinning. Might be cleaner to otherwise mark stolen obejcts as not shrinkable instead of pinning them for their entire lifetime. But we can bikeshed that later on ;-)

Some merit to that argument, but it still feels correct to say that the stolen pages are pinned for their lifetime. Given obj->ops->release(), it does actually become simpler to not mess around with pin_count. So later it is.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#12 lore raw

Re: [PATCH 2/2] drm/i915: Unpin stolen pages

Quoted 11 lines · Chris Wilson
Quoted 9 lines · Daniel Vetter
Quoted 3 lines · Chris Wilson

That neatly explains the WARN. Not too happy about accumulating lots of backing storage specific processing into free_object, but that can be fixed up later (there is an obj->ops->release() pending).

I'm more irked with the semantic overloading of object pinning. Might be cleaner to otherwise mark stolen obejcts as not shrinkable instead of pinning them for their entire lifetime. But we can bikeshed that later on ;-)

Quoted 4 lines

Some merit to that argument, but it still feels correct to say that the stolen pages are pinned for their lifetime. Given obj->ops->release(), it does actually become simpler to not mess around with pin_count. So later it is.

I was more unhappy that pin_count has different meanings, until I've noticed that we've fixed that up already with the introduction of ->pages_pin_count. Shouldn't stolen mem just hold a reference on that one? After all unbinding from the gtt is ok with stolen memory, but dropping the backing storage in the shrinker won't work. Not that we currently use stolen for anything else than permanently pinned bos.

Reading through the code we have a bit an unclear relationship between pages_pin_count and the (gtt) pin_count, so this approach would need some clarification (especially around the shrinker).

And it would still leave us with a special case in free, so your ->release callback still has uses ;-)
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#13 lore raw

Re: [PATCH 2/2] drm/i915: Unpin stolen pages

Quoted 17 lines · Daniel Vetter
Quoted 11 lines · Chris Wilson
Quoted 9 lines · Daniel Vetter
Quoted 3 lines · Chris Wilson

That neatly explains the WARN. Not too happy about accumulating lots of backing storage specific processing into free_object, but that can be fixed up later (there is an obj->ops->release() pending).

I'm more irked with the semantic overloading of object pinning. Might be cleaner to otherwise mark stolen obejcts as not shrinkable instead of pinning them for their entire lifetime. But we can bikeshed that later on ;-)

Quoted 4 lines

Some merit to that argument, but it still feels correct to say that the stolen pages are pinned for their lifetime. Given obj->ops->release(), it does actually become simpler to not mess around with pin_count. So later it is.

Quoted 6 lines

I was more unhappy that pin_count has different meanings, until I've noticed that we've fixed that up already with the introduction of ->pages_pin_count. Shouldn't stolen mem just hold a reference on that one? After all unbinding from the gtt is ok with stolen memory, but dropping the backing storage in the shrinker won't work. Not that we currently use stolen for anything else than permanently pinned bos.

As mentioned on irc, stolen does use the pages_pin_count for its purposes. The purpose of this patch is purely to allow sanity checking the pages_pin_count with a WARN_ON during free which seems sensible but not strictly required.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#14 lore raw

Re: [PATCH 2/2] drm/i915: Unpin stolen pages

Quoted 25 lines · Chris Wilson
Quoted 17 lines · Daniel Vetter
Quoted 11 lines · Chris Wilson
Quoted 9 lines · Daniel Vetter
Quoted 3 lines · Chris Wilson

That neatly explains the WARN. Not too happy about accumulating lots of backing storage specific processing into free_object, but that can be fixed up later (there is an obj->ops->release() pending).

I'm more irked with the semantic overloading of object pinning. Might be cleaner to otherwise mark stolen obejcts as not shrinkable instead of pinning them for their entire lifetime. But we can bikeshed that later on ;-)

Quoted 4 lines

Some merit to that argument, but it still feels correct to say that the stolen pages are pinned for their lifetime. Given obj->ops->release(), it does actually become simpler to not mess around with pin_count. So later it is.

Quoted 6 lines

I was more unhappy that pin_count has different meanings, until I've noticed that we've fixed that up already with the introduction of ->pages_pin_count. Shouldn't stolen mem just hold a reference on that one? After all unbinding from the gtt is ok with stolen memory, but dropping the backing storage in the shrinker won't work. Not that we currently use stolen for anything else than permanently pinned bos.

Quoted 4 lines

As mentioned on irc, stolen does use the pages_pin_count for its purposes. The purpose of this patch is purely to allow sanity checking the pages_pin_count with a WARN_ON during free which seems sensible but not strictly required.

Yeah, silly me didn't read the code before sending a knee-jerk mail ;-)

Series merged (hopefully in the right order and all, please check), thanks for the patches and review.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#15 lore raw

Re: [PATCH 2/2] drm/i915: Unpin stolen pages

Quoted 31 lines · Daniel Vetter
Quoted 25 lines · Chris Wilson
Quoted 17 lines · Daniel Vetter
Quoted 11 lines · Chris Wilson
Quoted 9 lines · Daniel Vetter
Quoted 3 lines · Chris Wilson

That neatly explains the WARN. Not too happy about accumulating lots of backing storage specific processing into free_object, but that can be fixed up later (there is an obj->ops->release() pending).

I'm more irked with the semantic overloading of object pinning. Might be cleaner to otherwise mark stolen obejcts as not shrinkable instead of pinning them for their entire lifetime. But we can bikeshed that later on ;-)

Quoted 4 lines

Some merit to that argument, but it still feels correct to say that the stolen pages are pinned for their lifetime. Given obj->ops->release(), it does actually become simpler to not mess around with pin_count. So later it is.

Quoted 6 lines

I was more unhappy that pin_count has different meanings, until I've noticed that we've fixed that up already with the introduction of ->pages_pin_count. Shouldn't stolen mem just hold a reference on that one? After all unbinding from the gtt is ok with stolen memory, but dropping the backing storage in the shrinker won't work. Not that we currently use stolen for anything else than permanently pinned bos.

Quoted 4 lines

As mentioned on irc, stolen does use the pages_pin_count for its purposes. The purpose of this patch is purely to allow sanity checking the pages_pin_count with a WARN_ON during free which seems sensible but not strictly required.

Quoted 11 lines

Yeah, silly me didn't read the code before sending a knee-jerk mail ;-)

Series merged (hopefully in the right order and all, please check), thanks for the patches and review.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Order looks good. Thanks.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#16 lore raw

Re: [PATCH 1/2] drm/i915: Make stolen use pin pages

In reply to Ben Widawsky

This should have been in reply to patch 2, sorry...

Quoted 23 lines · Ben Widawsky

This makes it easier to catch leaks.

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -1
index 89cbfab..bc593e3 100644
@@ -279,7 +279,7 @@ _i915_gem_object_create_stolen(struct drm_device *dev,
 		goto cleanup;
 
 	obj->has_dma_mapping = true;
-	obj->pages_pin_count = 1;
+	i915_gem_object_pin_pages(obj);
 	obj->stolen = stolen;
 
 	obj->base.write_domain = I915_GEM_DOMAIN_GTT;
Signature · 1 line
1.8.3
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#17 lore raw

PATCH 4/4 drm/i915: Rename the gtt_list to global_list

In reply to Ben Widawsky

Since it will be used for the global bound/unbound list with full PPGTT, this helps clarify things for upcoming code rework.

---
 drivers/gpu/drm/i915/i915_debugfs.c    | 11 ++++++-----
 drivers/gpu/drm/i915/i915_drv.h        |  2 +-
 drivers/gpu/drm/i915/i915_gem.c        | 23 ++++++++++++-----------
 drivers/gpu/drm/i915/i915_gem_gtt.c    |  4 ++--
 drivers/gpu/drm/i915/i915_gem_stolen.c |  2 +-
 drivers/gpu/drm/i915/i915_irq.c        |  6 +++---
 6 files changed, 25 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +6 -5
index 2eb572a..750e13e 100644
@@ -215,7 +215,7 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
 		   dev_priv->mm.object_memory);
 
 	size = count = mappable_size = mappable_count = 0;
-	count_objects(&dev_priv->mm.bound_list, gtt_list);
+	count_objects(&dev_priv->mm.bound_list, global_list);
 	seq_printf(m, "%u [%u] objects, %zu [%zu] bytes in gtt\n",
 		   count, mappable_count, size, mappable_size);
 
@@ -230,7 +230,7 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
 		   count, mappable_count, size, mappable_size);
 
 	size = count = purgeable_size = purgeable_count = 0;
-	list_for_each_entry(obj, &dev_priv->mm.unbound_list, gtt_list) {
+	list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) {
 		size += obj->base.size, ++count;
 		if (obj->madv == I915_MADV_DONTNEED)
 			purgeable_size += obj->base.size, ++purgeable_count;
@@ -238,7 +238,7 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
 	seq_printf(m, "%u unbound objects, %zu bytes\n", count, size);
 
 	size = count = mappable_size = mappable_count = 0;
-	list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list) {
+	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
 		if (obj->fault_mappable) {
 			size += obj->gtt_space->size;
 			++count;
@@ -283,7 +283,7 @@ static int i915_gem_gtt_info(struct seq_file *m, void* data)
 		return ret;
 
 	total_obj_size = total_gtt_size = count = 0;
-	list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list) {
+	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
 		if (list == PINNED_LIST && obj->pin_count == 0)
 			continue;
 
@@ -1924,7 +1924,8 @@ i915_drop_caches_set(void *data, u64 val)
 	}
 
 	if (val & DROP_UNBOUND) {
-		list_for_each_entry_safe(obj, next, &dev_priv->mm.unbound_list, gtt_list)
+		list_for_each_entry_safe(obj, next, &dev_priv->mm.unbound_list,
+					 global_list)
 			if (obj->pages_pin_count == 0) {
 				ret = i915_gem_object_put_pages(obj);
 				if (ret)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index b6f2968..8153873 100644
@@ -1154,7 +1154,7 @@ struct drm_i915_gem_object {
 	struct drm_mm_node *gtt_space;
 	/** Stolen memory for this object, instead of being backed by shmem. */
 	struct drm_mm_node *stolen;
-	struct list_head gtt_list;
+	struct list_head global_list;
 
 	/** This object's place on the active/inactive lists */
 	struct list_head ring_list;
drivers/gpu/drm/i915/i915_gem.c +12 -11
index ad0c69d..22499e7 100644
@@ -176,7 +176,7 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
 
 	pinned = 0;
 	mutex_lock(&dev->struct_mutex);
-	list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list)
+	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list)
 		if (obj->pin_count)
 			pinned += obj->gtt_space->size;
 	mutex_unlock(&dev->struct_mutex);
@@ -1676,7 +1676,7 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj)
 	/* ->put_pages might need to allocate memory for the bit17 swizzle
 	 * array, hence protect them from being reaped by removing them from gtt
 	 * lists early. */
-	list_del(&obj->gtt_list);
+	list_del(&obj->global_list);
 
 	ops->put_pages(obj);
 	obj->pages = NULL;
@@ -1696,7 +1696,7 @@ __i915_gem_shrink(struct drm_i915_private *dev_priv, long target,
 
 	list_for_each_entry_safe(obj, next,
 				 &dev_priv->mm.unbound_list,
-				 gtt_list) {
+				 global_list) {
 		if ((i915_gem_object_is_purgeable(obj) || !purgeable_only) &&
 		    i915_gem_object_put_pages(obj) == 0) {
 			count += obj->base.size >> PAGE_SHIFT;
@@ -1733,7 +1733,8 @@ i915_gem_shrink_all(struct drm_i915_private *dev_priv)
 
 	i915_gem_evict_everything(dev_priv->dev);
 
-	list_for_each_entry_safe(obj, next, &dev_priv->mm.unbound_list, gtt_list)
+	list_for_each_entry_safe(obj, next, &dev_priv->mm.unbound_list,
+				 global_list)
 		i915_gem_object_put_pages(obj);
 }
 
@@ -1858,7 +1859,7 @@ i915_gem_object_get_pages(struct drm_i915_gem_object *obj)
 	if (ret)
 		return ret;
 
-	list_add_tail(&obj->gtt_list, &dev_priv->mm.unbound_list);
+	list_add_tail(&obj->global_list, &dev_priv->mm.unbound_list);
 	return 0;
 }
 
@@ -2511,7 +2512,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
 	i915_gem_object_unpin_pages(obj);
 
 	list_del(&obj->mm_list);
-	list_move_tail(&obj->gtt_list, &dev_priv->mm.unbound_list);
+	list_move_tail(&obj->global_list, &dev_priv->mm.unbound_list);
 	/* Avoid an unnecessary call to unbind on rebind. */
 	obj->map_and_fenceable = true;
 
@@ -2919,7 +2920,7 @@ static void i915_gem_verify_gtt(struct drm_device *dev)
 	struct drm_i915_gem_object *obj;
 	int err = 0;
 
-	list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
+	list_for_each_entry(obj, &dev_priv->mm.gtt_list, global_list) {
 		if (obj->gtt_space == NULL) {
 			printk(KERN_ERR "object found on GTT list with no space reserved\n");
 			err++;
@@ -3043,7 +3044,7 @@ search_free:
 		return ret;
 	}
 
-	list_move_tail(&obj->gtt_list, &dev_priv->mm.bound_list);
+	list_move_tail(&obj->global_list, &dev_priv->mm.bound_list);
 	list_add_tail(&obj->mm_list, &dev_priv->mm.inactive_list);
 
 	obj->gtt_space = node;
@@ -3757,7 +3758,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
 			  const struct drm_i915_gem_object_ops *ops)
 {
 	INIT_LIST_HEAD(&obj->mm_list);
-	INIT_LIST_HEAD(&obj->gtt_list);
+	INIT_LIST_HEAD(&obj->global_list);
 	INIT_LIST_HEAD(&obj->ring_list);
 	INIT_LIST_HEAD(&obj->exec_list);
 
@@ -4499,10 +4500,10 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
 	}
 
 	cnt = 0;
-	list_for_each_entry(obj, &dev_priv->mm.unbound_list, gtt_list)
+	list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list)
 		if (obj->pages_pin_count == 0)
 			cnt += obj->base.size >> PAGE_SHIFT;
-	list_for_each_entry(obj, &dev_priv->mm.inactive_list, gtt_list)
+	list_for_each_entry(obj, &dev_priv->mm.inactive_list, global_list)
 		if (obj->pin_count == 0 && obj->pages_pin_count == 0)
 			cnt += obj->base.size >> PAGE_SHIFT;
 
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -2
index ddad13f..5101ab6 100644
@@ -439,7 +439,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
 	dev_priv->gtt.gtt_clear_range(dev, dev_priv->gtt.start / PAGE_SIZE,
 				      dev_priv->gtt.total / PAGE_SIZE);
 
-	list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list) {
+	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
 		i915_gem_clflush_object(obj);
 		i915_gem_gtt_bind_object(obj, obj->cache_level);
 	}
@@ -631,7 +631,7 @@ void i915_gem_setup_global_gtt(struct drm_device *dev,
 		dev_priv->mm.gtt_space.color_adjust = i915_gtt_color_adjust;
 
 	/* Mark any preallocated objects as occupied */
-	list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list) {
+	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
 		DRM_DEBUG_KMS("reserving preallocated space: %x + %zx\n",
 			      obj->gtt_offset, obj->base.size);
 
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -1
index 89cbfab..689e291 100644
@@ -383,7 +383,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
 	obj->gtt_offset = gtt_offset;
 	obj->has_global_gtt_mapping = 1;
 
-	list_add_tail(&obj->gtt_list, &dev_priv->mm.bound_list);
+	list_add_tail(&obj->global_list, &dev_priv->mm.bound_list);
 	list_add_tail(&obj->mm_list, &dev_priv->mm.inactive_list);
 
 	return obj;
drivers/gpu/drm/i915/i915_irq.c +3 -3
index da5c9ab..83ec610 100644
@@ -1647,7 +1647,7 @@ static u32 capture_pinned_bo(struct drm_i915_error_buffer *err,
 	struct drm_i915_gem_object *obj;
 	int i = 0;
 
-	list_for_each_entry(obj, head, gtt_list) {
+	list_for_each_entry(obj, head, global_list) {
 		if (obj->pin_count == 0)
 			continue;
 
@@ -1789,7 +1789,7 @@ static void i915_gem_record_active_context(struct intel_ring_buffer *ring,
 	if (ring->id != RCS || !error->ccid)
 		return;
 
-	list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list) {
+	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
 		if ((error->ccid & PAGE_MASK) == obj->gtt_offset) {
 			ering->ctx = i915_error_object_create_sized(dev_priv,
 								    obj, 1);
@@ -1926,7 +1926,7 @@ static void i915_capture_error_state(struct drm_device *dev)
 	list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list)
 		i++;
 	error->active_bo_count = i;
-	list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list)
+	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list)
 		if (obj->pin_count)
 			i++;
 	error->pinned_bo_count = i - error->active_bo_count;
Signature · 1 line
1.8.3
Reviewed-by on v1 4/4
#18 lore raw

Re: [PATCH 4/4] drm/i915: Rename the gtt_list to global_list

Quoted 5 lines · Ben Widawsky

Since it will be used for the global bound/unbound list with full PPGTT, this helps clarify things for upcoming code rework.

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Reviewed-by on v1 1/4
#19 lore raw
In reply to Ben Widawsky
Quoted 5 lines · Ben Widawsky

It's not terribly interesting to know that a parameter doesn't exist, and it can get in the way of interesting messages, especially with the staggered VECS merging as we've done.

The idiom we have is DRM_DEBUG() for informative messages after user error, so

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre