Skip to contentSkip to conversation

drm/i915/selftests: Exercise resetting in the middle of a wait-on-fence

PATCH New Chris Wilson 2 participants 2 messages Jul 17, 2018

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

PATCH 1/1 drm/i915/selftests: Exercise resetting in the middle of a wait-on-fence

On older HW, gen2/3, fence registers are used for detiling GPU commands and as such changing those registers requires serialisation with the requests on the GPU. Anything running on the GPU is subject to a hang, and so we must be able to recover cleanly in the middle of a stuck wait on a fence register.

We can simulate using the fence on the GPU simply by marking the fence as active on the request for this vma, the interface being common to all gen, thus broadening the test.

Cc Tvrtko Ursulin <[email protected]>
---
 .../gpu/drm/i915/selftests/intel_hangcheck.c  | 74 +++++++++++++++++--
 1 file changed, 67 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/selftests/intel_hangcheck.c +67 -7
index 65d66cdedd26..142e5381ffb7 100644
@@ -1018,8 +1018,37 @@ static int evict_vma(void *data)
 	return err;
 }
 
+static int evict_fence(void *data)
+{
+	struct evict_vma *arg = data;
+	struct drm_i915_private *i915 = arg->vma->vm->i915;
+	int err;
+
+	complete(&arg->completion);
+
+	mutex_lock(&i915->drm.struct_mutex);
+
+	/* Mark the fence register as dirty to force the mmio update. */
+	err = i915_gem_object_set_tiling(arg->vma->obj, I915_TILING_Y, 512);
+	if (err)
+		goto out_unlock;
+
+	err = i915_vma_pin_fence(arg->vma);
+	if (err)
+		goto out_unlock;
+
+	i915_vma_unpin_fence(arg->vma);
+
+out_unlock:
+	mutex_unlock(&i915->drm.struct_mutex);
+
+	return err;
+}
+
 static int __igt_reset_evict_vma(struct drm_i915_private *i915,
-				 struct i915_address_space *vm)
+				 struct i915_address_space *vm,
+				 int (*fn)(void *),
+				 unsigned int flags)
 {
 	struct drm_i915_gem_object *obj;
 	struct task_struct *tsk = NULL;
@@ -1040,12 +1069,18 @@ static int __igt_reset_evict_vma(struct drm_i915_private *i915,
 	if (err)
 		goto unlock;
 
-	obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
+	obj = i915_gem_object_create_internal(i915, SZ_1M);
 	if (IS_ERR(obj)) {
 		err = PTR_ERR(obj);
 		goto fini;
 	}
 
+	if (flags & EXEC_OBJECT_NEEDS_FENCE) {
+		err = i915_gem_object_set_tiling(obj, I915_TILING_X, 512);
+		if (err)
+			goto out_obj;
+	}
+
 	arg.vma = i915_vma_instance(obj, vm, NULL);
 	if (IS_ERR(arg.vma)) {
 		err = PTR_ERR(arg.vma);
@@ -1060,10 +1095,24 @@ static int __igt_reset_evict_vma(struct drm_i915_private *i915,
 
 	err = i915_vma_pin(arg.vma, 0, 0,
 			   i915_vma_is_ggtt(arg.vma) ? PIN_GLOBAL : PIN_USER);
-	if (err)
+	if (err) {
+		i915_request_add(rq);
 		goto out_obj;
+	}
 
-	err = i915_vma_move_to_active(arg.vma, rq, EXEC_OBJECT_WRITE);
+	if (flags & EXEC_OBJECT_NEEDS_FENCE) {
+		err = i915_vma_pin_fence(arg.vma);
+		if (err) {
+			i915_vma_unpin(arg.vma);
+			i915_request_add(rq);
+			goto out_obj;
+		}
+	}
+
+	err = i915_vma_move_to_active(arg.vma, rq, flags);
+
+	if (flags & EXEC_OBJECT_NEEDS_FENCE)
+		i915_vma_unpin_fence(arg.vma);
 	i915_vma_unpin(arg.vma);
 
 	i915_request_get(rq);
@@ -1086,7 +1135,7 @@ static int __igt_reset_evict_vma(struct drm_i915_private *i915,
 
 	init_completion(&arg.completion);
 
-	tsk = kthread_run(evict_vma, &arg, "igt/evict_vma");
+	tsk = kthread_run(fn, &arg, "igt/evict_vma");
 	if (IS_ERR(tsk)) {
 		err = PTR_ERR(tsk);
 		tsk = NULL;
@@ -1137,7 +1186,8 @@ static int igt_reset_evict_ggtt(void *arg)
 {
 	struct drm_i915_private *i915 = arg;
 
-	return __igt_reset_evict_vma(i915, &i915->ggtt.vm);
+	return __igt_reset_evict_vma(i915, &i915->ggtt.vm,
+				     evict_vma, EXEC_OBJECT_WRITE);
 }
 
 static int igt_reset_evict_ppgtt(void *arg)
@@ -1154,12 +1204,21 @@ static int igt_reset_evict_ppgtt(void *arg)
 
 	err = 0;
 	if (ctx->ppgtt) /* aliasing == global gtt locking, covered above */
-		err = __igt_reset_evict_vma(i915, &ctx->ppgtt->vm);
+		err = __igt_reset_evict_vma(i915, &ctx->ppgtt->vm,
+					    evict_vma, EXEC_OBJECT_WRITE);
 
 	kernel_context_close(ctx);
 	return err;
 }
 
+static int igt_reset_evict_fence(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+
+	return __igt_reset_evict_vma(i915, &i915->ggtt.vm,
+				     evict_fence, EXEC_OBJECT_NEEDS_FENCE);
+}
+
 static int wait_for_others(struct drm_i915_private *i915,
 			   struct intel_engine_cs *exclude)
 {
@@ -1409,6 +1468,7 @@ int intel_hangcheck_live_selftests(struct drm_i915_private *i915)
 		SUBTEST(igt_reset_wait),
 		SUBTEST(igt_reset_evict_ggtt),
 		SUBTEST(igt_reset_evict_ppgtt),
+		SUBTEST(igt_reset_evict_fence),
 		SUBTEST(igt_handle_error),
 	};
 	bool saved_hangcheck;
Signature · 6 lines
2.18.0

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

✗ Fi.CI.BAT: failure for drm/i915/selftests: Exercise resetting in the middle of a wait-on-fence

== Series Details ==

== Series Details ==

Series: drm/i915/selftests: Exercise resetting in the middle of a wait-on-fence
URL : https://patchwork.freedesktop.org/series/46690/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4501 -> Patchwork_9688 =

== Summary - FAILURE ==

Serious unknown changes coming with Patchwork_9688 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_9688, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/46690/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_9688:

=== IGT changes ===

    ==== Possible regressions ====

    igt@drv_selftest@live_hangcheck:
      {fi-kbl-8809g}:     NOTRUN -> DMESG-FAIL
      fi-kbl-7500u:       PASS -> DMESG-FAIL
      fi-kbl-7560u:       PASS -> DMESG-FAIL
      fi-skl-6700hq:      PASS -> DMESG-FAIL
      fi-skl-gvtdvm:      PASS -> DMESG-FAIL
      fi-skl-6700k2:      PASS -> DMESG-FAIL
      fi-blb-e6850:       PASS -> DMESG-FAIL
      fi-cfl-guc:         PASS -> DMESG-FAIL
      fi-skl-guc:         PASS -> DMESG-FAIL
      fi-skl-6600u:       PASS -> DMESG-FAIL
      fi-pnv-d510:        PASS -> DMESG-FAIL
      fi-cfl-8700k:       PASS -> DMESG-FAIL
      fi-kbl-r:           PASS -> DMESG-FAIL
      fi-kbl-guc:         PASS -> DMESG-FAIL
      fi-cfl-s3:          PASS -> DMESG-FAIL
      fi-skl-6770hq:      PASS -> DMESG-FAIL
      fi-whl-u:           PASS -> DMESG-FAIL
      fi-bxt-dsi:         PASS -> DMESG-FAIL
      fi-bxt-j4205:       PASS -> DMESG-FAIL
      fi-bdw-gvtdvm:      PASS -> DMESG-FAIL
      fi-kbl-x1275:       PASS -> DMESG-FAIL
      fi-kbl-7567u:       PASS -> DMESG-FAIL
      fi-glk-dsi:         PASS -> DMESG-FAIL

    igt@drv_selftest@live_workarounds:
      {fi-cfl-8109u}:     NOTRUN -> DMESG-FAIL +1
      fi-glk-j4005:       PASS -> DMESG-FAIL +1

    
    ==== Warnings ====

    igt@drv_selftest@live_execlists:
      fi-whl-u:           PASS -> SKIP +1
      fi-cfl-8700k:       PASS -> SKIP +1
      fi-glk-j4005:       PASS -> SKIP +1
      fi-skl-guc:         PASS -> SKIP
      fi-kbl-r:           PASS -> SKIP +1
      fi-cfl-s3:          PASS -> SKIP +1
      fi-kbl-guc:         PASS -> SKIP
      fi-kbl-7500u:       PASS -> SKIP +1
      fi-skl-6700hq:      PASS -> SKIP +1
      fi-bxt-j4205:       PASS -> SKIP +1
      fi-cfl-guc:         PASS -> SKIP

    igt@drv_selftest@live_guc:
      fi-glk-dsi:         PASS -> SKIP +1
      fi-kbl-7567u:       PASS -> SKIP +1
      fi-skl-6600u:       PASS -> SKIP +1
      fi-skl-gvtdvm:      PASS -> SKIP +1
      fi-bxt-dsi:         PASS -> SKIP +1
      fi-skl-6700k2:      PASS -> SKIP +1
      fi-skl-6770hq:      PASS -> SKIP +1
      fi-kbl-7560u:       PASS -> SKIP +1
      fi-kbl-x1275:       PASS -> SKIP +1

    igt@gem_exec_gttfill@basic:
      fi-pnv-d510:        PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_9688 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_workarounds:
      fi-kbl-7560u:       PASS -> DMESG-FAIL (fdo#107257)

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       PASS -> DMESG-FAIL (fdo#106103, fdo#102614)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-skl-6260u:       PASS -> INCOMPLETE (fdo#104108)

    igt@prime_vgem@basic-fence-flip:
      fi-glk-j4005:       PASS -> FAIL (fdo#104008)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_guc:
      fi-skl-guc:         DMESG-WARN (fdo#107258, fdo#107175) -> SKIP
      fi-cfl-guc:         DMESG-WARN (fdo#107258) -> SKIP
      fi-kbl-guc:         DMESG-WARN (fdo#107258) -> SKIP

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       DMESG-WARN (fdo#105128, fdo#107139) -> PASS

    igt@kms_busy@basic-flip-b:
      fi-skl-6700hq:      DMESG-WARN (fdo#105998) -> PASS +1

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

    
    ==== Warnings ====

    igt@gem_exec_suspend@basic-s4-devices:
      {fi-kbl-8809g}:     INCOMPLETE (fdo#107139) -> DMESG-WARN (fdo#107222, fdo#107139)

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103
fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139
fdo#107175 https://bugs.freedesktop.org/show_bug.cgi?id=107175
fdo#107222 https://bugs.freedesktop.org/show_bug.cgi?id=107222
fdo#107257 https://bugs.freedesktop.org/show_bug.cgi?id=107257
fdo#107258 https://bugs.freedesktop.org/show_bug.cgi?id=107258

== Participating hosts (46 -> 42) ==

Additional (1): fi-cfl-8109u
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u

== Build changes ==

* Linux: CI_DRM_4501 -> Patchwork_9688

CI_DRM_4501: 692d13f7b75baf0bb8c58b9784569c52d68f01e2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4559: 6d341aac2124836443ce74e8e97a4508ac8d5095 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9688: 4004c4c3750d41bf023eb052e2723dcd4d7bb58b @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

4004c4c3750d drm/i915/selftests: Exercise resetting in the middle of a wait-on-fence

== Logs ==

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