diff mbox series

drm/i915/selftests: Add a cancel request selftest that triggers a reset

Message ID 20210913195604.16181-1-matthew.brost@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/selftests: Add a cancel request selftest that triggers a reset | expand

Commit Message

Matthew Brost Sept. 13, 2021, 7:56 p.m. UTC
Add a cancel request selftest that results in an engine reset to cancel
the request as it is non-preemptable. Also insert a NOP request after
the cancelled request and confirm that it completes successfully.

v2:
 (Tvrtko)
  - Skip test if preemption timeout compiled out
  - Skip test if engine reset isn't supported
  - Update debug prints to be more descriptive

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_request.c | 106 ++++++++++++++++++
 1 file changed, 106 insertions(+)

Comments

Matthew Brost Sept. 14, 2021, 4:51 a.m. UTC | #1
On Tue, Sep 14, 2021 at 02:46:49AM +0000, Patchwork wrote:
> Patch Details
> 
> Series:  drm/i915/selftests: Add a cancel request selftest that triggers a
>          reset
> URL:     https://patchwork.freedesktop.org/series/94631/
> State:   failure
> Details: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21030/index.html
> 
> CI Bug Log - changes from CI_DRM_10575_full -> Patchwork_21030_full
> 
> Summary
> 
> FAILURE
> 
> Serious unknown changes coming with Patchwork_21030_full absolutely need to be
> verified manually.
> 
> If you think the reported changes have nothing to do with the changes
> introduced in Patchwork_21030_full, please notify your bug team to allow them
> to document this new failure mode, which will reduce false positives in CI.
> 
> Possible new issues
> 
> Here are the unknown changes that may have been introduced in
> Patchwork_21030_full:
> 
> IGT changes
> 
> Possible regressions
> 
>   • igt@gem_softpin@noreloc-s3:
> 
>       □ shard-snb: NOTRUN -> DMESG-WARN
>   • igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytileccs:
> 
>       □ shard-iclb: PASS -> SKIP

Clearly neither of these failures has anything to do with this patch as
this patch just introduces a new selftest. CI is clean with an RB this
patch can be merged.

Matt 

> 
> Suppressed
> 
> The following results come from untrusted machines, tests, or statuses.
> They do not affect the overall result.
> 
>   • igt@kms_multipipe_modeset@basic-max-pipe-crc-check:
>       □ {shard-rkl}: SKIP ([i915#4070]) -> SKIP
> 
> Known issues
> 
> Here are the changes found in Patchwork_21030_full that come from known issues:
> 
> IGT changes
> 
> Issues hit
> 
>   • igt@gem_ctx_persistence@legacy-engines-mixed-process:
> 
>       □ shard-snb: NOTRUN -> SKIP ([fdo#109271] / [i915#1099]) +6 similar
>         issues
>   • igt@gem_eio@unwedge-stress:
> 
>       □ shard-iclb: PASS -> TIMEOUT ([i915#2369] / [i915#2481] / [i915#3070])
>   • igt@gem_exec_fair@basic-none-share@rcs0:
> 
>       □ shard-tglb: PASS -> FAIL ([i915#2842]) +1 similar issue
>   • igt@gem_exec_fair@basic-pace-share@rcs0:
> 
>       □ shard-tglb: NOTRUN -> FAIL ([i915#2842])
>   • igt@gem_exec_fair@basic-pace-solo@rcs0:
> 
>       □ shard-iclb: PASS -> FAIL ([i915#2842])
>   • igt@gem_exec_fair@basic-sync@rcs0:
> 
>       □ shard-kbl: PASS -> SKIP ([fdo#109271])
>   • igt@gem_huc_copy@huc-copy:
> 
>       □ shard-tglb: PASS -> SKIP ([i915#2190])
>   • igt@gem_pread@exhaustion:
> 
>       □ shard-snb: NOTRUN -> WARN ([i915#2658])
>   • igt@gem_render_copy@yf-tiled-mc-ccs-to-vebox-y-tiled:
> 
>       □ shard-iclb: NOTRUN -> SKIP ([i915#768])
>   • igt@gem_userptr_blits@coherency-sync:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#110542])
>   • igt@gem_userptr_blits@dmabuf-sync:
> 
>       □ shard-kbl: NOTRUN -> SKIP ([fdo#109271] / [i915#3323])
>   • igt@gem_userptr_blits@input-checking:
> 
>       □ shard-snb: NOTRUN -> DMESG-WARN ([i915#3002])
>   • igt@gem_userptr_blits@unsync-unmap-after-close:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([i915#3297])
>   • igt@gem_userptr_blits@vma-merge:
> 
>       □ shard-snb: NOTRUN -> FAIL ([i915#2724])
>   • igt@gem_workarounds@suspend-resume:
> 
>       □ shard-tglb: PASS -> INCOMPLETE ([i915#456]) +2 similar issues
>   • igt@gen7_exec_parse@oacontrol-tracking:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#109289]) +1 similar issue
>   • igt@gen9_exec_parse@bb-secure:
> 
>       □ shard-iclb: NOTRUN -> SKIP ([i915#2856])
>   • igt@gen9_exec_parse@shadow-peek:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([i915#2856]) +1 similar issue
>   • igt@i915_selftest@live@evict:
> 
>       □ shard-skl: NOTRUN -> INCOMPLETE ([i915#198])
>   • igt@i915_selftest@live@gt_lrc:
> 
>       □ shard-tglb: NOTRUN -> DMESG-FAIL ([i915#2373])
>   • igt@i915_selftest@live@gt_pm:
> 
>       □ shard-tglb: NOTRUN -> DMESG-FAIL ([i915#1759] / [i915#2291])
> 
>       □ shard-skl: NOTRUN -> DMESG-FAIL ([i915#1886] / [i915#2291])
> 
>   • igt@i915_selftest@live@hangcheck:
> 
>       □ shard-snb: PASS -> INCOMPLETE ([i915#3921])
>   • igt@kms_big_fb@linear-16bpp-rotate-270:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#111614]) +1 similar issue
>   • igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-180-hflip:
> 
>       □ shard-kbl: NOTRUN -> SKIP ([fdo#109271] / [i915#3777]) +1 similar issue
>   • igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-0-async-flip:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#111615])
>   • igt@kms_ccs@pipe-a-bad-aux-stride-y_tiled_gen12_rc_ccs_cc:
> 
>       □ shard-iclb: NOTRUN -> SKIP ([fdo#109278] / [i915#3886]) +2 similar
>         issues
>   • igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_rc_ccs_cc:
> 
>       □ shard-kbl: NOTRUN -> SKIP ([fdo#109271] / [i915#3886]) +8 similar
>         issues
>   • igt@kms_ccs@pipe-b-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs_cc:
> 
>       □ shard-apl: NOTRUN -> SKIP ([fdo#109271] / [i915#3886]) +9 similar
>         issues
>   • igt@kms_ccs@pipe-c-crc-primary-rotation-180-y_tiled_gen12_rc_ccs_cc:
> 
>       □ shard-skl: NOTRUN -> SKIP ([fdo#109271] / [i915#3886]) +4 similar
>         issues
>   • igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_mc_ccs:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([i915#3689] / [i915#3886]) +2 similar
>         issues
>   • igt@kms_ccs@pipe-c-random-ccs-data-y_tiled_ccs:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([i915#3689]) +1 similar issue
>   • igt@kms_ccs@pipe-d-bad-pixel-format-y_tiled_ccs:
> 
>       □ shard-snb: NOTRUN -> SKIP ([fdo#109271]) +494 similar issues
>   • igt@kms_chamelium@hdmi-hpd-for-each-pipe:
> 
>       □ shard-kbl: NOTRUN -> SKIP ([fdo#109271] / [fdo#111827]) +8 similar
>         issues
>   • igt@kms_chamelium@vga-hpd-after-suspend:
> 
>       □ shard-skl: NOTRUN -> SKIP ([fdo#109271] / [fdo#111827]) +6 similar
>         issues
> 
>       □ shard-iclb: NOTRUN -> SKIP ([fdo#109284] / [fdo#111827]) +1 similar
>         issue
> 
>   • igt@kms_color_chamelium@pipe-c-ctm-0-25:
> 
>       □ shard-apl: NOTRUN -> SKIP ([fdo#109271] / [fdo#111827]) +17 similar
>         issues
>   • igt@kms_color_chamelium@pipe-invalid-ctm-matrix-sizes:
> 
>       □ shard-snb: NOTRUN -> SKIP ([fdo#109271] / [fdo#111827]) +19 similar
>         issues
>   • igt@kms_color_chamelium@pipe-invalid-degamma-lut-sizes:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#109284] / [fdo#111827]) +6 similar
>         issues
>   • igt@kms_content_protection@lic:
> 
>       □ shard-apl: NOTRUN -> TIMEOUT ([i915#1319])
>   • igt@kms_content_protection@type1:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#111828])
>   • igt@kms_cursor_crc@pipe-a-cursor-size-change:
> 
>       □ shard-snb: NOTRUN -> FAIL ([i915#4024])
>   • igt@kms_cursor_crc@pipe-b-cursor-32x10-random:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([i915#3359]) +2 similar issues
>   • igt@kms_cursor_crc@pipe-b-cursor-512x512-offscreen:
> 
>       □ shard-iclb: NOTRUN -> SKIP ([fdo#109278] / [fdo#109279])
>   • igt@kms_cursor_crc@pipe-b-cursor-suspend:
> 
>       □ shard-skl: PASS -> INCOMPLETE ([i915#300])
>   • igt@kms_cursor_crc@pipe-d-cursor-32x32-onscreen:
> 
>       □ shard-iclb: NOTRUN -> SKIP ([fdo#109278]) +3 similar issues
> 
>       □ shard-tglb: NOTRUN -> SKIP ([i915#3319])
> 
>   • igt@kms_cursor_crc@pipe-d-cursor-512x512-offscreen:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#109279] / [i915#3359]) +3 similar
>         issues
>   • igt@kms_cursor_legacy@pipe-d-torture-bo:
> 
>       □ shard-apl: NOTRUN -> SKIP ([fdo#109271] / [i915#533]) +1 similar issue
>   • igt@kms_flip@2x-plain-flip-fb-recreate@ab-hdmi-a1-hdmi-a2:
> 
>       □ shard-glk: PASS -> FAIL ([i915#2122])
>   • igt@kms_flip@flip-vs-expired-vblank@c-dp1:
> 
>       □ shard-kbl: PASS -> FAIL ([i915#79])
>   • igt@kms_flip@flip-vs-suspend-interruptible@a-dp1:
> 
>       □ shard-apl: PASS -> DMESG-WARN ([i915#180]) +4 similar issues
>   • igt@kms_flip@plain-flip-fb-recreate-interruptible@a-edp1:
> 
>       □ shard-skl: PASS -> FAIL ([i915#2122])
>   • igt@kms_frontbuffer_tracking@fbc-suspend:
> 
>       □ shard-kbl: PASS -> DMESG-WARN ([i915#180]) +3 similar issues
>   • igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-indfb-plflip-blt:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#111825]) +14 similar issues
>   • igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-mmap-cpu:
> 
>       □ shard-kbl: NOTRUN -> SKIP ([fdo#109271]) +109 similar issues
>   • igt@kms_frontbuffer_tracking@psr-2p-primscrn-pri-shrfb-draw-blt:
> 
>       □ shard-iclb: NOTRUN -> SKIP ([fdo#109280]) +5 similar issues
>   • igt@kms_hdr@bpc-switch-suspend:
> 
>       □ shard-skl: PASS -> FAIL ([i915#1188])
>   • igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
> 
>       □ shard-skl: NOTRUN -> FAIL ([fdo#108145] / [i915#265]) +2 similar issues
>   • igt@kms_plane_alpha_blend@pipe-a-alpha-basic:
> 
>       □ shard-apl: NOTRUN -> FAIL ([fdo#108145] / [i915#265]) +2 similar issues
>   • igt@kms_plane_alpha_blend@pipe-b-alpha-basic:
> 
>       □ shard-kbl: NOTRUN -> FAIL ([fdo#108145] / [i915#265])
>   • igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
> 
>       □ shard-skl: PASS -> FAIL ([fdo#108145] / [i915#265])
>   • igt@kms_plane_alpha_blend@pipe-c-alpha-transparent-fb:
> 
>       □ shard-kbl: NOTRUN -> FAIL ([i915#265]) +1 similar issue
>   • igt@kms_plane_lowres@pipe-d-tiling-yf:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#112054]) +1 similar issue
>   • igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-5:
> 
>       □ shard-iclb: NOTRUN -> SKIP ([i915#658])
>   • igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-2:
> 
>       □ shard-skl: NOTRUN -> SKIP ([fdo#109271] / [i915#658]) +2 similar issues
>   • igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-4:
> 
>       □ shard-kbl: NOTRUN -> SKIP ([fdo#109271] / [i915#658])
>   • igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-5:
> 
>       □ shard-apl: NOTRUN -> SKIP ([fdo#109271] / [i915#658]) +5 similar issues
>   • igt@kms_psr2_sf@plane-move-sf-dmg-area-1:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([i915#2920])
>   • igt@kms_psr@psr2_primary_blt:
> 
>       □ shard-iclb: PASS -> SKIP ([fdo#109441]) +1 similar issue
>   • igt@kms_psr@psr2_primary_mmap_gtt:
> 
>       □ shard-tglb: NOTRUN -> FAIL ([i915#132] / [i915#3467]) +1 similar issue
>   • igt@kms_sysfs_edid_timing:
> 
>       □ shard-apl: NOTRUN -> FAIL ([IGT#2])
>   • igt@kms_vblank@pipe-d-wait-forked-hang:
> 
>       □ shard-apl: NOTRUN -> SKIP ([fdo#109271]) +206 similar issues
>   • igt@kms_writeback@writeback-check-output:
> 
>       □ shard-apl: NOTRUN -> SKIP ([fdo#109271] / [i915#2437])
> 
>       □ shard-iclb: NOTRUN -> SKIP ([i915#2437])
> 
>       □ shard-tglb: NOTRUN -> SKIP ([i915#2437])
> 
>   • igt@perf@gen12-mi-rpc:
> 
>       □ shard-skl: NOTRUN -> SKIP ([fdo#109271]) +80 similar issues
>   • igt@perf@polling-parameterized:
> 
>       □ shard-skl: PASS -> FAIL ([i915#1542])
>   • igt@prime_nv_pcopy@test1_macro:
> 
>       □ shard-tglb: NOTRUN -> SKIP ([fdo#109291])
>   • igt@sysfs_clients@fair-1:
> 
>       □ shard-apl: NOTRUN -> SKIP ([fdo#109271] / [i915#2994]) +1 similar issue
> 
>       □ shard-tglb: NOTRUN -> SKIP ([i915#2994]) +1 similar issue
> 
>   • igt@sysfs_clients@sema-10:
> 
>       □ shard-kbl: NOTRUN -> SKIP ([fdo#109271] / [i915#2994]) +1 similar issue
>   • igt@sysfs_clients@split-10:
> 
>       □ shard-skl: NOTRUN -> SKIP ([fdo#109271] / [i915#2994])
> 
> Possible fixes
> 
>   • igt@feature_discovery@psr2:
> 
>       □ {shard-rkl}: SKIP ([i915#658]) -> PASS
>   • igt@gem_ctx_isolation@preservation-s3@vecs0:
> 
>       □ shard-kbl: DMESG-WARN ([i915#180]) -> PASS +2 similar issues
>   • igt@gem_eio@reset-stress:
> 
>       □ {shard-rkl}: FAIL ([i915#3115]) -> PASS
>   • igt@gem_exec_fair@basic-deadline:
> 
>       □ shard-kbl: FAIL ([i915#2846]) -> PASS
>   • igt@gem_exec_fair@basic-flow@rcs0:
> 
>       □ shard-tglb: FAIL ([i915#2842]) -> PASS +1 similar issue
>   • igt@gem_exec_fair@basic-none@rcs0:
> 
>       □ shard-glk: FAIL ([i915#2842]) -> PASS
>   • igt@gem_exec_fair@basic-pace-solo@rcs0:
> 
>       □ shard-kbl: FAIL ([i915#2842]) -> PASS
>   • igt@gem_exec_fair@basic-pace@vcs0:
> 
>       □ {shard-rkl}: FAIL ([i915#2842]) -> PASS +1 similar issue
>   • igt@gem_exec_fair@basic-pace@vecs0:
> 
>       □ shard-kbl: SKIP ([fdo#109271]) -> PASS
>   • igt@gem_exec_suspend@basic-s4-devices:
> 
>       □ {shard-rkl}: INCOMPLETE ([i915#3189]) -> PASS
>   • igt@gem_fenced_exec_thrash@no-spare-fences:
> 
>       □ shard-snb: INCOMPLETE ([i915#2055]) -> PASS
>   • igt@gem_mmap_offset@clear:
> 
>       □ {shard-rkl}: FAIL ([i915#3160]) -> PASS
>   • igt@i915_pm_dc@dc6-dpms:
> 
>       □ shard-iclb: FAIL ([i915#454]) -> PASS
>   • igt@i915_pm_rpm@system-suspend-execbuf:
> 
>       □ shard-skl: INCOMPLETE ([i915#146] / [i915#151]) -> PASS
>   • igt@i915_selftest@live@gt_pm:
> 
>       □ {shard-rkl}: DMESG-FAIL ([i915#1021]) -> PASS
>   • igt@kms_async_flips@alternate-sync-async-flip:
> 
>       □ shard-skl: FAIL ([i915#2521]) -> PASS
> 
> SECURITY NOTE: file ~/.netrc must not be accessible by others
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index d67710d10615..299fc586488a 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -772,6 +772,104 @@  static int __cancel_completed(struct intel_engine_cs *engine)
 	return err;
 }
 
+static int __cancel_reset(struct drm_i915_private *i915,
+			  struct intel_engine_cs *engine)
+{
+	struct intel_context *ce;
+	struct igt_spinner spin;
+	struct i915_request *rq, *nop;
+	unsigned long preempt_timeout_ms;
+	int err = 0;
+
+	if (!CONFIG_DRM_I915_PREEMPT_TIMEOUT ||
+	    !intel_has_reset_engine(engine->gt))
+		return 0;
+
+	preempt_timeout_ms = engine->props.preempt_timeout_ms;
+	engine->props.preempt_timeout_ms = 100;
+
+	if (igt_spinner_init(&spin, engine->gt))
+		goto out_restore;
+
+	ce = intel_context_create(engine);
+	if (IS_ERR(ce)) {
+		err = PTR_ERR(ce);
+		goto out_spin;
+	}
+
+	rq = igt_spinner_create_request(&spin, ce, MI_NOOP);
+	if (IS_ERR(rq)) {
+		err = PTR_ERR(rq);
+		goto out_ce;
+	}
+
+	pr_debug("%s: Cancelling active non-preemptable request\n",
+		 engine->name);
+	i915_request_get(rq);
+	i915_request_add(rq);
+	if (!igt_wait_for_spinner(&spin, rq)) {
+		struct drm_printer p = drm_info_printer(engine->i915->drm.dev);
+
+		pr_err("Failed to start spinner on %s\n", engine->name);
+		intel_engine_dump(engine, &p, "%s\n", engine->name);
+		err = -ETIME;
+		goto out_rq;
+	}
+
+	nop = intel_context_create_request(ce);
+	if (IS_ERR(nop))
+		goto out_nop;
+	i915_request_get(nop);
+	i915_request_add(nop);
+
+	i915_request_cancel(rq, -EINTR);
+
+	if (i915_request_wait(rq, 0, HZ) < 0) {
+		struct drm_printer p = drm_info_printer(engine->i915->drm.dev);
+
+		pr_err("%s: Failed to cancel hung request\n", engine->name);
+		intel_engine_dump(engine, &p, "%s\n", engine->name);
+		err = -ETIME;
+		goto out_nop;
+	}
+
+	if (rq->fence.error != -EINTR) {
+		pr_err("%s: fence not cancelled (%u)\n",
+		       engine->name, rq->fence.error);
+		err = -EINVAL;
+		goto out_nop;
+	}
+
+	if (i915_request_wait(nop, 0, HZ) < 0) {
+		struct drm_printer p = drm_info_printer(engine->i915->drm.dev);
+
+		pr_err("%s: Failed to complete nop request\n", engine->name);
+		intel_engine_dump(engine, &p, "%s\n", engine->name);
+		err = -ETIME;
+		goto out_nop;
+	}
+
+	if (nop->fence.error != 0) {
+		pr_err("%s: Nop request errored (%u)\n",
+		       engine->name, nop->fence.error);
+		err = -EINVAL;
+	}
+
+out_nop:
+	i915_request_put(nop);
+out_rq:
+	i915_request_put(rq);
+out_ce:
+	intel_context_put(ce);
+out_spin:
+	igt_spinner_fini(&spin);
+out_restore:
+	engine->props.preempt_timeout_ms = preempt_timeout_ms;
+	if (err)
+		pr_err("%s: %s error %d\n", __func__, engine->name, err);
+	return err;
+}
+
 static int live_cancel_request(void *arg)
 {
 	struct drm_i915_private *i915 = arg;
@@ -804,6 +902,14 @@  static int live_cancel_request(void *arg)
 			return err;
 		if (err2)
 			return err2;
+
+		/* Expects reset so call outside of igt_live_test_* */
+		err = __cancel_reset(i915, engine);
+		if (err)
+			return err;
+
+		if (igt_flush_test(i915))
+			return -EIO;
 	}
 
 	return 0;