Now that we skip a per-engine reset on an idle engine, we need to update
the selftest to take that into account.

Fixes: f6ba181ada55 ("drm/i915: Skip an engine reset if it recovered before our 
preparations")
Signed-off-by: Chris Wilson <[email protected]>
Cc: Michel Thierry <[email protected]>
Cc: Mika Kuoppala <[email protected]>
---
 drivers/gpu/drm/i915/selftests/intel_hangcheck.c | 27 ++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c 
b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
index f98546b8a7fa..e1b60ee997d1 100644
--- a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
+++ b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
@@ -361,7 +361,7 @@ static int igt_reset_engine(void *arg)
        unsigned int reset_count, reset_engine_count;
        int err = 0;
 
-       /* Check that we can issue a global GPU and engine reset */
+       /* Check that we can issue an engine reset on an idle engine (no-op) */
 
        if (!intel_has_reset_engine(i915))
                return 0;
@@ -384,9 +384,9 @@ static int igt_reset_engine(void *arg)
                        break;
                }
 
-               if (i915_reset_engine_count(&i915->gpu_error, engine) ==
+               if (i915_reset_engine_count(&i915->gpu_error, engine) !=
                    reset_engine_count) {
-                       pr_err("No %s engine reset recorded!\n", engine->name);
+                       pr_err("%s engine reset recorded!\n", engine->name);
                        err = -EINVAL;
                        break;
                }
@@ -480,18 +480,19 @@ static int igt_reset_active_engines(void *arg)
                struct task_struct *threads[I915_NUM_ENGINES];
                unsigned long resets[I915_NUM_ENGINES];
                unsigned long global = i915_reset_count(&i915->gpu_error);
+               unsigned long count = 0;
                IGT_TIMEOUT(end_time);
 
                memset(threads, 0, sizeof(threads));
                for_each_engine(active, i915, tmp) {
                        struct task_struct *tsk;
 
-                       if (active == engine)
-                               continue;
-
                        resets[tmp] = i915_reset_engine_count(&i915->gpu_error,
                                                              active);
 
+                       if (active == engine)
+                               continue;
+
                        tsk = kthread_run(active_engine, active,
                                          "igt/%s", active->name);
                        if (IS_ERR(tsk)) {
@@ -511,9 +512,23 @@ static int igt_reset_active_engines(void *arg)
                                       engine->name, err);
                                break;
                        }
+
+                       count++;
                } while (time_before(jiffies, end_time));
                clear_bit(I915_RESET_ENGINE + engine->id,
                          &i915->gpu_error.flags);
+               pr_info("i915_reset_engine(%s): %lu active resets\n",
+                       engine->name, count);
+
+               if (resets[engine->id] + count !=
+                   i915_reset_engine_count(&i915->gpu_error, active))  {
+                       pr_err("i915_reset_engine(%s): reset %lu times, but 
reported %lu\n",
+                              active->name, count,
+                              i915_reset_engine_count(&i915->gpu_error,
+                                                      active) - 
resets[engine->id]);
+                       if (!err)
+                               err = -EINVAL;
+               }
 
 unwind:
                for_each_engine(active, i915, tmp) {
-- 
2.15.1

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

Reply via email to