Skip to contentSkip to conversation

drm/i915: Wedge the GPU if command parser setup fails

Intel-gfx Tvrtko Ursulin 2 participants 3 messages Mar 2, 2021

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

From: Tvrtko Ursulin <[email protected]>

Commit 311a50e76a33 ("drm/i915: Add support for mandatory cmdparsing") introduced mandatory command parsing but setup failures were not translated into wedging the GPU which was probably the intent.

Possible errors come in two categories. Either the sanity check on internal tables has failed, which should be caught in CI unless an affected platform would be missed in testing; or memory allocation failure happened during driver load, which should be extremely unlikely but for correctness should still be handled.

v2:
* Tidy coding style. (Chris)

Fixes 311a50e76a33 ("drm/i915: Add support for mandatory cmdparsing")
Cc Jon Bloomfield <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c |  7 ++++++-
 drivers/gpu/drm/i915/i915_cmd_parser.c    | 19 +++++++++++++------
 drivers/gpu/drm/i915/i915_drv.h           |  2 +-
 3 files changed, 20 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +6 -1
index 577ebd4a324f..b4df275cba79 100644
@@ -696,6 +696,10 @@ static int engine_setup_common(struct intel_engine_cs *engine)
 		goto err_status;
 	}
 
+	err = intel_engine_init_cmd_parser(engine);
+	if (err)
+		goto err_cmd_parser;
+
 	i915_sched_init(&engine->sched,
 			engine->i915->drm.dev,
 			engine->name,
@@ -703,7 +707,6 @@ static int engine_setup_common(struct intel_engine_cs *engine)
 			ENGINE_PHYSICAL);
 
 	intel_engine_init_execlists(engine);
-	intel_engine_init_cmd_parser(engine);
 	intel_engine_init__pm(engine);
 	intel_engine_init_retire(engine);
 
@@ -720,6 +723,8 @@ static int engine_setup_common(struct intel_engine_cs *engine)
 
 	return 0;
 
+err_cmd_parser:
+	intel_breadcrumbs_free(engine->breadcrumbs);
 err_status:
 	cleanup_status_page(engine);
 	return err;
drivers/gpu/drm/i915/i915_cmd_parser.c +13 -6
index ced9a96d7c34..5f86f5b2caf6 100644
@@ -940,7 +940,7 @@ static void fini_hash_table(struct intel_engine_cs *engine)
  * struct intel_engine_cs based on whether the platform requires software
  * command parsing.
  */
-void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
+int intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
 {
 	const struct drm_i915_cmd_table *cmd_tables;
 	int cmd_table_count;
@@ -948,7 +948,7 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
 
 	if (!IS_GEN(engine->i915, 7) && !(IS_GEN(engine->i915, 9) &&
 					  engine->class == COPY_ENGINE_CLASS))
-		return;
+		return 0;
 
 	switch (engine->class) {
 	case RENDER_CLASS:
@@ -1013,19 +1013,19 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
 		break;
 	default:
 		MISSING_CASE(engine->class);
-		return;
+		goto out;
 	}
 
 	if (!validate_cmds_sorted(engine, cmd_tables, cmd_table_count)) {
 		drm_err(&engine->i915->drm,
 			"%s: command descriptions are not sorted\n",
 			engine->name);
-		return;
+		goto out;
 	}
 	if (!validate_regs_sorted(engine)) {
 		drm_err(&engine->i915->drm,
 			"%s: registers are not sorted\n", engine->name);
-		return;
+		goto out;
 	}
 
 	ret = init_hash_table(engine, cmd_tables, cmd_table_count);
@@ -1033,10 +1033,17 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
 		drm_err(&engine->i915->drm,
 			"%s: initialised failed!\n", engine->name);
 		fini_hash_table(engine);
-		return;
+		goto out;
 	}
 
 	engine->flags |= I915_ENGINE_USING_CMD_PARSER;
+
+out:
+	if (intel_engine_requires_cmd_parser(engine) &&
+	    !intel_engine_using_cmd_parser(engine))
+		return -EINVAL;
+
+	return 0;
 }
 
 /**
drivers/gpu/drm/i915/i915_drv.h +1 -1
index f8413b3b9da8..c8b04b0ec919 100644
@@ -1946,7 +1946,7 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type);
 
 /* i915_cmd_parser.c */
 int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv);
-void intel_engine_init_cmd_parser(struct intel_engine_cs *engine);
+int intel_engine_init_cmd_parser(struct intel_engine_cs *engine);
 void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine);
 int intel_engine_cmd_parser(struct intel_engine_cs *engine,
 			    struct i915_vma *batch,
Signature · 6 lines
2.27.0

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

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Wedge the GPU if command parser setup fails (rev2)

== Series Details ==

== Series Details ==

Series: drm/i915: Wedge the GPU if command parser setup fails (rev2)
URL : https://patchwork.freedesktop.org/series/87422/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9820 -> Patchwork_19743
====================================================

Summary
-------

**FAILURE**

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

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

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/index.html

Possible new issues
-------------------

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_tiled_fence_blits@basic:
- fi-kbl-8809g: [PASS][1] -> [TIMEOUT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9820/fi-kbl-8809g/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-kbl-8809g/igt@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@core_hotunplug@unbind-rebind:
- {fi-ehl-1}: [PASS][3] -> [DMESG-WARN][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9820/fi-ehl-1/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-ehl-1/igt@[email protected]

Known issues
------------

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

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@sync-gfx0:
- fi-bsw-n3050: NOTRUN -> [SKIP][5] ([fdo#109271]) +17 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-bsw-n3050/igt@amdgpu/[email protected]

* igt@fbdev@read:
- fi-tgl-y: [PASS][6] -> [DMESG-WARN][7] ([i915#402]) +2 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9820/fi-tgl-y/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-tgl-y/igt@[email protected]

* igt@gem_exec_suspend@basic-s3:
- fi-tgl-u2: [PASS][8] -> [FAIL][9] ([i915#1888])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9820/fi-tgl-u2/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-tgl-u2/igt@[email protected]

* igt@i915_selftest@live@late_gt_pm:
- fi-bsw-nick: [PASS][10] -> [DMESG-FAIL][11] ([i915#2927])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9820/fi-bsw-nick/igt@i915_selftest@live@late_gt_pm.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-bsw-nick/igt@i915_selftest@live@late_gt_pm.html

* igt@runner@aborted:
- fi-bsw-nick: NOTRUN -> [FAIL][12] ([i915#1436])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-bsw-nick/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_create@basic:
- fi-tgl-y: [DMESG-WARN][13] ([i915#402]) -> [PASS][14] +2 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9820/fi-tgl-y/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-tgl-y/igt@[email protected]

* igt@gem_exec_gttfill@basic:
- fi-kbl-8809g: [TIMEOUT][15] -> [PASS][16] +1 similar issue
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9820/fi-kbl-8809g/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-kbl-8809g/igt@[email protected]

* igt@i915_selftest@live@execlists:
- fi-bsw-n3050: [INCOMPLETE][17] ([i915#2940]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9820/fi-bsw-n3050/igt@i915_selftest@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/fi-bsw-n3050/igt@i915_selftest@[email protected]

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

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#2505]: https://gitlab.freedesktop.org/drm/intel/issues/2505
[i915#2927]: https://gitlab.freedesktop.org/drm/intel/issues/2927
[i915#2940]: https://gitlab.freedesktop.org/drm/intel/issues/2940
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402

Participating hosts (45 -> 41)
------------------------------

Missing (4): fi-ctg-p8600 fi-ilk-m540 fi-bsw-cyan fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_9820 -> Patchwork_19743

CI-20190529: 20190529
CI_DRM_9820: 9761fb66bc43d298a90c7dd353d376d0802e6e79 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6017: dc9f6d13f4ddea5286ed4723627b79db1e2210d2 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19743: acf13c4fdba4ee323e9f4207ffbb77a41529f7da @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

acf13c4fdba4 drm/i915: Wedge the GPU if command parser setup fails

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19743/index.html

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

#2 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Wedge the GPU if command parser setup fails (rev3)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915: Wedge the GPU if command parser setup fails (rev3)
URL : https://patchwork.freedesktop.org/series/87422/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9821 -> Patchwork_19745
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/index.html

Known issues
------------

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

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@sync-gfx0:
- fi-bsw-n3050: NOTRUN -> [SKIP][1] ([fdo#109271]) +17 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/fi-bsw-n3050/igt@amdgpu/[email protected]

* igt@gem_render_tiled_blits@basic:
- fi-tgl-y: [PASS][2] -> [DMESG-WARN][3] ([i915#402])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9821/fi-tgl-y/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/fi-tgl-y/igt@[email protected]

* igt@i915_selftest@live@execlists:
- fi-bsw-nick: [PASS][4] -> [INCOMPLETE][5] ([i915#2940])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9821/fi-bsw-nick/igt@i915_selftest@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/fi-bsw-nick/igt@i915_selftest@[email protected]

* igt@runner@aborted:
- fi-bsw-nick: NOTRUN -> [FAIL][6] ([i915#1436])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/fi-bsw-nick/igt@[email protected]

#### Possible fixes ####

* igt@gem_linear_blits@basic:
- fi-kbl-8809g: [TIMEOUT][7] ([i915#2502]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9821/fi-kbl-8809g/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/fi-kbl-8809g/igt@[email protected]
- fi-tgl-y: [DMESG-WARN][9] ([i915#402]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9821/fi-tgl-y/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/fi-tgl-y/igt@[email protected]

* igt@i915_selftest@live@client:
- fi-glk-dsi: [DMESG-FAIL][11] ([i915#3047]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9821/fi-glk-dsi/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/fi-glk-dsi/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@execlists:
- fi-bsw-n3050: [INCOMPLETE][13] ([i915#2940]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9821/fi-bsw-n3050/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/fi-bsw-n3050/igt@i915_selftest@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#2502]: https://gitlab.freedesktop.org/drm/intel/issues/2502
[i915#2940]: https://gitlab.freedesktop.org/drm/intel/issues/2940
[i915#3047]: https://gitlab.freedesktop.org/drm/intel/issues/3047
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402

Participating hosts (45 -> 41)
------------------------------

Missing (4): fi-ctg-p8600 fi-ilk-m540 fi-bsw-cyan fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_9821 -> Patchwork_19745

CI-20190529: 20190529
CI_DRM_9821: 2eaa470f08c2bc15cc2c17da08c232ac46721e54 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6018: c6a54879da62c956549b89e3feaa52d4e6039b9f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19745: c3fea5cb372d13a92b2c7c780cc3b903a918e148 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

c3fea5cb372d drm/i915: Wedge the GPU if command parser setup fails

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19745/index.html

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