Skip to contentSkip to conversation

drm/i915/gt: Hold a wakeref for the active VM

PATCH In review Andrzej Hajda 4 participants 12 messages Mar 31, 2023 – Apr 5, 2023

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

PATCH v2 1/1 drm/i915/gt: Hold a wakeref for the active VM

From: Chris Wilson <[email protected]>

There may be a disconnect between the GT used by the engine and the GT used for the VM, requiring us to hold a wakeref on both while the GPU is active with this request.

v2: added explanation to __queue_and_release_pm

[ahajda: removed not-yet-upstremed wakeref tracking bits]

---
Changes in v2:
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 drivers/gpu/drm/i915/gt/intel_context.h   | 15 +++++++++++----
 drivers/gpu/drm/i915/gt/intel_engine_pm.c |  9 +++++++++
 2 files changed, 20 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.h +11 -4
index 0a8d553da3f439..48f888c3da083b 100644
@@ -14,6 +14,7 @@
 #include "i915_drv.h"
 #include "intel_context_types.h"
 #include "intel_engine_types.h"
+#include "intel_gt_pm.h"
 #include "intel_ring_types.h"
 #include "intel_timeline_types.h"
 #include "i915_trace.h"
@@ -207,8 +208,11 @@ void intel_context_exit_engine(struct intel_context *ce);
 static inline void intel_context_enter(struct intel_context *ce)
 {
 	lockdep_assert_held(&ce->timeline->mutex);
-	if (!ce->active_count++)
-		ce->ops->enter(ce);
+	if (ce->active_count++)
+		return;
+
+	ce->ops->enter(ce);
+	intel_gt_pm_get(ce->vm->gt);
 }
 
 static inline void intel_context_mark_active(struct intel_context *ce)
@@ -222,8 +226,11 @@ static inline void intel_context_exit(struct intel_context *ce)
 {
 	lockdep_assert_held(&ce->timeline->mutex);
 	GEM_BUG_ON(!ce->active_count);
-	if (!--ce->active_count)
-		ce->ops->exit(ce);
+	if (--ce->active_count)
+		return;
+
+	intel_gt_pm_put_async(ce->vm->gt);
+	ce->ops->exit(ce);
 }
 
 static inline struct intel_context *intel_context_get(struct intel_context *ce)
drivers/gpu/drm/i915/gt/intel_engine_pm.c +9 -0
index e971b153fda976..ee531a5c142c77 100644
@@ -114,6 +114,15 @@ __queue_and_release_pm(struct i915_request *rq,
 
 	ENGINE_TRACE(engine, "parking\n");
 
+	/*
+	 * Open coded one half of intel_context_enter, which we have to omit
+	 * here (see the large comment below) and because the other part must
+	 * not be called due constructing directly with __i915_request_create
+	 * which increments active count via intel_context_mark_active.
+	 */
+	GEM_BUG_ON(rq->context->active_count != 1);
+	__intel_gt_pm_get(engine->gt);
+
 	/*
 	 * We have to serialise all potential retirement paths with our
 	 * submission, as we don't want to underflow either the

---
base-commit: 3385d6482cd60f2a0bbb0fa97b70ae7dbba4f95c
change-id: 20230330-hold_wakeref_for_active_vm-7f013a449ef3

Best regards,

Signature · 1 line
Andrzej Hajda <[email protected]>
Reviewed-by on v2 1/1
#1 lore raw
Quoted 69 lines · Andrzej Hajda

From: Chris Wilson <[email protected]>

There may be a disconnect between the GT used by the engine and the GT used for the VM, requiring us to hold a wakeref on both while the GPU is active with this request.

v2: added explanation to __queue_and_release_pm

[ahajda: removed not-yet-upstremed wakeref tracking bits]

---
Changes in v2:
- Link to v1: https://lore.kernel.org/r/[email protected]

---
  drivers/gpu/drm/i915/gt/intel_context.h   | 15 +++++++++++----
  drivers/gpu/drm/i915/gt/intel_engine_pm.c |  9 +++++++++
  2 files changed, 20 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.h +11 -4
index 0a8d553da3f439..48f888c3da083b 100644
@@ -14,6 +14,7 @@
  #include "i915_drv.h"
  #include "intel_context_types.h"
  #include "intel_engine_types.h"
+#include "intel_gt_pm.h"
  #include "intel_ring_types.h"
  #include "intel_timeline_types.h"
  #include "i915_trace.h"
@@ -207,8 +208,11 @@ void intel_context_exit_engine(struct intel_context *ce);
  static inline void intel_context_enter(struct intel_context *ce)
  {
  	lockdep_assert_held(&ce->timeline->mutex);
-	if (!ce->active_count++)
-		ce->ops->enter(ce);
+	if (ce->active_count++)
+		return;
+
+	ce->ops->enter(ce);
+	intel_gt_pm_get(ce->vm->gt);
  }
 
  static inline void intel_context_mark_active(struct intel_context *ce)
@@ -222,8 +226,11 @@ static inline void intel_context_exit(struct intel_context *ce)
  {
  	lockdep_assert_held(&ce->timeline->mutex);
  	GEM_BUG_ON(!ce->active_count);
-	if (!--ce->active_count)
-		ce->ops->exit(ce);
+	if (--ce->active_count)
+		return;
+
+	intel_gt_pm_put_async(ce->vm->gt);
+	ce->ops->exit(ce);
  }
 
  static inline struct intel_context *intel_context_get(struct intel_context *ce)
drivers/gpu/drm/i915/gt/intel_engine_pm.c +2 -0
index e971b153fda976..ee531a5c142c77 100644
@@ -114,6 +114,15 @@ __queue_and_release_pm(struct i915_request *rq,
 
  	ENGINE_TRACE(engine, "parking\n");
 
+	/*
+	 * Open coded one half of intel_context_enter, which we have to omit

drivers/gpu/drm/i915/gt/intel_engine_pm.c __queue_and_release_pm(struct i915_request *rq, · line 128

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_engine_pm.c +7 -0
+	 * here (see the large comment below) and because the other part must
+	 * not be called due constructing directly with __i915_request_create
+	 * which increments active count via intel_context_mark_active.
+	 */
+	GEM_BUG_ON(rq->context->active_count != 1);
+	__intel_gt_pm_get(engine->gt);
+
  	/*
  	 * We have to serialise all potential retirement paths with our
  	 * submission, as we don't want to underflow either the

Regards,

Tvrtko

#2 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gt: Hold a wakeref for the active VM (rev2)

In reply to Andrzej Hajda
== Series Details ==

== Series Details ==

Series: drm/i915/gt: Hold a wakeref for the active VM (rev2)
URL : https://patchwork.freedesktop.org/series/115873/
State : warning

== Summary ==

Error: dim checkpatch failed
a5998f00a5a9 drm/i915/gt: Hold a wakeref for the active VM
-:71: WARNING:AVOID_BUG: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants #71: FILE: drivers/gpu/drm/i915/gt/intel_engine_pm.c:123:
+ GEM_BUG_ON(rq->context->active_count != 1);

total: 0 errors, 1 warnings, 0 checks, 48 lines checked

#3 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gt: Hold a wakeref for the active VM (rev2)

In reply to Andrzej Hajda
== Series Details ==

== Series Details ==

Series: drm/i915/gt: Hold a wakeref for the active VM (rev2)
URL : https://patchwork.freedesktop.org/series/115873/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12951 -> Patchwork_115873v2
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (37 -> 36)
------------------------------

Missing (1): fi-snb-2520m

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@reset:
- bat-rpls-1: [PASS][1] -> [ABORT][2] ([i915#4983])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/bat-rpls-1/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/bat-rpls-1/igt@i915_selftest@[email protected]

* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-dg2-11: NOTRUN -> [SKIP][3] ([i915#7828])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/bat-dg2-11/igt@[email protected]

* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
- bat-dg2-11: NOTRUN -> [SKIP][4] ([i915#5354])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/bat-dg2-11/igt@[email protected]

#### Possible fixes ####

* igt@i915_pm_rps@basic-api:
- bat-dg2-11: [FAIL][5] ([i915#8308]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/bat-dg2-11/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/bat-dg2-11/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- fi-skl-guc: [DMESG-WARN][7] ([i915#8073]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/fi-skl-guc/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/fi-skl-guc/igt@i915_selftest@[email protected]
- bat-dg2-11: [ABORT][9] ([i915#7913]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/bat-dg2-11/igt@i915_selftest@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/bat-dg2-11/igt@i915_selftest@[email protected]

* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1:
- bat-dg2-8: [FAIL][11] ([i915#7932]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]

#### Warnings ####

* igt@i915_selftest@live@slpc:
- bat-rpls-2: [DMESG-FAIL][13] ([i915#6997] / [i915#7913]) -> [DMESG-FAIL][14] ([i915#6367] / [i915#7913])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/bat-rpls-2/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/bat-rpls-2/igt@i915_selftest@[email protected]

[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6997]: https://gitlab.freedesktop.org/drm/intel/issues/6997
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
[i915#8073]: https://gitlab.freedesktop.org/drm/intel/issues/8073
[i915#8308]: https://gitlab.freedesktop.org/drm/intel/issues/8308

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

* Linux: CI_DRM_12951 -> Patchwork_115873v2

CI-20190529: 20190529
CI_DRM_12951: f128906b94b25a0f0c12dc8c647b8adc8d934d8c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7230: f0485204004305dd3ee8f8bbbb9c552e53a4e050 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_115873v2: f128906b94b25a0f0c12dc8c647b8adc8d934d8c @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

8ebb9d2f7fb1 drm/i915/gt: Hold a wakeref for the active VM

== Logs ==

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

#4 lore raw

[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/gt: Hold a wakeref for the active VM (rev2)

In reply to Andrzej Hajda
== Series Details ==

== Series Details ==

Series: drm/i915/gt: Hold a wakeref for the active VM (rev2)
URL : https://patchwork.freedesktop.org/series/115873/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12951_full -> Patchwork_115873v2_full
====================================================

Summary
-------

**FAILURE**

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

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

Participating hosts (7 -> 7)
------------------------------

No changes in participating hosts

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

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_exec_fence@syncobj-repeat:
- shard-glk: [PASS][1] -> [TIMEOUT][2] +2 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk5/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk9/igt@[email protected]

#### Warnings ####

* igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-pwrite:
- shard-glk: [SKIP][3] ([fdo#109271]) -> [TIMEOUT][4] +2 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk5/igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-pwrite.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk9/igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-pwrite.html

#### Suppressed ####

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

* {igt@perf@enable-disable@0-rcs0}:
- shard-glk: [PASS][5] -> [TIMEOUT][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk5/igt@perf@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk9/igt@perf@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_fair@basic-deadline:
- shard-glk: [PASS][7] -> [FAIL][8] ([i915#2846])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk9/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk8/igt@[email protected]

* igt@gen9_exec_parse@allowed-single:
- shard-apl: [PASS][9] -> [ABORT][10] ([i915#5566])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl7/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl3/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- shard-apl: [PASS][11] -> [DMESG-FAIL][12] ([i915#5334])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl1/igt@i915_selftest@live@gt_heartbeat.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl2/igt@i915_selftest@live@gt_heartbeat.html

* igt@kms_async_flips@alternate-sync-async-flip@pipe-a-vga-1:
- shard-snb: [PASS][13] -> [FAIL][14] ([i915#2521])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-snb5/igt@kms_async_flips@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-snb2/igt@kms_async_flips@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-glk: [PASS][15] -> [FAIL][16] ([i915#2346])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk1/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk2/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@b-dp1:
- shard-apl: [PASS][17] -> [FAIL][18] ([i915#79])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl4/igt@kms_flip@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl7/igt@kms_flip@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend@pipe-a-planes:
- shard-apl: [PASS][19] -> [ABORT][20] ([i915#180])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl7/igt@kms_plane@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl3/igt@kms_plane@[email protected]

#### Possible fixes ####

* igt@gem_ctx_exec@basic-nohangcheck:
- {shard-tglu}: [FAIL][21] ([i915#6268]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-tglu-2/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-tglu-10/igt@[email protected]

* igt@gem_eio@in-flight-contexts-1us:
- {shard-tglu}: [TIMEOUT][23] ([i915#3063]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-tglu-7/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-tglu-3/igt@[email protected]

* igt@gem_eio@reset-stress:
- {shard-dg1}: [FAIL][25] ([i915#5784]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-dg1-14/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-dg1-15/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-flip-vs-cursor-atomic:
- shard-glk: [FAIL][27] ([i915#72]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk1/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk2/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
- shard-apl: [FAIL][29] ([i915#2346]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl2/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl6/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
- shard-glk: [FAIL][31] ([i915#2346]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk2/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk4/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

{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#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1902]: https://gitlab.freedesktop.org/drm/intel/issues/1902
[i915#1937]: https://gitlab.freedesktop.org/drm/intel/issues/1937
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2521]: https://gitlab.freedesktop.org/drm/intel/issues/2521
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
[i915#3063]: https://gitlab.freedesktop.org/drm/intel/issues/3063
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3989]: https://gitlab.freedesktop.org/drm/intel/issues/3989
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#4565]: https://gitlab.freedesktop.org/drm/intel/issues/4565
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
[i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
[i915#4884]: https://gitlab.freedesktop.org/drm/intel/issues/4884
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
[i915#5566]: https://gitlab.freedesktop.org/drm/intel/issues/5566
[i915#5784]: https://gitlab.freedesktop.org/drm/intel/issues/5784
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
[i915#6953]: https://gitlab.freedesktop.org/drm/intel/issues/6953
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#72]: https://gitlab.freedesktop.org/drm/intel/issues/72
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011

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

* Linux: CI_DRM_12951 -> Patchwork_115873v2

CI-20190529: 20190529
CI_DRM_12951: f128906b94b25a0f0c12dc8c647b8adc8d934d8c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7230: f0485204004305dd3ee8f8bbbb9c552e53a4e050 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_115873v2: f128906b94b25a0f0c12dc8c647b8adc8d934d8c @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

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

#5 lore raw

Re: [Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/gt: Hold a wakeref for the active VM (rev2)

Quoted 35 lines · Patchwork

Project List - Patchwork *Patch Details*
*Series:* drm/i915/gt: Hold a wakeref for the active VM (rev2)
*URL:* https://patchwork.freedesktop.org/series/115873/
*State:* failure
*Details:* https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/index.html

CI Bug Log - changes from CI_DRM_12951_full -> Patchwork_115873v2_full

Summary

*FAILURE*

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

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

    Participating hosts (7 -> 7)

No changes in participating hosts

Possible new issues

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

IGT changes

Quoted 9 lines

Possible regressions

* igt@gem_exec_fence@syncobj-repeat:

      o shard-glk: PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk5/igt@[email protected]>
        -> TIMEOUT
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk9/igt@[email protected]>
        +2 similar issues

The actual test did not even start, because of failure on previous tests. All tests since igt@perf@enable-disable@0-rcs0 timeouts on this machine[1]. Since igt@perf@enable-disable is untrusted/suppressed I guess it is not related. Moreover v1(which differs only by comment) passed.
Summarizing apparently known bug in igt@perf@subtests [2].

[1]: http://gfx-ci.igk.intel.com/tree/drm-tip/Patchwork_115873v2/shard-glk9/igt_runner13.txt
[2]: https://gitlab.freedesktop.org/drm/intel/-/issues/5213

Regards
Andrzej

Quoted 180 lines

*

Warnings

* igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-pwrite:

      o shard-glk: SKIP
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk5/igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-pwrite.html>
        (fdo#109271
        <https://bugs.freedesktop.org/show_bug.cgi?id=109271>) ->
        TIMEOUT
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk9/igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-pwrite.html>
        +2 similar issues


        Suppressed

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

* {igt@perf@enable-disable@0-rcs0}:

      o shard-glk: PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk5/igt@perf@[email protected]>
        -> TIMEOUT
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk9/igt@perf@[email protected]>


    Known issues

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

IGT changes

Issues hit

*

    igt@gem_exec_fair@basic-deadline:

      o shard-glk: PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk9/igt@[email protected]>
        -> FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk8/igt@[email protected]>
        (i915#2846 <https://gitlab.freedesktop.org/drm/intel/issues/2846>)

*

    igt@gen9_exec_parse@allowed-single:

      o shard-apl: PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl7/igt@[email protected]>
        -> ABORT
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl3/igt@[email protected]>
        (i915#5566 <https://gitlab.freedesktop.org/drm/intel/issues/5566>)

*

    igt@i915_selftest@live@gt_heartbeat:

      o shard-apl: PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl1/igt@i915_selftest@live@gt_heartbeat.html>
        -> DMESG-FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl2/igt@i915_selftest@live@gt_heartbeat.html>
        (i915#5334 <https://gitlab.freedesktop.org/drm/intel/issues/5334>)

*

    igt@kms_async_flips@alternate-sync-async-flip@pipe-a-vga-1:

      o shard-snb: PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-snb5/igt@kms_async_flips@[email protected]>
        -> FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-snb2/igt@kms_async_flips@[email protected]>
        (i915#2521 <https://gitlab.freedesktop.org/drm/intel/issues/2521>)

*

    igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:

      o shard-glk: PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk1/igt@[email protected]>
        -> FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk2/igt@[email protected]>
        (i915#2346 <https://gitlab.freedesktop.org/drm/intel/issues/2346>)

*

    igt@kms_flip@flip-vs-expired-vblank@b-dp1:

      o shard-apl: PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl4/igt@kms_flip@[email protected]>
        -> FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl7/igt@kms_flip@[email protected]>
        (i915#79 <https://gitlab.freedesktop.org/drm/intel/issues/79>)

*

    igt@kms_plane@plane-panning-bottom-right-suspend@pipe-a-planes:

      o shard-apl: PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl7/igt@kms_plane@[email protected]>
        -> ABORT
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl3/igt@kms_plane@[email protected]>
        (i915#180 <https://gitlab.freedesktop.org/drm/intel/issues/180>)


        Possible fixes

*

    igt@gem_ctx_exec@basic-nohangcheck:

      o {shard-tglu}: FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-tglu-2/igt@[email protected]>
        (i915#6268
        <https://gitlab.freedesktop.org/drm/intel/issues/6268>) ->
        PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-tglu-10/igt@[email protected]>

*

    igt@gem_eio@in-flight-contexts-1us:

      o {shard-tglu}: TIMEOUT
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-tglu-7/igt@[email protected]>
        (i915#3063
        <https://gitlab.freedesktop.org/drm/intel/issues/3063>) ->
        PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-tglu-3/igt@[email protected]>

*

    igt@gem_eio@reset-stress:

      o {shard-dg1}: FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-dg1-14/igt@[email protected]>
        (i915#5784
        <https://gitlab.freedesktop.org/drm/intel/issues/5784>) ->
        PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-dg1-15/igt@[email protected]>

*

    igt@kms_cursor_legacy@2x-long-flip-vs-cursor-atomic:

      o shard-glk: FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk1/igt@[email protected]>
        (i915#72 <https://gitlab.freedesktop.org/drm/intel/issues/72>)
        -> PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk2/igt@[email protected]>

*

    igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:

     o

        shard-apl: FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-apl2/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html>
        (i915#2346
        <https://gitlab.freedesktop.org/drm/intel/issues/2346>) ->
        PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-apl6/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html>

     o

        shard-glk: FAIL
        <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12951/shard-glk2/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html>
        (i915#2346
        <https://gitlab.freedesktop.org/drm/intel/issues/2346>) ->
        PASS
        <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_115873v2/shard-glk4/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html>

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

Build changes

* Linux: CI_DRM_12951 -> Patchwork_115873v2

CI-20190529: 20190529
CI_DRM_12951: f128906b94b25a0f0c12dc8c647b8adc8d934d8c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7230: f0485204004305dd3ee8f8bbbb9c552e53a4e050 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_115873v2: f128906b94b25a0f0c12dc8c647b8adc8d934d8c @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

#6 lore raw
In reply to Andrzej Hajda

Hi Andrzej,

Quoted 27 lines
drivers/gpu/drm/i915/gt/intel_context.h +6 -2
index 0a8d553da3f439..48f888c3da083b 100644
@@ -14,6 +14,7 @@
 #include "i915_drv.h"
 #include "intel_context_types.h"
 #include "intel_engine_types.h"
+#include "intel_gt_pm.h"
 #include "intel_ring_types.h"
 #include "intel_timeline_types.h"
 #include "i915_trace.h"
@@ -207,8 +208,11 @@ void intel_context_exit_engine(struct intel_context *ce);
 static inline void intel_context_enter(struct intel_context *ce)
 {
 	lockdep_assert_held(&ce->timeline->mutex);
-	if (!ce->active_count++)
-		ce->ops->enter(ce);
+	if (ce->active_count++)
+		return;
+
+	ce->ops->enter(ce);
+	intel_gt_pm_get(ce->vm->gt);
 }
 
 static inline void intel_context_mark_active(struct intel_context *ce)

drivers/gpu/drm/i915/gt/intel_context.h static inline void intel_context_exit(struct intel_context *ce) · line 233

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.h +5 -2
@@ -222,8 +226,11 @@ static inline void intel_context_exit(struct intel_context *ce)
 {
 	lockdep_assert_held(&ce->timeline->mutex);
 	GEM_BUG_ON(!ce->active_count);
-	if (!--ce->active_count)
-		ce->ops->exit(ce);
+	if (--ce->active_count)
+		return;
+
+	intel_gt_pm_put_async(ce->vm->gt);
+	ce->ops->exit(ce);

shouldn't these two be swapped?

Quoted 9 lines
drivers/gpu/drm/i915/gt/intel_context.h +0 -0
 }
 
 static inline struct intel_context *intel_context_get(struct intel_context *ce)
drivers/gpu/drm/i915/gt/intel_engine_pm.c +0 -0
index e971b153fda976..ee531a5c142c77 100644
@@ -114,6 +114,15 @@ __queue_and_release_pm(struct i915_request *rq,
 

drivers/gpu/drm/i915/gt/intel_engine_pm.c __queue_and_release_pm(struct i915_request *rq, · line 124

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_engine_pm.c +8 -0
 	ENGINE_TRACE(engine, "parking\n");
 
+	/*
+	 * Open coded one half of intel_context_enter, which we have to omit
+	 * here (see the large comment below) and because the other part must
+	 * not be called due constructing directly with __i915_request_create
+	 * which increments active count via intel_context_mark_active.
+	 */
+	GEM_BUG_ON(rq->context->active_count != 1);
+	__intel_gt_pm_get(engine->gt);

where is it's brother "put"?

Thanks,
Andi

Quoted 12 lines
drivers/gpu/drm/i915/gt/intel_engine_pm.c +1 -1
+
 	/*
 	 * We have to serialise all potential retirement paths with our
 	 * submission, as we don't want to underflow either the
 
---

base-commit: 3385d6482cd60f2a0bbb0fa97b70ae7dbba4f95c
change-id: 20230330-hold_wakeref_for_active_vm-7f013a449ef3

Best regards,

Signature · 1 line
Andrzej Hajda <[email protected]>
#7 lore raw
Quoted 53 lines · Andi Shyti

Hi Andrzej,

Quoted 27 lines
drivers/gpu/drm/i915/gt/intel_context.h +6 -2
index 0a8d553da3f439..48f888c3da083b 100644
@@ -14,6 +14,7 @@
  #include "i915_drv.h"
  #include "intel_context_types.h"
  #include "intel_engine_types.h"
+#include "intel_gt_pm.h"
  #include "intel_ring_types.h"
  #include "intel_timeline_types.h"
  #include "i915_trace.h"
@@ -207,8 +208,11 @@ void intel_context_exit_engine(struct intel_context *ce);
  static inline void intel_context_enter(struct intel_context *ce)
  {
  	lockdep_assert_held(&ce->timeline->mutex);
-	if (!ce->active_count++)
-		ce->ops->enter(ce);
+	if (ce->active_count++)
+		return;
+
+	ce->ops->enter(ce);
+	intel_gt_pm_get(ce->vm->gt);
  }
 
  static inline void intel_context_mark_active(struct intel_context *ce)

drivers/gpu/drm/i915/gt/intel_context.h static inline void intel_context_exit(struct intel_context *ce) · line 233

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.h +5 -2
@@ -222,8 +226,11 @@ static inline void intel_context_exit(struct intel_context *ce)
  {
  	lockdep_assert_held(&ce->timeline->mutex);
  	GEM_BUG_ON(!ce->active_count);
-	if (!--ce->active_count)
-		ce->ops->exit(ce);
+	if (--ce->active_count)
+		return;
+
+	intel_gt_pm_put_async(ce->vm->gt);
+	ce->ops->exit(ce);

shouldn't these two be swapped?

Quoted 11 lines
drivers/gpu/drm/i915/gt/intel_context.h +0 -0
  }
 
  static inline struct intel_context *intel_context_get(struct intel_context *ce)
drivers/gpu/drm/i915/gt/intel_engine_pm.c +0 -0
index e971b153fda976..ee531a5c142c77 100644
@@ -114,6 +114,15 @@ __queue_and_release_pm(struct i915_request *rq,
 
  	ENGINE_TRACE(engine, "parking\n");
 
Quoted 10 lines

drivers/gpu/drm/i915/gt/intel_engine_pm.c __queue_and_release_pm(struct i915_request *rq, · line 124

Quoted 8 lines
drivers/gpu/drm/i915/gt/intel_engine_pm.c +8 -0
+	/*
+	 * Open coded one half of intel_context_enter, which we have to omit
+	 * here (see the large comment below) and because the other part must
+	 * not be called due constructing directly with __i915_request_create
+	 * which increments active count via intel_context_mark_active.
+	 */
+	GEM_BUG_ON(rq->context->active_count != 1);
+	__intel_gt_pm_get(engine->gt);

where is it's brother "put"?

It's in request retire via intel_context_exit. Ie. request construction is special here, while retirement is standard.

Regards,

Tvrtko

Quoted 16 lines

Thanks,
Andi

Quoted 12 lines
drivers/gpu/drm/i915/gt/intel_engine_pm.c +1 -1
+
  	/*
  	 * We have to serialise all potential retirement paths with our
  	 * submission, as we don't want to underflow either the
 
---

base-commit: 3385d6482cd60f2a0bbb0fa97b70ae7dbba4f95c
change-id: 20230330-hold_wakeref_for_active_vm-7f013a449ef3

Best regards,

Signature · 1 line
Andrzej Hajda <[email protected]>
#8 lore raw

Hi Tvrtko,

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/i915/gt/intel_context.h +6 -3
index 0a8d553da3f439..48f888c3da083b 100644
@@ -14,6 +14,7 @@
  #include "i915_drv.h"
  #include "intel_context_types.h"
  #include "intel_engine_types.h"
+#include "intel_gt_pm.h"
  #include "intel_ring_types.h"
  #include "intel_timeline_types.h"
  #include "i915_trace.h"
@@ -207,8 +208,11 @@ void intel_context_exit_engine(struct intel_context *ce);
  static inline void intel_context_enter(struct intel_context *ce)
  {
  	lockdep_assert_held(&ce->timeline->mutex);
-	if (!ce->active_count++)
-		ce->ops->enter(ce);
+	if (ce->active_count++)
+		return;
+
+	ce->ops->enter(ce);
+	intel_gt_pm_get(ce->vm->gt);
  }
  static inline void intel_context_mark_active(struct intel_context *ce)
@@ -222,8 +226,11 @@ static inline void intel_context_exit(struct intel_context *ce)
  {
  	lockdep_assert_held(&ce->timeline->mutex);
  	GEM_BUG_ON(!ce->active_count);
-	if (!--ce->active_count)
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_context.h static inline void intel_context_exit(struct intel_context *ce) · line 233

Quoted 6 lines
drivers/gpu/drm/i915/gt/intel_context.h +5 -1
-		ce->ops->exit(ce);
+	if (--ce->active_count)
+		return;
+
+	intel_gt_pm_put_async(ce->vm->gt);
+	ce->ops->exit(ce);

shouldn't these two be swapped?

maybe I wasn't clear here... shouldn't it be

	ce->ops->exit(ce);
	intel_gt_pm_put_async(ce->vm->gt);

Don't we need to hold the pm until exiting?

Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.h +0 -0
  }
  static inline struct intel_context *intel_context_get(struct intel_context *ce)
drivers/gpu/drm/i915/gt/intel_engine_pm.c +2 -0
index e971b153fda976..ee531a5c142c77 100644
@@ -114,6 +114,15 @@ __queue_and_release_pm(struct i915_request *rq,
  	ENGINE_TRACE(engine, "parking\n");
+	/*
+	 * Open coded one half of intel_context_enter, which we have to omit
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_engine_pm.c __queue_and_release_pm(struct i915_request *rq, · line 124

Quoted 6 lines
drivers/gpu/drm/i915/gt/intel_engine_pm.c +6 -0
+	 * here (see the large comment below) and because the other part must
+	 * not be called due constructing directly with __i915_request_create
+	 * which increments active count via intel_context_mark_active.
+	 */
+	GEM_BUG_ON(rq->context->active_count != 1);
+	__intel_gt_pm_get(engine->gt);

where is it's brother "put"?

Quoted 2 lines

It's in request retire via intel_context_exit. Ie. request construction is special here, while retirement is standard.

Thank you!
Andi

#9 lore raw
Quoted 41 lines · Andi Shyti

Hi Tvrtko,

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/i915/gt/intel_context.h +6 -3
index 0a8d553da3f439..48f888c3da083b 100644
@@ -14,6 +14,7 @@
   #include "i915_drv.h"
   #include "intel_context_types.h"
   #include "intel_engine_types.h"
+#include "intel_gt_pm.h"
   #include "intel_ring_types.h"
   #include "intel_timeline_types.h"
   #include "i915_trace.h"
@@ -207,8 +208,11 @@ void intel_context_exit_engine(struct intel_context *ce);
   static inline void intel_context_enter(struct intel_context *ce)
   {
   	lockdep_assert_held(&ce->timeline->mutex);
-	if (!ce->active_count++)
-		ce->ops->enter(ce);
+	if (ce->active_count++)
+		return;
+
+	ce->ops->enter(ce);
+	intel_gt_pm_get(ce->vm->gt);
   }
   static inline void intel_context_mark_active(struct intel_context *ce)
@@ -222,8 +226,11 @@ static inline void intel_context_exit(struct intel_context *ce)
   {
   	lockdep_assert_held(&ce->timeline->mutex);
   	GEM_BUG_ON(!ce->active_count);
-	if (!--ce->active_count)
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_context.h static inline void intel_context_exit(struct intel_context *ce) · line 233

Quoted 6 lines
drivers/gpu/drm/i915/gt/intel_context.h +5 -1
-		ce->ops->exit(ce);
+	if (--ce->active_count)
+		return;
+
+	intel_gt_pm_put_async(ce->vm->gt);
+	ce->ops->exit(ce);

shouldn't these two be swapped?

Quoted 1 line

maybe I wasn't clear here... shouldn't it be

I missed this one.

Quoted 4 lines
	ce->ops->exit(ce);
	intel_gt_pm_put_async(ce->vm->gt);

Don't we need to hold the pm until exiting?

I think it doesn't matter. The problematic edge case this is fixing is when ce->engine->gt is different from ce->vm->gt but at this point if it is safe to release one it must be safe to release the other too.

Regards,

Tvrtko

Quoted 25 lines
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/gt/intel_context.h +0 -0
   }
   static inline struct intel_context *intel_context_get(struct intel_context *ce)
drivers/gpu/drm/i915/gt/intel_engine_pm.c +2 -0
index e971b153fda976..ee531a5c142c77 100644
@@ -114,6 +114,15 @@ __queue_and_release_pm(struct i915_request *rq,
   	ENGINE_TRACE(engine, "parking\n");
+	/*
+	 * Open coded one half of intel_context_enter, which we have to omit
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_engine_pm.c __queue_and_release_pm(struct i915_request *rq, · line 124

Quoted 6 lines
drivers/gpu/drm/i915/gt/intel_engine_pm.c +6 -0
+	 * here (see the large comment below) and because the other part must
+	 * not be called due constructing directly with __i915_request_create
+	 * which increments active count via intel_context_mark_active.
+	 */
+	GEM_BUG_ON(rq->context->active_count != 1);
+	__intel_gt_pm_get(engine->gt);

where is it's brother "put"?

Quoted 2 lines

It's in request retire via intel_context_exit. Ie. request construction is special here, while retirement is standard.

Thank you!
Andi

Reviewed-by on v2 1/1
#10 lore raw
In reply to Andrzej Hajda

Hi,

Quoted 11 lines · Andrzej Hajda

From: Chris Wilson <[email protected]>

There may be a disconnect between the GT used by the engine and the GT used for the VM, requiring us to hold a wakeref on both while the GPU is active with this request.

v2: added explanation to __queue_and_release_pm

[ahajda: removed not-yet-upstremed wakeref tracking bits]

Thank you Tvrtko and Chris for answering my questions,

Andi

#11 lore raw
In reply to Andrzej Hajda
Quoted 11 lines · Andrzej Hajda

From: Chris Wilson <[email protected]>

There may be a disconnect between the GT used by the engine and the GT used for the VM, requiring us to hold a wakeref on both while the GPU is active with this request.

v2: added explanation to __queue_and_release_pm

[ahajda: removed not-yet-upstremed wakeref tracking bits]

Queued.

Regards
Andrzej