Skip to contentSkip to conversation

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

PATCH In review Michel Thierry 4 participants 10 messages Jan 10, 2018 – Jan 18, 2018

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

PATCH v2 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.

v2: Better invalid engine_id handling, capture_bo will not be able know the engine_id and end up with -1 (Michal).

---
 drivers/gpu/drm/i915/i915_gpu_error.c | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +20 -13
index 94499c24f279..422e302161e5 100644
@@ -34,16 +34,22 @@
 
 #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 inline const char *intel_engine_name(struct intel_engine_cs *engine)
+{
+	return engine ? engine->name : "";
+}
+
+static inline struct intel_engine_cs *
+intel_engine_lookup(struct drm_i915_private *i915, int engine_id)
+{
+	if (engine_id < 0 || engine_id >= I915_NUM_ENGINES)
+		return NULL;
+	return i915->engine[engine_id];
+}
+
+static const char *engine_str(struct drm_i915_private *i915, int engine_id)
+{
+	return intel_engine_name(intel_engine_lookup(i915, engine_id));
 }
 
 static const char *tiling_flag(int tiling)
@@ -345,7 +351,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 +423,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 +640,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 (rev2)

== Series Details ==

== Series Details ==

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

== Summary ==

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

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-fail -> DMESG-WARN (fi-elk-e7500) fdo#103989 +2
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:420s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:426s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:372s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:482s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:281s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:486s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:488s
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:456s
fi-elk-e7500     total:229  pass:172  dwarn:10  dfail:0   fail:0   skip:46 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:277s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:513s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:390s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:408s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:411s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:462s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:411s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:466s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:497s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:452s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:504s
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:509s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:530s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:491s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:472s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:430s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:536s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:396s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:572s
fi-cnl-y2        total:288  pass:258  dwarn:3   dfail:0   fail:0   skip:27  time:538s
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:470s

fi-pnv-d510 failed to collect. IGT log at Patchwork_7635/fi-pnv-d510/igt.log

c6410238e3c4f1282ef9709b65f553a555cf43eb drm-tip: 2018y-01m-09d-18h-59m-27s UTC integration manifest dd4b445e4fc2 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_7635/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.IGT: success for drm/i915: Use the engine name directly in the error_state file (rev2)

In reply to Michel Thierry
== Series Details ==

== Series Details ==

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

== Summary ==

Test kms_flip:

        Subgroup flip-vs-absolute-wf_vblank-interruptible:
                fail       -> PASS       (shard-hsw) fdo#100368
Test drv_suspend:
        Subgroup fence-restore-tiled2untiled:
                pass       -> SKIP       (shard-snb) fdo#104218

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

shard-hsw        total:2576 pass:1463 dwarn:1   dfail:0   fail:9   skip:1101 time:8291s
shard-snb        total:2576 pass:1243 dwarn:1   dfail:0   fail:11  skip:1319 time:7159s
Blacklisted hosts:
shard-apl        total:2554 pass:1572 dwarn:1   dfail:0   fail:26  skip:951 time:11952s
shard-kbl        total:2558 pass:1695 dwarn:1   dfail:0   fail:24  skip:835 time:9378s

== Logs ==

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

#3 lore raw
In reply to Michel Thierry
Quoted 6 lines · Michel Thierry

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

v2: Better invalid engine_id handling, capture_bo will not be able know the engine_id and end up with -1 (Michal).

Hi,

Fi.CI.IGT didn't catch any failure, apart from intel_error_decode (which didn't complain), I'm not sure which other tool could be using these names.

And now that there are icl patches, this will help there too.

Quoted 76 lines
---
  drivers/gpu/drm/i915/i915_gpu_error.c | 33 ++++++++++++++++++++-------------
  1 file changed, 20 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +20 -14
index 94499c24f279..422e302161e5 100644
@@ -34,16 +34,22 @@
 
  #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 inline const char *intel_engine_name(struct intel_engine_cs *engine)
+{
+       return engine ? engine->name : "";
+}
+
+static inline struct intel_engine_cs *
+intel_engine_lookup(struct drm_i915_private *i915, int engine_id)
+{
+       if (engine_id < 0 || engine_id >= I915_NUM_ENGINES)
+               return NULL;
+       return i915->engine[engine_id];
+}
+
+static const char *engine_str(struct drm_i915_private *i915, int engine_id)
+{
+       return intel_engine_name(intel_engine_lookup(i915, engine_id));
  }
 
  static const char *tiling_flag(int tiling)
@@ -345,7 +351,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 +423,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 +640,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);
--

2.15.1

Quoted 5 lines

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

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

Reviewed-by on v2 1/1
#4 lore raw
In reply to Michel Thierry
Quoted 39 lines · Michel Thierry

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

v2: Better invalid engine_id handling, capture_bo will not be able know the engine_id and end up with -1 (Michal).

---
  drivers/gpu/drm/i915/i915_gpu_error.c | 33 ++++++++++++++++++++-------------
  1 file changed, 20 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +7 -10
index 94499c24f279..422e302161e5 100644
@@ -34,16 +34,22 @@
 
  #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 inline const char *intel_engine_name(struct intel_engine_cs *engine)
+{
+	return engine ? engine->name : "";
+}
+
+static inline struct intel_engine_cs *
+intel_engine_lookup(struct drm_i915_private *i915, int engine_id)

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

Quoted 10 lines
drivers/gpu/drm/i915/i915_gpu_error.c +9 -0
+{
+	if (engine_id < 0 || engine_id >= I915_NUM_ENGINES)
+		return NULL;
+	return i915->engine[engine_id];
+}
+
+static const char *engine_str(struct drm_i915_private *i915, int engine_id)
+{
+	return intel_engine_name(intel_engine_lookup(i915, engine_id));
  }

Feels like a bit of an overkill to have three functions to this trivial thing but meh. Could also maybe cheat and have engine_id as unsigned int and so would only need to check for >= I915_NUM_ENGINES.

Anyway, I peeked in intel_error_decode source and couldn't spot anything that looked it would break. You checked it by running it? Assuming you did:

Regards,

Tvrtko

Quoted 23 lines
drivers/gpu/drm/i915/i915_gpu_error.c +3 -2
  static const char *tiling_flag(int tiling)
@@ -345,7 +351,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 +423,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);

drivers/gpu/drm/i915/i915_gpu_error.c int i915_error_state_to_str(struct drm_i915_error_state_buf *m, · line 646

Quoted 8 lines
drivers/gpu/drm/i915/i915_gpu_error.c +1 -1
@@ -633,7 +640,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);

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

#5 lore raw
Quoted 55 lines · Tvrtko Ursulin
Quoted 40 lines · Michel Thierry

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

v2: Better invalid engine_id handling, capture_bo will not be able know the engine_id and end up with -1 (Michal).

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

  1 file changed, 20 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +8 -10
index 94499c24f279..422e302161e5 100644
@@ -34,16 +34,22 @@
   #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 inline const char *intel_engine_name(struct intel_engine_cs 
 *engine)
+{
+    return engine ? engine->name : "";
+}
+
+static inline struct intel_engine_cs *
+intel_engine_lookup(struct drm_i915_private *i915, int engine_id)
+{

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

Quoted 10 lines
drivers/gpu/drm/i915/i915_gpu_error.c +8 -0
+    if (engine_id < 0 || engine_id >= I915_NUM_ENGINES)
+        return NULL;
+    return i915->engine[engine_id];
+}
+
+static const char *engine_str(struct drm_i915_private *i915, int 
 engine_id)
+{
+    return intel_engine_name(intel_engine_lookup(i915, engine_id));
   }

Feels like a bit of an overkill to have three functions to this trivial thing but meh. Could also maybe cheat and have engine_id as unsigned int and so would only need to check for >= I915_NUM_ENGINES.

Quoted 2 lines

Anyway, I peeked in intel_error_decode source and couldn't spot anything that looked it would break. You checked it by running it? Assuming you did:

Thanks. Yes, I did and also compared the error state output (intel_error_decode also still works). The only change is that the batch / ring / HWSP sections now use the engine->name (e.g. they will use rcs0 instead of render, vcs0 instead of bsd, etc.).

I didn't see anything in IGT complaining (probably because IGT usually reads dmesg and there we already use engine->name), but there must be something else out there that will complain.

Quoted 29 lines

Regards,

Tvrtko

Quoted 23 lines
drivers/gpu/drm/i915/i915_gpu_error.c +3 -2
   static const char *tiling_flag(int tiling)
@@ -345,7 +351,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 +423,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 +640,7 @@ int i915_error_state_to_str(struct 
 drm_i915_error_state_buf *m,

          if (error->engine[i].hangcheck_stalled &&

Quoted 8 lines
Quoted 8 lines

              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);

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

#6 lore raw

Quoting Michel Thierry (2018-01-16 18:33:32)

Quoted 52 lines · Tvrtko Ursulin
Quoted 49 lines · Michel Thierry
Quoted 47 lines

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

v2: Better invalid engine_id handling, capture_bo will not be able know the engine_id and end up with -1 (Michal).

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

  1 file changed, 20 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +14 -10
index 94499c24f279..422e302161e5 100644
@@ -34,16 +34,22 @@
   #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 inline const char *intel_engine_name(struct intel_engine_cs 
 *engine)
+{
+    return engine ? engine->name : "";
+}
+
+static inline struct intel_engine_cs *
+intel_engine_lookup(struct drm_i915_private *i915, int engine_id)
+{
+    if (engine_id < 0 || engine_id >= I915_NUM_ENGINES)
+        return NULL;
+    return i915->engine[engine_id];
+}
+
+static const char *engine_str(struct drm_i915_private *i915, int 
Quoted 8 lines
Quoted 8 lines

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

Quoted 4 lines
drivers/gpu/drm/i915/i915_gpu_error.c +2 -0
 engine_id)
+{
+    return intel_engine_name(intel_engine_lookup(i915, engine_id));
   }

Feels like a bit of an overkill to have three functions to this trivial thing but meh. Could also maybe cheat and have engine_id as unsigned int and so would only need to check for >= I915_NUM_ENGINES.

Overkill? Yes! If you are concerned about the back mapping, just put a pointer back to the engine (ee->engine). We are not going to reallocate it after module load, right? RIGHT?!!! :)

Quoted 4 lines
Quoted 3 lines

Anyway, I peeked in intel_error_decode source and couldn't spot anything that looked it would break. You checked it by running it? Assuming you did:

Quoted 8 lines

Thanks. Yes, I did and also compared the error state output (intel_error_decode also still works). The only change is that the batch / ring / HWSP sections now use the engine->name (e.g. they will use rcs0 instead of render, vcs0 instead of bsd, etc.).

I didn't see anything in IGT complaining (probably because IGT usually reads dmesg and there we already use engine->name), but there must be something else out there that will complain.

Hmm, we will need to fixup mesa/aubinator_error_decode to expect the new name, as it is using them to map various registers from the error state. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
Quoted 75 lines · Chris Wilson

Quoting Michel Thierry (2018-01-16 18:33:32)

Quoted 52 lines · Tvrtko Ursulin
Quoted 49 lines · Michel Thierry
Quoted 47 lines

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

v2: Better invalid engine_id handling, capture_bo will not be able know the engine_id and end up with -1 (Michal).

---
   drivers/gpu/drm/i915/i915_gpu_error.c | 33
++++++++++++++++++++-------------
   1 file changed, 20 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +14 -10
index 94499c24f279..422e302161e5 100644
@@ -34,16 +34,22 @@
   #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 inline const char *intel_engine_name(struct intel_engine_cs
 *engine)
+{
+    return engine ? engine->name : "";
+}
+
+static inline struct intel_engine_cs *
+intel_engine_lookup(struct drm_i915_private *i915, int engine_id)
+{
+    if (engine_id < 0 || engine_id >= I915_NUM_ENGINES)
+        return NULL;
+    return i915->engine[engine_id];
+}
+
+static const char *engine_str(struct drm_i915_private *i915, int
Quoted 8 lines
Quoted 8 lines

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

Quoted 4 lines
drivers/gpu/drm/i915/i915_gpu_error.c +2 -0
 engine_id)
+{
+    return intel_engine_name(intel_engine_lookup(i915, engine_id));
   }

Feels like a bit of an overkill to have three functions to this trivial thing but meh. Could also maybe cheat and have engine_id as unsigned int and so would only need to check for >= I915_NUM_ENGINES.

Overkill? Yes! If you are concerned about the back mapping, just put a pointer back to the engine (ee->engine). We are not going to reallocate it after module load, right? RIGHT?!!! :)

Quoted 9 lines
Quoted 3 lines

Anyway, I peeked in intel_error_decode source and couldn't spot anything that looked it would break. You checked it by running it? Assuming you did:

Thanks. Yes, I did and also compared the error state output (intel_error_decode also still works). The only change is that the batch / ring / HWSP sections now use the engine->name (e.g. they will use rcs0 instead of render, vcs0 instead of bsd, etc.).

Quoted 6 lines
Quoted 3 lines

I didn't see anything in IGT complaining (probably because IGT usually reads dmesg and there we already use engine->name), but there must be something else out there that will complain.

Hmm, we will need to fixup mesa/aubinator_error_decode to expect the new name, as it is using them to map various registers from the error state.

Thanks for taking care of aubinator, hopefully next time I won't forget about mesa.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Quoting Michel Thierry (2018-01-18 00:39:55)

Quoted 6 lines · Chris Wilson
Quoted 2 lines

Hmm, we will need to fixup mesa/aubinator_error_decode to expect the new name, as it is using them to map various registers from the error state.

Thanks for taking care of aubinator, hopefully next time I won't forget about mesa.

Would be good if you could review my string handling there to make sure it does match. :)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw
In reply to Michel Thierry

Quoting Michel Thierry (2018-01-10 01:21:51)

Quoted 10 lines

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

v2: Better invalid engine_id handling, capture_bo will not be able know the engine_id and end up with -1 (Michal).

Massaged the patch just ever so slightly and applied. Thanks for the patch and review,
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx