Skip to contentSkip to conversation

drm/i915: print object bindings in debugfs

PATCH In review Daniel Vetter 3 participants 5 messages Oct 18, 2013 – Oct 19, 2013

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

PATCH 1/1 drm/i915: print object bindings in debugfs

This is useful when we only have aliasing ppgtt and want to figure out what exactly is accesssible and what not. Paulo can somehow overwrite the fbcon framebuffer with the blitter on his hsw machine ...

---
 drivers/gpu/drm/i915/i915_debugfs.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +6 -0
index 061182a..e0a3b56 100644
@@ -124,7 +124,9 @@ static inline const char *get_global_flag(struct drm_i915_gem_object *obj)
 static void
 describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 {
+	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
 	struct i915_vma *vma;
+
 	seq_printf(m, "%pK: %s%s%s %8zdKiB %02x %02x %u %u %u%s%s%s",
 		   &obj->base,
 		   get_pin_flag(obj),
@@ -155,6 +157,10 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 		seq_printf(m, "gtt offset: %08lx, size: %08lx)",
 			   vma->node.start, vma->node.size);
 	}
+	if (dev_priv->mm.aliasing_ppgtt)
+		seq_pritnf(" (bindings: %s%s)",
+			   obj->has_global_gtt_mapping ? "g" : "",
+			   obj->has_aliasing_ppgtt_mapping ? "pp" : "");
 	if (obj->stolen)
 		seq_printf(m, " (stolen: %08lx)", obj->stolen->start);
 	if (obj->pin_mappable || obj->fault_mappable) {
Signature · 1 line
1.8.4.rc3
#1 lore raw

PATCH 1/1 drm/i915: print object bindings in debugfs

This is useful when we only have aliasing ppgtt and want to figure out what exactly is accesssible and what not. Paulo can somehow overwrite the fbcon framebuffer with the blitter on his hsw machine ...

v2: Actually make it compile.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +6 -0
index 061182a..2272898 100644
@@ -124,7 +124,9 @@ static inline const char *get_global_flag(struct drm_i915_gem_object *obj)
 static void
 describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 {
+	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
 	struct i915_vma *vma;
+
 	seq_printf(m, "%pK: %s%s%s %8zdKiB %02x %02x %u %u %u%s%s%s",
 		   &obj->base,
 		   get_pin_flag(obj),
@@ -155,6 +157,10 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 		seq_printf(m, "gtt offset: %08lx, size: %08lx)",
 			   vma->node.start, vma->node.size);
 	}
+	if (dev_priv->mm.aliasing_ppgtt)
+		seq_printf(m, " (bindings: %s%s)",
+			   obj->has_global_gtt_mapping ? "g" : "",
+			   obj->has_aliasing_ppgtt_mapping ? "pp" : "");
 	if (obj->stolen)
 		seq_printf(m, " (stolen: %08lx)", obj->stolen->start);
 	if (obj->pin_mappable || obj->fault_mappable) {
Signature · 1 line
1.8.4.rc3
#2 lore raw
In reply to Daniel Vetter
Quoted 25 lines · Daniel Vetter

This is useful when we only have aliasing ppgtt and want to figure out what exactly is accesssible and what not. Paulo can somehow overwrite the fbcon framebuffer with the blitter on his hsw machine ...

---
 drivers/gpu/drm/i915/i915_debugfs.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
index 061182a..e0a3b56 100644
@@ -124,7 +124,9 @@ static inline const char *get_global_flag(struct drm_i915_gem_object *obj)
 static void
 describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 {
+	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
 	struct i915_vma *vma;
+
 	seq_printf(m, "%pK: %s%s%s %8zdKiB %02x %02x %u %u %u%s%s%s",
 		   &obj->base,
 		   get_pin_flag(obj),

drivers/gpu/drm/i915/i915_debugfs.c describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) · line 163

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +4 -0
@@ -155,6 +157,10 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 		seq_printf(m, "gtt offset: %08lx, size: %08lx)",
 			   vma->node.start, vma->node.size);
 	}
+	if (dev_priv->mm.aliasing_ppgtt)
+		seq_pritnf(" (bindings: %s%s)",
+			   obj->has_global_gtt_mapping ? "g" : "",
+			   obj->has_aliasing_ppgtt_mapping ? "pp" : "");

So we have:

...(bindings: )...
...(bindings: g)...
...(bindings: pp)...
...(bindings: gpp)...

That looks more confusing than informative atm.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw
Quoted 36 lines · Chris Wilson
Quoted 25 lines · Daniel Vetter

This is useful when we only have aliasing ppgtt and want to figure out what exactly is accesssible and what not. Paulo can somehow overwrite the fbcon framebuffer with the blitter on his hsw machine ...

---
 drivers/gpu/drm/i915/i915_debugfs.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
index 061182a..e0a3b56 100644
@@ -124,7 +124,9 @@ static inline const char *get_global_flag(struct drm_i915_gem_object *obj)
 static void
 describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 {
+	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
 	struct i915_vma *vma;
+
 	seq_printf(m, "%pK: %s%s%s %8zdKiB %02x %02x %u %u %u%s%s%s",
 		   &obj->base,
 		   get_pin_flag(obj),

drivers/gpu/drm/i915/i915_debugfs.c describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) · line 163

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +4 -0
@@ -155,6 +157,10 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 		seq_printf(m, "gtt offset: %08lx, size: %08lx)",
 			   vma->node.start, vma->node.size);
 	}
+	if (dev_priv->mm.aliasing_ppgtt)
+		seq_pritnf(" (bindings: %s%s)",
+			   obj->has_global_gtt_mapping ? "g" : "",
+			   obj->has_aliasing_ppgtt_mapping ? "pp" : "");

So we have:

Quoted 8 lines

...(bindings: )...
...(bindings: g)...
...(bindings: pp)...
...(bindings: gpp)...

That looks more confusing than informative atm.
-Chris

This is why I opted to leave just 'g' in get_global_flag. A lack of a g inplies ppgtt. Also fwiw, this info is already there unless I didn't follow what you did:

        list_for_each_entry(vma, &obj->vma_list, vma_link) {
                if (!i915_is_ggtt(vma->vm))
                        seq_puts(m, " (pp");
                else
                        seq_puts(m, " (g");
                seq_printf(m, "gtt offset: %08lx, size: %08lx)",
                           vma->node.start, vma->node.size);
        }
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#4 lore raw
Quoted 9 lines · Ben Widawsky

This is why I opted to leave just 'g' in get_global_flag. A lack of a g inplies ppgtt. Also fwiw, this info is already there unless I didn't follow what you did:

        list_for_each_entry(vma, &obj->vma_list, vma_link) {
                if (!i915_is_ggtt(vma->vm))
                        seq_puts(m, " (pp");
                else
                        seq_puts(m, " (g");

This is only useful for real ppgtt. But for aliasing ppgtt we have just one address space and hence only one vma for each object. But we still want to know whether it's bound in the global gtt or the ppgtt. -Daniel

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