Skip to contentSkip to conversation

drm/i915: Use the engine name directly in the error_state file

PATCH Superseded Michel Thierry 4 participants 7 messages Jan 9, 2018 – Jan 10, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Use the engine name directly in the error_state file

Instead of using local string names that we will have to keep maintaining, use the engine->name directly.

---
 drivers/gpu/drm/i915/i915_gpu_error.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +10 -13
index 94499c24f279..db95ecacdace 100644
@@ -34,16 +34,12 @@
 
 #include "i915_drv.h"
 
-static const char *engine_str(int engine)
-{
-	switch (engine) {
-	case RCS: return "render";
-	case VCS: return "bsd";
-	case BCS: return "blt";
-	case VECS: return "vebox";
-	case VCS2: return "bsd2";
-	default: return "";
-	}
+static const char *engine_str(struct drm_i915_private *i915, int engine_id)
+{
+	if (!i915->engine[engine_id])
+		return "";
+	else
+		return i915->engine[engine_id]->name;
 }
 
 static const char *tiling_flag(int tiling)
@@ -345,7 +341,7 @@ static void print_error_buffers(struct drm_i915_error_state_buf *m,
 		err_puts(m, purgeable_flag(err->purgeable));
 		err_puts(m, err->userptr ? " userptr" : "");
 		err_puts(m, err->engine != -1 ? " " : "");
-		err_puts(m, engine_str(err->engine));
+		err_puts(m, engine_str(m->i915, err->engine));
 		err_puts(m, i915_cache_level_str(m->i915, err->cache_level));
 
 		if (err->name)
@@ -417,7 +413,8 @@ static void error_print_engine(struct drm_i915_error_state_buf *m,
 {
 	int n;
 
-	err_printf(m, "%s command stream:\n", engine_str(ee->engine_id));
+	err_printf(m, "%s command stream:\n", engine_str(m->i915,
+							 ee->engine_id));
 	err_printf(m, "  IDLE?: %s\n", yesno(ee->idle));
 	err_printf(m, "  START: 0x%08x\n", ee->start);
 	err_printf(m, "  HEAD:  0x%08x [0x%08x]\n", ee->head, ee->rq_head);
@@ -633,7 +630,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 		if (error->engine[i].hangcheck_stalled &&
 		    error->engine[i].context.pid) {
 			err_printf(m, "Active process (on ring %s): %s [%d], score %d\n",
-				   engine_str(i),
+				   engine_str(m->i915, i),
 				   error->engine[i].context.comm,
 				   error->engine[i].context.pid,
 				   error->engine[i].context.ban_score);
Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915: Use the engine name directly in the error_state file

== Series Details ==

== Series Details ==

Series: drm/i915: Use the engine name directly in the error_state file
URL : https://patchwork.freedesktop.org/series/36215/
State : success

== Summary ==

Series 36215v1 drm/i915: Use the engine name directly in the error_state file
https://patchwork.freedesktop.org/api/1.0/series/36215/revisions/1/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-fail -> DMESG-WARN (fi-elk-e7500) fdo#103989
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-c:
                fail       -> PASS       (fi-skl-6700k2) fdo#104108

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:419s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:425s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:370s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:489s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:280s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:485s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:491s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:469s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:458s
fi-elk-e7500     total:224  pass:168  dwarn:10  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:273s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:512s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:389s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:399s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:412s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:458s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:409s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:469s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:498s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:504s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:577s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:427s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:510s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:527s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:498s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:479s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:428s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:540s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:401s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:573s
fi-cnl-y2        total:288  pass:258  dwarn:3   dfail:0   fail:0   skip:27  time:553s
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:474s

c6410238e3c4f1282ef9709b65f553a555cf43eb drm-tip: 2018y-01m-09d-18h-59m-27s UTC integration manifest 0073870972db drm/i915: Use the engine name directly in the error_state file

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7633/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Michel Thierry
Quoted 21 lines · Michel Thierry

Instead of using local string names that we will have to keep maintaining, use the engine->name directly.

---
 drivers/gpu/drm/i915/i915_gpu_error.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +0 -5
index 94499c24f279..db95ecacdace 100644
@@ -34,16 +34,12 @@
 #include "i915_drv.h"
-static const char *engine_str(int engine)
-{
-	switch (engine) {
-	case RCS: return "render";
-	case VCS: return "bsd";

drivers/gpu/drm/i915/i915_gpu_error.c line 39

Quoted 10 lines
drivers/gpu/drm/i915/i915_gpu_error.c +4 -5
-	case BCS: return "blt";
-	case VECS: return "vebox";
-	case VCS2: return "bsd2";
-	default: return "";
-	}
+static const char *engine_str(struct drm_i915_private *i915, int  
 engine_id)
+{
+	if (!i915->engine[engine_id])
+		return "";

While unlikely, empty string may be misleading, so maybe better we return "<invalid>" or at least "?" here. Also maybe we can do as part of more global helper function like

static inline const char* intel_engine_name(struct intel_engine_cs *engine)

{
	return engine ? engine->name : "<invalid>";
}

static inline struct intel_engine_cs * intel_engine_lookup(struct drm_i915_private *i915, int engine_id)

{
	if (engine_id < 0 || engine_id > I915_MAX_ENGINES)
		return NULL;
	return i915->engine[engine_id];
}

and then

static const char *engine_str(struct drm_i915_private *i915, int engine_id)

{
	return intel_engine_name(intel_engine_lookup(i915, engine_id));
}

drivers/gpu/drm/i915/i915_gpu_error.c static void print_error_buffers(struct · line 344

Quoted 9 lines
drivers/gpu/drm/i915/i915_gpu_error.c +2 -0
+	else
+		return i915->engine[engine_id]->name;
 }
 static const char *tiling_flag(int tiling)
@@ -345,7 +341,7 @@ static void print_error_buffers(struct  
 drm_i915_error_state_buf *m,
 		err_puts(m, purgeable_flag(err->purgeable));
 		err_puts(m, err->userptr ? " userptr" : "");
 		err_puts(m, err->engine != -1 ? " " : "");

Hmm, it looks that -1 is allowed/expected as engine_id so proposed above check in lookup function is mandatory

Quoted 23 lines
drivers/gpu/drm/i915/i915_gpu_error.c +4 -3
-		err_puts(m, engine_str(err->engine));
+		err_puts(m, engine_str(m->i915, err->engine));
 		err_puts(m, i915_cache_level_str(m->i915, err->cache_level));
 		if (err->name)
@@ -417,7 +413,8 @@ static void error_print_engine(struct  
 drm_i915_error_state_buf *m,
 {
 	int n;
-	err_printf(m, "%s command stream:\n", engine_str(ee->engine_id));
+	err_printf(m, "%s command stream:\n", engine_str(m->i915,
+							 ee->engine_id));
 	err_printf(m, "  IDLE?: %s\n", yesno(ee->idle));
 	err_printf(m, "  START: 0x%08x\n", ee->start);
 	err_printf(m, "  HEAD:  0x%08x [0x%08x]\n", ee->head, ee->rq_head);
@@ -633,7 +630,7 @@ int i915_error_state_to_str(struct  
 drm_i915_error_state_buf *m,
 		if (error->engine[i].hangcheck_stalled &&
 		    error->engine[i].context.pid) {
 			err_printf(m, "Active process (on ring %s): %s [%d], score %d\n",
-				   engine_str(i),
+				   engine_str(m->i915, i),
 				   error->engine[i].context.comm,
 				   error->engine[i].context.pid,
Quoted 1 line

error->engine[i].context.ban_score);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Quoting Michal Wajdeczko (2018-01-09 20:39:09)

Quoted 9 lines
Quoted 6 lines · Michel Thierry

Instead of using local string names that we will have to keep maintaining, use the engine->name directly.

I'd a patch to do this, I just had to make sure the tooling was ready for a name change. At the time, changing this string broke a few igt and intel_error_decode.

Quoted 44 lines
Quoted 16 lines
---
 drivers/gpu/drm/i915/i915_gpu_error.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +0 -5
index 94499c24f279..db95ecacdace 100644
@@ -34,16 +34,12 @@
 #include "i915_drv.h"
-static const char *engine_str(int engine)
-{
-     switch (engine) {
-     case RCS: return "render";
-     case VCS: return "bsd";

drivers/gpu/drm/i915/i915_gpu_error.c line 39

Quoted 10 lines
drivers/gpu/drm/i915/i915_gpu_error.c +4 -5
-     case BCS: return "blt";
-     case VECS: return "vebox";
-     case VCS2: return "bsd2";
-     default: return "";
-     }
+static const char *engine_str(struct drm_i915_private *i915, int  
 engine_id)
+{
+     if (!i915->engine[engine_id])
+             return "";

While unlikely, empty string may be misleading, so maybe better we return "<invalid>" or at least "?" here. Also maybe we can do as part of more global helper function like

static inline const char* intel_engine_name(struct intel_engine_cs *engine)

{
        return engine ? engine->name : "<invalid>";
}

static inline struct intel_engine_cs * intel_engine_lookup(struct drm_i915_private *i915, int engine_id)

{
        if (engine_id < 0 || engine_id > I915_MAX_ENGINES)
                return NULL;
        return i915->engine[engine_id];
}
Quoted 6 lines

and then

static const char *engine_str(struct drm_i915_private *i915, int engine_id)

{
        return intel_engine_name(intel_engine_lookup(i915, engine_id));
}

No need, this is all internal, perma-allocated structs. -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 7 lines · Chris Wilson

Quoting Michal Wajdeczko (2018-01-09 20:39:09)

Quoted 6 lines
Quoted 3 lines · Michel Thierry

Instead of using local string names that we will have to keep maintaining, use the engine->name directly.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

I'd a patch to do this, I just had to make sure the tooling was ready for a name change. At the time, changing this string broke a few igt and intel_error_decode.

I think your igt patch "lib: Fix up internal engine names (again)" covered it.

Not sure if there are more tools looking at the engines' registers in the error_state outside igt.

Quoted 46 lines
Quoted 46 lines
Quoted 16 lines
---
  drivers/gpu/drm/i915/i915_gpu_error.c | 23 ++++++++++-------------
  1 file changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +0 -5
index 94499c24f279..db95ecacdace 100644
@@ -34,16 +34,12 @@
 #include "i915_drv.h"
-static const char *engine_str(int engine)
-{
-     switch (engine) {
-     case RCS: return "render";
-     case VCS: return "bsd";

drivers/gpu/drm/i915/i915_gpu_error.c line 39

Quoted 10 lines
drivers/gpu/drm/i915/i915_gpu_error.c +4 -5
-     case BCS: return "blt";
-     case VECS: return "vebox";
-     case VCS2: return "bsd2";
-     default: return "";
-     }
+static const char *engine_str(struct drm_i915_private *i915, int
 engine_id)
+{
+     if (!i915->engine[engine_id])
+             return "";

While unlikely, empty string may be misleading, so maybe better we return "<invalid>" or at least "?" here. Also maybe we can do as part of more global helper function like

static inline const char* intel_engine_name(struct intel_engine_cs *engine)

{
         return engine ? engine->name : "<invalid>";
}

static inline struct intel_engine_cs * intel_engine_lookup(struct drm_i915_private *i915, int engine_id)

{
         if (engine_id < 0 || engine_id > I915_MAX_ENGINES)
                 return NULL;
         return i915->engine[engine_id];
}

and then

Quoted 8 lines
Quoted 4 lines

static const char *engine_str(struct drm_i915_private *i915, int engine_id)

{
         return intel_engine_name(intel_engine_lookup(i915, engine_id));
}

No need, this is all internal, perma-allocated structs. -Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 12 lines · Michel Thierry
Quoted 11 lines · Chris Wilson

Quoting Michal Wajdeczko (2018-01-09 20:39:09)

Quoted 9 lines
Quoted 6 lines · Michel Thierry

Instead of using local string names that we will have to keep maintaining, use the engine->name directly.

Quoted 61 lines
Quoted 4 lines

I'd a patch to do this, I just had to make sure the tooling was ready for a name change. At the time, changing this string broke a few igt and intel_error_decode.

I think your igt patch "lib: Fix up internal engine names (again)" covered it.

Not sure if there are more tools looking at the engines' registers in the error_state outside igt.

Quoted 52 lines
Quoted 44 lines
Quoted 16 lines

---
  drivers/gpu/drm/i915/i915_gpu_error.c | 23 ++++++++++-------------

  1 file changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +0 -5
index 94499c24f279..db95ecacdace 100644
@@ -34,16 +34,12 @@
 #include "i915_drv.h"
-static const char *engine_str(int engine)
-{
-     switch (engine) {
-     case RCS: return "render";
-     case VCS: return "bsd";

drivers/gpu/drm/i915/i915_gpu_error.c line 39

Quoted 10 lines
drivers/gpu/drm/i915/i915_gpu_error.c +4 -5
-     case BCS: return "blt";
-     case VECS: return "vebox";
-     case VCS2: return "bsd2";
-     default: return "";
-     }
+static const char *engine_str(struct drm_i915_private *i915, int
 engine_id)
+{
+     if (!i915->engine[engine_id])
+             return "";

While unlikely, empty string may be misleading, so maybe better we return "<invalid>" or at least "?" here. Also maybe we can do as part of more global helper function like

static inline const char* intel_engine_name(struct intel_engine_cs *engine) {
         return engine ? engine->name : "<invalid>";
}

static inline struct intel_engine_cs * intel_engine_lookup(struct drm_i915_private *i915, int engine_id) {
         if (engine_id < 0 || engine_id > I915_MAX_ENGINES) return NULL;
         return i915->engine[engine_id];
}

Quoted 6 lines

and then

static const char *engine_str(struct drm_i915_private *i915, int engine_id) {
         return intel_engine_name(intel_engine_lookup(i915, engine_id)); }

No need, this is all internal, perma-allocated structs.

i915_gpu_info_open can pass engine_id=-1, better have some protection.

E.g. cat /sys/kernel/debug/dri/0/i915_gpu_info (while idle)

[   84.448504] GEM_BUG_ON(engine_id == -1)
[   84.448591] ------------[ cut here ]------------
[   84.448630] kernel BUG at drivers/gpu/drm/i915/i915_gpu_error.c:39!
[   84.448673] invalid opcode: 0000 [#1] SMP
[   84.448696] Modules linked in: rfcomm bnep nls_iso8859_1
...
[   84.449425] Call Trace:
[   84.449463]  print_error_buffers+0x166/0x210 [i915]
[   84.449510]  i915_error_state_to_str+0x923/0x1210 [i915]
[   84.449541]  ? create_object+0x23f/0x2e0
[   84.449584]  ? i915_error_state_buf_init+0x59/0xc0 [i915]
[   84.449613]  ? rcu_read_lock_sched_held+0x49/0x90
[   84.449644]  ? kmalloc_order_trace+0x10d/0x170
[   84.449685]  gpu_state_read+0x56/0xb0 [i915]
[   84.449712]  full_proxy_read+0x4d/0x70
[   84.449736]  __vfs_read+0x23/0x120
[   84.449759]  vfs_read+0xa0/0x140
[   84.449779]  SyS_read+0x45/0xa0
[   84.449801]  entry_SYSCALL_64_fastpath+0x23/0x9a
[   84.449834] RIP: 0033:0x7f2a2d3d4230
[   84.449856] RSP: 002b:00007ffda36960e8 EFLAGS: 00000246
[   84.449861] Code: 15 83 fe 04 7f 27 48 63 f6 48 8b 84 f7 08 46 00 00 48 83 c0 08 c3 48 c7 c6 e3 03 59 c0 48 c7 c7 f3 03 59 c0 31 c0 e8 66 75 b9 c6 <0f> 0b 48 c7 c6 05 04 59 c0 48 c7 c7 f3 03 59 c0 31 c0 e8 4f 75
[   84.450028] RIP: engine_str+0x34/0x50 [i915] RSP: ffffb7e142b53c98
[   89.410577] ---[ end trace 5eacc9ca2b6d1e5d ]---

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

✗ Fi.CI.IGT: failure for drm/i915: Use the engine name directly in the error_state file

In reply to Michel Thierry
== Series Details ==

== Series Details ==

Series: drm/i915: Use the engine name directly in the error_state file
URL : https://patchwork.freedesktop.org/series/36215/
State : failure

== Summary ==

Test gem_tiled_swapping:

        Subgroup non-threaded:
                pass       -> DMESG-WARN (shard-hsw) fdo#104218
Test kms_universal_plane:
        Subgroup universal-plane-pipe-c-functional:
                pass       -> INCOMPLETE (shard-hsw)
Test kms_flip:
        Subgroup flip-vs-absolute-wf_vblank-interruptible:
                fail       -> PASS       (shard-hsw) fdo#100368
Test gem_exec_suspend:
        Subgroup basic-s3-devices:
                pass       -> INCOMPLETE (shard-hsw) fdo#103990
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
                fail       -> PASS       (shard-snb) fdo#101623
Test kms_chv_cursor_fail:
        Subgroup pipe-b-128x128-left-edge:
                pass       -> INCOMPLETE (shard-hsw)

fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103990 https://bugs.freedesktop.org/show_bug.cgi?id=103990
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623

shard-hsw        total:2427 pass:1377 dwarn:2   dfail:0   fail:9   skip:1034 time:7487s
shard-snb        total:2576 pass:1245 dwarn:1   dfail:0   fail:10  skip:1318 time:7203s

Blacklisted hosts:
shard-kbl total:2576 pass:1711 dwarn:1 dfail:0 fail:25 skip:837 time:9550s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7633/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx