Skip to contentSkip to conversation

drm/i915: Check return value of i915_request_mark_eio before calling put

PATCH New Matthew Brost 2 participants 2 messages Nov 16, 2021 – Nov 17, 2021

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

PATCH 1/1 drm/i915: Check return value of i915_request_mark_eio before calling put

i915_request_mark_eio can return NULL and in some cases this return value was unconditionally passed to i915_request_put. i915_request_put in turn calls dma_fence_put on &rq->fence. dma_fence_put checks for NULL and short circuits. This all just happens to work because rq->fence is first member in the i915_request structure. Even though this works it is all rather dodgy, be safe and check the return of i915_request_mark_eio before calling i915_request_put.

---
 drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 6 ++++--
 drivers/gpu/drm/i915/gt/intel_ring_submission.c      | 3 ++-
 drivers/gpu/drm/i915/gt/mock_engine.c                | 3 ++-
 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c    | 9 ++++++---
 4 files changed, 14 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +4 -2
index ca03880fa7e4..fb7e64f78722 100644
@@ -3073,7 +3073,8 @@ static void execlists_reset_cancel(struct intel_engine_cs *engine)
 
 	/* Mark all executing requests as skipped. */
 	list_for_each_entry(rq, &engine->sched_engine->requests, sched.link)
-		i915_request_put(i915_request_mark_eio(rq));
+		if (i915_request_mark_eio(rq))
+			i915_request_put(rq);
 	intel_engine_signal_breadcrumbs(engine);
 
 	/* Flush the queued requests to the timeline list (for retiring). */
@@ -3093,7 +3094,8 @@ static void execlists_reset_cancel(struct intel_engine_cs *engine)
 
 	/* On-hold requests will be flushed to timeline upon their release */
 	list_for_each_entry(rq, &sched_engine->hold, sched.link)
-		i915_request_put(i915_request_mark_eio(rq));
+		if (i915_request_mark_eio(rq))
+			i915_request_put(rq);
 
 	/* Cancel all attached virtual engines */
 	while ((rb = rb_first_cached(&execlists->virtual))) {
drivers/gpu/drm/i915/gt/intel_ring_submission.c +2 -1
index 586dca1731ce..fc73f8744758 100644
@@ -419,7 +419,8 @@ static void reset_cancel(struct intel_engine_cs *engine)
 
 	/* Mark all submitted requests as skipped. */
 	list_for_each_entry(request, &engine->sched_engine->requests, sched.link)
-		i915_request_put(i915_request_mark_eio(request));
+		if (i915_request_mark_eio(request))
+			i915_request_put(request);
 	intel_engine_signal_breadcrumbs(engine);
 
 	/* Remaining _unready_ requests will be nop'ed when submitted */
drivers/gpu/drm/i915/gt/mock_engine.c +2 -1
index 8b89215afe46..aae5e8dadd26 100644
@@ -285,7 +285,8 @@ static void mock_reset_cancel(struct intel_engine_cs *engine)
 
 	/* Mark all submitted requests as skipped. */
 	list_for_each_entry(rq, &engine->sched_engine->requests, sched.link)
-		i915_request_put(i915_request_mark_eio(rq));
+		if (i915_request_mark_eio(rq))
+			i915_request_put(rq);
 	intel_engine_signal_breadcrumbs(engine);
 
 	/* Cancel and submit all pending requests. */
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +6 -3
index d7e49f7c1dba..42bd2a8c6751 100644
@@ -642,7 +642,8 @@ static int __guc_add_request(struct intel_guc *guc, struct i915_request *rq)
 	 * request resubmitted after the context was banned.
 	 */
 	if (unlikely(intel_context_is_banned(ce))) {
-		i915_request_put(i915_request_mark_eio(rq));
+		if (i915_request_mark_eio(rq))
+			i915_request_put(rq);
 		intel_engine_signal_breadcrumbs(ce->engine);
 		return 0;
 	}
@@ -1638,7 +1639,8 @@ static void guc_cancel_context_requests(struct intel_context *ce)
 	spin_lock_irqsave(&sched_engine->lock, flags);
 	spin_lock(&ce->guc_state.lock);
 	list_for_each_entry(rq, &ce->guc_state.requests, sched.link)
-		i915_request_put(i915_request_mark_eio(rq));
+		if (i915_request_mark_eio(rq))
+			i915_request_put(rq);
 	spin_unlock(&ce->guc_state.lock);
 	spin_unlock_irqrestore(&sched_engine->lock, flags);
 }
@@ -1679,7 +1681,8 @@ guc_cancel_sched_engine_requests(struct i915_sched_engine *sched_engine)
 
 			__i915_request_submit(rq);
 
-			i915_request_put(i915_request_mark_eio(rq));
+			if (i915_request_mark_eio(rq))
+				i915_request_put(rq);
 		}
 
 		rb_erase_cached(&p->node, &sched_engine->queue);
Signature · 1 line
2.33.1
#1 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Check return value of i915_request_mark_eio before calling put

== Series Details ==

== Series Details ==

Series: drm/i915: Check return value of i915_request_mark_eio before calling put
URL : https://patchwork.freedesktop.org/series/96992/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10888 -> Patchwork_21606
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_21606, 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_21606/index.html

Participating hosts (39 -> 34)
------------------------------

Additional (1): fi-kbl-soraka
Missing (6): fi-ilk-m540 bat-dg1-6 fi-hsw-4200u fi-icl-u2 fi-bsw-cyan fi-ctg-p8600

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

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_flink_basic@bad-flink:
- fi-skl-6600u: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10888/fi-skl-6600u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21606/fi-skl-6600u/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_fence@basic-busy@bcs0:
- fi-kbl-soraka: NOTRUN -> [SKIP][3] ([fdo#109271]) +8 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21606/fi-kbl-soraka/igt@gem_exec_fence@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21606/fi-kbl-soraka/igt@[email protected]

* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][5] ([i915#1886] / [i915#2291])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21606/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-kbl-soraka: NOTRUN -> [SKIP][6] ([fdo#109271] / [fdo#111827]) +8 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21606/fi-kbl-soraka/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- fi-kbl-soraka: NOTRUN -> [SKIP][7] ([fdo#109271] / [i915#533])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21606/fi-kbl-soraka/igt@[email protected]

* igt@runner@aborted:
- fi-skl-6600u: NOTRUN -> [FAIL][8] ([i915#2722] / [i915#3363] / [i915#4312])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21606/fi-skl-6600u/igt@[email protected]

#### Possible fixes ####

* igt@core_hotunplug@unbind-rebind:
- fi-tgl-u2: [INCOMPLETE][9] ([i915#4006]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10888/fi-tgl-u2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21606/fi-tgl-u2/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- {fi-hsw-gt1}: [DMESG-WARN][11] ([i915#3303]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10888/fi-hsw-gt1/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21606/fi-hsw-gt1/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
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2291]: https://gitlab.freedesktop.org/drm/intel/issues/2291
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
[i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
[i915#4006]: https://gitlab.freedesktop.org/drm/intel/issues/4006
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533

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

* Linux: CI_DRM_10888 -> Patchwork_21606

CI-20190529: 20190529
CI_DRM_10888: d4a23275467825243fea6f50938fc89711b9a53c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6281: 551f33d68fc780e3d264abd69ec59fe1af1bb65b @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21606: fc7b69f04cdae0cb2c8ed72507785b6913d8d28f @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

fc7b69f04cda drm/i915: Check return value of i915_request_mark_eio before calling put

== Logs ==

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