Skip to contentSkip to conversation

i915/pmu: Wire GuC backend to per-client busyness

PATCH In review Umesh Nerlige Ramappa 4 participants 13 messages Aug 4, 2022 – Aug 31, 2022 1 message not in the archive

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

PATCH 1/1 i915/pmu: Wire GuC backend to per-client busyness

From: John Harrison <[email protected]>

GuC provides engine_id and last_switch_in ticks for an active context in the pphwsp. The context image provides a 32 bit total ticks which is the accumulated by the context (a.k.a. context[CTX_TIMESTAMP]). This information is used to calculate the context busyness as follows:

If the engine_id is valid, then busyness is the sum of accumulated total ticks and active ticks. Active ticks is calculated with current gt time as reference.

If engine_id is invalid, busyness is equal to accumulated total ticks.

Since KMD (CPU) retrieves busyness data from 2 sources - GPU and GuC, a potential race was highlighted in an earlier review that can lead to double accounting of busyness. While the solution to this is a wip, busyness is still usable for platforms running GuC submission.

Remaining work: Enable and test context busyness for virtual_parent_context_ops and virtual_child_context_ops.

v2: (Tvrtko)
- Use COPS_RUNTIME_ACTIVE_TOTAL
- Add code comment for the race
- Undo local variables initializations

v3:
- Add support for virtual engines based on
https://patchwork.freedesktop.org/series/105227/

v4:
- Update commit message with remaining work.
- Rebase

---
 drivers/gpu/drm/i915/gt/intel_context.c       | 12 +++-
 drivers/gpu/drm/i915/gt/intel_context.h       |  6 +-
 drivers/gpu/drm/i915/gt/intel_context_types.h |  6 ++
 drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h   |  5 ++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 65 ++++++++++++++++++-
 drivers/gpu/drm/i915/i915_drm_client.c        |  6 +-
 6 files changed, 89 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +10 -2
index 654a092ed3d6..e2d70a9fdac0 100644
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent,
 	child->parallel.parent = parent;
 }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce)
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce)
 {
 	u64 total, active;
 
+	if (ce->ops->update_stats)
+		ce->ops->update_stats(ce);
+
 	total = ce->stats.runtime.total;
 	if (ce->ops->flags & COPS_RUNTIME_CYCLES)
 		total *= ce->engine->gt->clock_period_ns;
 
 	active = READ_ONCE(ce->stats.active);
-	if (active)
+	/*
+	 * When COPS_RUNTIME_ACTIVE_TOTAL is set for ce->cops, the backend
+	 * already provides the total active time of the context, so skip this
+	 * calculation when this flag is set.
+	 */
+	if (active && !(ce->ops->flags & COPS_RUNTIME_ACTIVE_TOTAL))
 		active = intel_context_clock() - active;
 
 	return total + active;
drivers/gpu/drm/i915/gt/intel_context.h +3 -3
index 8e2d70630c49..3d1d7436c1a4 100644
@@ -58,7 +58,7 @@ static inline bool intel_context_is_parent(struct intel_context *ce)
 	return !!ce->parallel.number_children;
 }
 
-static inline bool intel_context_is_pinned(struct intel_context *ce);
+static inline bool intel_context_is_pinned(const struct intel_context *ce);
 
 static inline struct intel_context *
 intel_context_to_parent(struct intel_context *ce)
@@ -118,7 +118,7 @@ static inline int intel_context_lock_pinned(struct intel_context *ce)
  * Returns: true if the context is currently pinned for use by the GPU.
  */
 static inline bool
-intel_context_is_pinned(struct intel_context *ce)
+intel_context_is_pinned(const struct intel_context *ce)
 {
 	return atomic_read(&ce->pin_count);
 }
@@ -362,7 +362,7 @@ intel_context_clear_nopreempt(struct intel_context *ce)
 	clear_bit(CONTEXT_NOPREEMPT, &ce->flags);
 }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce);
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce);
 u64 intel_context_get_avg_runtime_ns(struct intel_context *ce);
 
 static inline u64 intel_context_clock(void)
drivers/gpu/drm/i915/gt/intel_context_types.h +6 -0
index 04eacae1aca5..f7ff4c7d81c7 100644
@@ -38,6 +38,9 @@ struct intel_context_ops {
 #define COPS_RUNTIME_CYCLES_BIT 1
 #define COPS_RUNTIME_CYCLES BIT(COPS_RUNTIME_CYCLES_BIT)
 
+#define COPS_RUNTIME_ACTIVE_TOTAL_BIT 2
+#define COPS_RUNTIME_ACTIVE_TOTAL BIT(COPS_RUNTIME_ACTIVE_TOTAL_BIT)
+
 	int (*alloc)(struct intel_context *ce);
 
 	void (*revoke)(struct intel_context *ce, struct i915_request *rq,
@@ -56,6 +59,8 @@ struct intel_context_ops {
 
 	void (*sched_disable)(struct intel_context *ce);
 
+	void (*update_stats)(struct intel_context *ce);
+
 	void (*reset)(struct intel_context *ce);
 	void (*destroy)(struct kref *kref);
 
@@ -148,6 +153,7 @@ struct intel_context {
 			struct ewma_runtime avg;
 			u64 total;
 			u32 last;
+			u64 start_gt_clk;
 			I915_SELFTEST_DECLARE(u32 num_underflow);
 			I915_SELFTEST_DECLARE(u32 max_underflow);
 		} runtime;
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +5 -0
index 323b055e5db9..c7b54f1631b9 100644
@@ -196,6 +196,11 @@ static inline u8 guc_class_to_engine_class(u8 guc_class)
 	return guc_class_engine_class_map[guc_class];
 }
 
+/* Per context engine usage stats: */
+#define PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO	(0x500 / sizeof(u32))
+#define PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI	(PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO + 1)
+#define PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID	(PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI + 1)
+
 /* Work item for submitting workloads into work queue of GuC. */
 struct guc_wq_item {
 	u32 header;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +64 -1

126 lines not on this page · raw message

drivers/gpu/drm/i915/i915_drm_client.c +1 -5
index b09d1d386574..8d81119fff14 100644
@@ -147,11 +147,7 @@ void i915_drm_client_fdinfo(struct seq_file *m, struct file *f)
 		   PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
 	seq_printf(m, "drm-client-id:\t%u\n", client->id);
 
-	/*
-	 * Temporarily skip showing client engine information with GuC submission till
-	 * fetching engine busyness is implemented in the GuC submission backend
-	 */
-	if (GRAPHICS_VER(i915) < 8 || intel_uc_uses_guc_submission(&i915->gt0.uc))
+	if (GRAPHICS_VER(i915) < 8)
 		return;
 
 	for (i = 0; i < ARRAY_SIZE(uabi_class_names); i++)
Signature · 1 line
2.37.1
#1 lore raw

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for i915/pmu: Wire GuC backend to per-client busyness (rev4)

== Series Details ==

== Series Details ==

Series: i915/pmu: Wire GuC backend to per-client busyness (rev4)
URL : https://patchwork.freedesktop.org/series/105085/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.

#2 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for i915/pmu: Wire GuC backend to per-client busyness (rev4)

In reply to Umesh Nerlige Ramappa
== Series Details ==

== Series Details ==

Series: i915/pmu: Wire GuC backend to per-client busyness (rev4)
URL : https://patchwork.freedesktop.org/series/105085/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_11970 -> Patchwork_105085v4
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (43 -> 30)
------------------------------

Missing (13): fi-bdw-samus bat-dg1-6 bat-dg1-5 bat-dg2-8 fi-skl-guc bat-adlm-1 bat-dg2-9 bat-adlp-6 bat-adlp-4 bat-rplp-1 bat-rpls-1 bat-rpls-2 bat-jsl-1

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

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

### IGT changes ###

#### Issues hit ####

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-bdw-5557u: NOTRUN -> [SKIP][1] ([fdo#109271] / [fdo#111827])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/fi-bdw-5557u/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@gt_heartbeat:
- fi-skl-6700k2: [DMESG-FAIL][2] ([i915#5334]) -> [PASS][3]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/fi-skl-6700k2/igt@i915_selftest@live@gt_heartbeat.html
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/fi-skl-6700k2/igt@i915_selftest@live@gt_heartbeat.html

* igt@i915_selftest@live@hangcheck:
- {fi-ehl-2}: [INCOMPLETE][4] ([i915#5153] / [i915#6106]) -> [PASS][5]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/fi-ehl-2/igt@i915_selftest@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/fi-ehl-2/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- fi-bdw-5557u: [INCOMPLETE][6] ([i915#146]) -> [PASS][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/fi-bdw-5557u/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/fi-bdw-5557u/igt@[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#146]: https://gitlab.freedesktop.org/drm/intel/issues/146
[i915#5153]: https://gitlab.freedesktop.org/drm/intel/issues/5153
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#6106]: https://gitlab.freedesktop.org/drm/intel/issues/6106

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

* Linux: CI_DRM_11970 -> Patchwork_105085v4

CI-20190529: 20190529
CI_DRM_11970: 1d7aa8092dbbaef7c6a81903e0432f5b90da4d63 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6613: 209230467200f2fa63a6f71fe6299996470dd813 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_105085v4: 1d7aa8092dbbaef7c6a81903e0432f5b90da4d63 @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

102ffd49f5bd i915/pmu: Wire GuC backend to per-client busyness

== Logs ==

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

#3 lore raw

[Intel-gfx] ✗ Fi.CI.IGT: failure for i915/pmu: Wire GuC backend to per-client busyness (rev4)

In reply to Umesh Nerlige Ramappa
== Series Details ==

== Series Details ==

Series: i915/pmu: Wire GuC backend to per-client busyness (rev4)
URL : https://patchwork.freedesktop.org/series/105085/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11970_full -> Patchwork_105085v4_full
====================================================

Summary
-------

**FAILURE**

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

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

Participating hosts (12 -> 12)
------------------------------

No changes in participating hosts

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

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

### IGT changes ###

#### Possible regressions ####

* igt@kms_cursor_legacy@flip-vs-cursor@atomic-transitions:
- shard-skl: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl10/igt@kms_cursor_legacy@[email protected]

#### Suppressed ####

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

* igt@gem_ppgtt@blt-vs-render-ctxn:
- {shard-rkl}: NOTRUN -> [FAIL][2]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-5/igt@[email protected]

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

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

### CI changes ###

#### Possible fixes ####

* boot:
- shard-skl: ([PASS][3], [PASS][4], [PASS][5], [PASS][6], [PASS][7], [PASS][8], [PASS][9], [PASS][10], [PASS][11], [PASS][12], [PASS][13], [PASS][14], [PASS][15], [PASS][16], [PASS][17], [PASS][18], [FAIL][19], [FAIL][20], [FAIL][21], [FAIL][22], [FAIL][23], [FAIL][24]) ([i915#5032]) -> ([PASS][25], [PASS][26], [PASS][27], [PASS][28], [PASS][29], [PASS][30], [PASS][31], [PASS][32], [PASS][33], [PASS][34], [PASS][35], [PASS][36], [PASS][37], [PASS][38], [PASS][39], [PASS][40], [PASS][41], [PASS][42], [PASS][43], [PASS][44], [PASS][45], [PASS][46], [PASS][47], [PASS][48])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl9/boot.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl9/boot.html
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl9/boot.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl7/boot.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl7/boot.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl7/boot.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl6/boot.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl6/boot.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl6/boot.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl4/boot.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl4/boot.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl3/boot.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl2/boot.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl1/boot.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl1/boot.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl1/boot.html
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl10/boot.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl10/boot.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl10/boot.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl10/boot.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl10/boot.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl10/boot.html
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl9/boot.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl9/boot.html
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl9/boot.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl9/boot.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/boot.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/boot.html
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/boot.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/boot.html
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl6/boot.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl6/boot.html
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl6/boot.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl4/boot.html
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl4/boot.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl4/boot.html
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl3/boot.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl2/boot.html
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl2/boot.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl2/boot.html
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl1/boot.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl1/boot.html
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl1/boot.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl10/boot.html
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl10/boot.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl10/boot.html

### IGT changes ###

#### Issues hit ####

* igt@gem_create@create-massive:
- shard-skl: NOTRUN -> [DMESG-WARN][49] ([i915#4991])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/igt@[email protected]

* igt@gem_ctx_exec@basic-nohangcheck:
- shard-tglb: [PASS][50] -> [FAIL][51] ([i915#6268])
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-tglb5/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-tglb1/igt@[email protected]

* igt@gem_ctx_persistence@hang:
- shard-skl: NOTRUN -> [SKIP][52] ([fdo#109271]) +403 similar issues
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl2/igt@[email protected]

* igt@gem_exec_balancer@parallel-bb-first:
- shard-iclb: [PASS][53] -> [SKIP][54] ([i915#4525]) +1 similar issue
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb4/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb8/igt@[email protected]

* igt@gem_exec_capture@pi@rcs0:
- shard-skl: NOTRUN -> [INCOMPLETE][55] ([i915#3371])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl1/igt@gem_exec_capture@[email protected]

* igt@gem_exec_fair@basic-deadline:
- shard-kbl: [PASS][56] -> [FAIL][57] ([i915#2846])
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@[email protected]

* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-tglb: [PASS][58] -> [FAIL][59] ([i915#2842])
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-tglb3/igt@gem_exec_fair@[email protected]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-tglb2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none-solo@rcs0:
- shard-apl: [PASS][60] -> [FAIL][61] ([i915#2842])
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-apl6/igt@gem_exec_fair@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-apl4/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vcs1:
- shard-kbl: [PASS][62] -> [FAIL][63] ([i915#2842]) +2 similar issues
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl7/igt@gem_exec_fair@[email protected]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl7/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@rcs0:
- shard-kbl: [PASS][64] -> [SKIP][65] ([fdo#109271])
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@gem_exec_fair@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs1:
- shard-iclb: NOTRUN -> [FAIL][66] ([i915#2842])
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb1/igt@gem_exec_fair@[email protected]

* igt@gem_huc_copy@huc-copy:
- shard-skl: NOTRUN -> [SKIP][67] ([fdo#109271] / [i915#2190])
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl6/igt@[email protected]

* igt@gem_lmem_swapping@heavy-verify-multi:
- shard-skl: NOTRUN -> [SKIP][68] ([fdo#109271] / [i915#4613]) +5 similar issues
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl4/igt@[email protected]

* igt@gem_lmem_swapping@parallel-multi:
- shard-apl: NOTRUN -> [SKIP][69] ([fdo#109271] / [i915#4613]) +1 similar issue
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-apl7/igt@[email protected]

* igt@gem_lmem_swapping@smem-oom:
- shard-kbl: NOTRUN -> [SKIP][70] ([fdo#109271] / [i915#4613])
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@[email protected]

* igt@gem_userptr_blits@dmabuf-sync:
- shard-skl: NOTRUN -> [SKIP][71] ([fdo#109271] / [i915#3323])
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/igt@[email protected]

* igt@gem_workarounds@suspend-resume-fd:
- shard-skl: [PASS][72] -> [INCOMPLETE][73] ([i915#5129])
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl9/igt@[email protected]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl9/igt@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-skl: NOTRUN -> [FAIL][74] ([i915#454])
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl2/igt@[email protected]

* igt@kms_big_fb@yf-tiled-max-hw-stride-32bpp-rotate-0-async-flip:
- shard-skl: NOTRUN -> [FAIL][75] ([i915#3743]) +1 similar issue
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl4/igt@[email protected]

* igt@kms_big_fb@yf-tiled-max-hw-stride-32bpp-rotate-0-hflip:
- shard-kbl: NOTRUN -> [SKIP][76] ([fdo#109271]) +60 similar issues
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@[email protected]

* igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs:
- shard-skl: NOTRUN -> [SKIP][77] ([fdo#109271] / [i915#3886]) +20 similar issues
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl6/igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc:
- shard-kbl: NOTRUN -> [SKIP][78] ([fdo#109271] / [i915#3886]) +3 similar issues
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_ccs@pipe-b-bad-pixel-format-y_tiled_gen12_rc_ccs_cc:
- shard-apl: NOTRUN -> [SKIP][79] ([fdo#109271] / [i915#3886]) +4 similar issues
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-apl7/igt@kms_ccs@pipe-b-bad-pixel-format-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_color_chamelium@pipe-b-ctm-0-25:
- shard-skl: NOTRUN -> [SKIP][80] ([fdo#109271] / [fdo#111827]) +26 similar issues
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl2/igt@[email protected]

* igt@kms_color_chamelium@pipe-c-ctm-0-75:
- shard-kbl: NOTRUN -> [SKIP][81] ([fdo#109271] / [fdo#111827]) +3 similar issues
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@[email protected]

* igt@kms_color_chamelium@pipe-d-ctm-0-5:
- shard-apl: NOTRUN -> [SKIP][82] ([fdo#109271] / [fdo#111827]) +2 similar issues
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-apl8/igt@[email protected]

* igt@kms_cursor_crc@cursor-suspend@pipe-b-edp-1:
- shard-skl: [PASS][83] -> [INCOMPLETE][84] ([i915#4939])
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl6/igt@kms_cursor_crc@[email protected]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl6/igt@kms_cursor_crc@[email protected]

* igt@kms_fbcon_fbt@psr-suspend:
- shard-skl: NOTRUN -> [FAIL][85] ([i915#4767])
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl6/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@c-edp1:
- shard-skl: NOTRUN -> [FAIL][86] ([i915#79]) +1 similar issue
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible@b-dp1:
- shard-apl: [PASS][87] -> [DMESG-WARN][88] ([i915#180]) +2 similar issues
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-apl3/igt@kms_flip@[email protected]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-apl6/igt@kms_flip@[email protected]
- shard-kbl: NOTRUN -> [DMESG-WARN][89] ([i915#180])
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-suspend@a-dp1:
- shard-kbl: [PASS][90] -> [DMESG-WARN][91] ([i915#180]) +4 similar issues
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl1/igt@kms_flip@[email protected]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-wf_vblank-interruptible@a-edp1:
- shard-skl: [PASS][92] -> [FAIL][93] ([i915#2122])
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl6/igt@kms_flip@[email protected]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl2/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-ts-check@b-edp1:
- shard-skl: NOTRUN -> [FAIL][94] ([i915#2122])
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/igt@kms_flip@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs-upscaling@pipe-a-default-mode:
- shard-iclb: NOTRUN -> [SKIP][95] ([i915#2672]) +7 similar issues
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb3/igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs-upscaling@pipe-a-default-mode.html

* igt@kms_flip_scaled_crc@flip-64bpp-linear-to-32bpp-linear-downscaling@pipe-a-default-mode:
- shard-iclb: NOTRUN -> [SKIP][96] ([i915#3555]) +1 similar issue
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb2/igt@kms_flip_scaled_crc@flip-64bpp-linear-to-32bpp-linear-downscaling@pipe-a-default-mode.html

* igt@kms_frontbuffer_tracking@psr-2p-scndscrn-pri-indfb-draw-render:
- shard-skl: NOTRUN -> [SKIP][97] ([fdo#109271] / [i915#1888]) +2 similar issues
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/igt@kms_frontbuffer_tracking@psr-2p-scndscrn-pri-indfb-draw-render.html

* igt@kms_frontbuffer_tracking@psr-2p-scndscrn-spr-indfb-draw-render:
- shard-apl: NOTRUN -> [SKIP][98] ([fdo#109271]) +70 similar issues
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-apl8/igt@kms_frontbuffer_tracking@psr-2p-scndscrn-spr-indfb-draw-render.html

* igt@kms_hdr@bpc-switch@pipe-a-dp-1:
- shard-kbl: NOTRUN -> [FAIL][99] ([i915#1188])
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@kms_hdr@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-alpha-transparent-fb:
- shard-kbl: NOTRUN -> [FAIL][100] ([i915#265])
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@[email protected]
- shard-skl: NOTRUN -> [SKIP][101] ([fdo#109271] / [i915#3546])
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl1/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
- shard-kbl: NOTRUN -> [FAIL][102] ([fdo#108145] / [i915#265])
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: NOTRUN -> [FAIL][103] ([fdo#108145] / [i915#265]) +2 similar issues
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/igt@[email protected]

* igt@kms_psr2_sf@cursor-plane-move-continuous-sf:
- shard-kbl: NOTRUN -> [SKIP][104] ([fdo#109271] / [i915#658]) +1 similar issue
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]

* igt@kms_psr2_sf@overlay-plane-move-continuous-exceed-fully-sf:
- shard-skl: NOTRUN -> [SKIP][105] ([fdo#109271] / [i915#658]) +5 similar issues
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl9/igt@[email protected]

* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area:
- shard-apl: NOTRUN -> [SKIP][106] ([fdo#109271] / [i915#658]) +1 similar issue
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-apl7/igt@[email protected]

* igt@kms_psr@psr2_cursor_blt:
- shard-iclb: [PASS][107] -> [SKIP][108] ([fdo#109441]) +1 similar issue
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb2/igt@kms_psr@psr2_cursor_blt.html
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb7/igt@kms_psr@psr2_cursor_blt.html

* igt@kms_psr_stress_test@flip-primary-invalidate-overlay:
- shard-iclb: [PASS][109] -> [SKIP][110] ([i915#5519]) +1 similar issue
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb2/igt@[email protected]
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb7/igt@[email protected]

* igt@kms_psr_stress_test@invalidate-primary-flip-overlay:
- shard-tglb: [PASS][111] -> [SKIP][112] ([i915#5519])
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-tglb2/igt@[email protected]
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-tglb3/igt@[email protected]

* igt@kms_sysfs_edid_timing:
- shard-skl: NOTRUN -> [FAIL][113] ([i915#6493])
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/igt@kms_sysfs_edid_timing.html

* igt@kms_vblank@pipe-d-wait-idle:
- shard-skl: NOTRUN -> [SKIP][114] ([fdo#109271] / [i915#533])
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl7/igt@[email protected]

* igt@perf@polling-parameterized:
- shard-skl: [PASS][115] -> [FAIL][116] ([i915#5639])
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl3/igt@[email protected]
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl4/igt@[email protected]

* igt@perf@short-reads:
- shard-skl: NOTRUN -> [FAIL][117] ([i915#51])
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl1/igt@[email protected]

* igt@sysfs_clients@busy:
- shard-skl: NOTRUN -> [SKIP][118] ([fdo#109271] / [i915#2994]) +6 similar issues
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl6/igt@[email protected]

* igt@sysfs_clients@fair-3:
- shard-kbl: NOTRUN -> [SKIP][119] ([fdo#109271] / [i915#2994])
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@[email protected]

* igt@sysfs_clients@split-10:
- shard-apl: NOTRUN -> [SKIP][120] ([fdo#109271] / [i915#2994])
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-apl7/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_persistence@hang:
- {shard-rkl}: [SKIP][121] ([i915#6252]) -> [PASS][122]
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-5/igt@[email protected]
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-1/igt@[email protected]

* igt@gem_exec_balancer@parallel-keep-submit-fence:
- shard-iclb: [SKIP][123] ([i915#4525]) -> [PASS][124] +1 similar issue
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb3/igt@[email protected]
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb1/igt@[email protected]

* igt@gem_exec_fair@basic-none@vcs0:
- shard-glk: [FAIL][125] ([i915#2842]) -> [PASS][126]
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-glk3/igt@gem_exec_fair@[email protected]
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-glk1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace-share@rcs0:
- {shard-rkl}: [FAIL][127] ([i915#2842]) -> [PASS][128] +1 similar issue
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-5/igt@gem_exec_fair@[email protected]
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_reloc@basic-gtt-cpu:
- {shard-rkl}: [SKIP][129] ([i915#3281]) -> [PASS][130] +16 similar issues
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@[email protected]
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-5/igt@[email protected]

* igt@gem_partial_pwrite_pread@writes-after-reads-snoop:
- {shard-rkl}: [SKIP][131] ([i915#3282]) -> [PASS][132] +7 similar issues
[131]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@[email protected]
[132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-5/igt@[email protected]

* igt@gem_workarounds@suspend-resume-context:
- shard-kbl: [DMESG-WARN][133] ([i915#180]) -> [PASS][134] +2 similar issues
[133]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@[email protected]
[134]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@[email protected]

* igt@gen9_exec_parse@shadow-peek:
- {shard-rkl}: [SKIP][135] ([i915#2527]) -> [PASS][136] +1 similar issue
[135]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@[email protected]
[136]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-5/igt@[email protected]

* igt@i915_pm_dc@dc9-dpms:
- shard-iclb: [SKIP][137] ([i915#4281]) -> [PASS][138]
[137]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb3/igt@[email protected]
[138]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb1/igt@[email protected]

* igt@i915_pm_rps@waitboost:
- {shard-rkl}: [FAIL][139] ([i915#4016]) -> [PASS][140]
[139]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@[email protected]
[140]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-5/igt@[email protected]

* igt@i915_selftest@live@gt_pm:
- {shard-rkl}: [DMESG-FAIL][141] ([i915#4258]) -> [PASS][142]
[141]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-6/igt@i915_selftest@live@gt_pm.html
[142]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-1/igt@i915_selftest@live@gt_pm.html

* igt@i915_suspend@sysfs-reader:
- shard-apl: [DMESG-WARN][143] ([i915#180]) -> [PASS][144] +2 similar issues
[143]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-apl3/igt@[email protected]
[144]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-apl7/igt@[email protected]

* igt@kms_atomic@plane-cursor-legacy:
- {shard-rkl}: [SKIP][145] ([i915#1845] / [i915#4098]) -> [PASS][146] +4 similar issues
[145]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@[email protected]
[146]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-6/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor@atomic:
- shard-skl: [INCOMPLETE][147] -> [PASS][148]
[147]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl1/igt@kms_cursor_legacy@[email protected]
[148]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl10/igt@kms_cursor_legacy@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor@atomic-transitions:
- shard-glk: [FAIL][149] ([i915#2346]) -> [PASS][150]
[149]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-glk3/igt@kms_cursor_legacy@[email protected]
[150]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-glk1/igt@kms_cursor_legacy@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor@toggle:
- shard-skl: [SKIP][151] ([fdo#109271]) -> [PASS][152]
[151]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl1/igt@kms_cursor_legacy@[email protected]
[152]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl10/igt@kms_cursor_legacy@[email protected]

* igt@kms_draw_crc@draw-method-xrgb2101010-pwrite-xtiled:
- {shard-rkl}: [SKIP][153] ([fdo#111314] / [i915#4098] / [i915#4369]) -> [PASS][154] +2 similar issues
[153]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@[email protected]
[154]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-6/igt@[email protected]

* igt@kms_flip@flip-vs-absolute-wf_vblank-interruptible@c-edp1:
- shard-skl: [FAIL][155] ([i915#2122]) -> [PASS][156]
[155]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-skl1/igt@kms_flip@[email protected]
[156]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-skl10/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@a-hdmi-a1:
- shard-glk: [FAIL][157] ([i915#79]) -> [PASS][158] +1 similar issue
[157]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-glk8/igt@kms_flip@[email protected]
[158]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-glk5/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@psr-rgb101010-draw-mmap-gtt:
- {shard-rkl}: [SKIP][159] ([i915#1849] / [i915#4098]) -> [PASS][160] +6 similar issues
[159]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@[email protected]
[160]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-6/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-alpha-7efc:
- {shard-rkl}: [SKIP][161] ([i915#1849] / [i915#3546] / [i915#4070] / [i915#4098]) -> [PASS][162]
[161]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@[email protected]
[162]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-6/igt@[email protected]

* igt@kms_plane_scaling@plane-downscale-with-pixel-format-factor-0-5@pipe-a-edp-1:
- shard-iclb: [SKIP][163] ([i915#5176]) -> [PASS][164] +2 similar issues
[163]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb2/igt@kms_plane_scaling@[email protected]
[164]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb7/igt@kms_plane_scaling@[email protected]

* igt@kms_plane_scaling@planes-upscale-factor-0-25-downscale-factor-0-5@pipe-b-edp-1:
- shard-iclb: [SKIP][165] ([i915#5235]) -> [PASS][166] +2 similar issues
[165]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb2/igt@kms_plane_scaling@planes-upscale-factor-0-25-downscale-factor-0-5@pipe-b-edp-1.html
[166]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb7/igt@kms_plane_scaling@planes-upscale-factor-0-25-downscale-factor-0-5@pipe-b-edp-1.html

* igt@kms_psr@primary_page_flip:
- {shard-rkl}: [SKIP][167] ([i915#1072]) -> [PASS][168]
[167]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@kms_psr@primary_page_flip.html
[168]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-6/igt@kms_psr@primary_page_flip.html

* igt@kms_psr@psr2_primary_mmap_gtt:
- shard-iclb: [SKIP][169] ([fdo#109441]) -> [PASS][170]
[169]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb8/igt@kms_psr@psr2_primary_mmap_gtt.html
[170]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb2/igt@kms_psr@psr2_primary_mmap_gtt.html

* igt@kms_universal_plane@universal-plane-pipe-b-sanity:
- {shard-rkl}: [SKIP][171] ([i915#1845] / [i915#4070] / [i915#4098]) -> [PASS][172]
[171]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-1/igt@[email protected]
[172]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-6/igt@[email protected]

* igt@perf@gen12-oa-tlb-invalidate:
- {shard-rkl}: [SKIP][173] ([fdo#109289]) -> [PASS][174]
[173]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-5/igt@[email protected]
[174]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-2/igt@[email protected]

* igt@perf@polling-parameterized:
- shard-glk: [FAIL][175] ([i915#5639]) -> [PASS][176]
[175]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-glk1/igt@[email protected]
[176]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-glk2/igt@[email protected]

* igt@prime_vgem@basic-fence-read:
- {shard-rkl}: [SKIP][177] ([fdo#109295] / [i915#3291] / [i915#3708]) -> [PASS][178]
[177]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-rkl-2/igt@[email protected]
[178]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-rkl-5/igt@[email protected]

#### Warnings ####

* igt@gem_exec_balancer@parallel-ordering:
- shard-iclb: [FAIL][179] ([i915#6117]) -> [SKIP][180] ([i915#4525])
[179]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb1/igt@[email protected]
[180]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb6/igt@[email protected]

* igt@gem_exec_fair@basic-pace@vcs1:
- shard-kbl: [SKIP][181] ([fdo#109271]) -> [FAIL][182] ([i915#2842])
[181]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@gem_exec_fair@[email protected]
[182]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl1/igt@gem_exec_fair@[email protected]

* igt@i915_pm_dc@dc3co-vpb-simulation:
- shard-iclb: [SKIP][183] ([i915#588]) -> [SKIP][184] ([i915#658])
[183]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb2/igt@[email protected]
[184]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb7/igt@[email protected]

* igt@kms_fbcon_fbt@fbc-suspend:
- shard-kbl: [FAIL][185] ([i915#4767]) -> [INCOMPLETE][186] ([i915#180] / [i915#4939])
[185]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl7/igt@[email protected]
[186]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]

* igt@kms_hdr@bpc-switch-suspend@pipe-a-dp-1:
- shard-kbl: [DMESG-FAIL][187] ([i915#180]) -> [DMESG-WARN][188] ([i915#180])
[187]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@kms_hdr@[email protected]
[188]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@kms_hdr@[email protected]

* igt@kms_psr2_sf@cursor-plane-move-continuous-sf:
- shard-iclb: [SKIP][189] ([i915#2920]) -> [SKIP][190] ([i915#658])
[189]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb2/igt@[email protected]
[190]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb7/igt@[email protected]

* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area:
- shard-iclb: [SKIP][191] ([fdo#111068] / [i915#658]) -> [SKIP][192] ([i915#2920])
[191]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-iclb4/igt@[email protected]
[192]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-iclb2/igt@[email protected]

* igt@runner@aborted:
- shard-kbl: ([FAIL][193], [FAIL][194], [FAIL][195], [FAIL][196], [FAIL][197], [FAIL][198], [FAIL][199]) ([i915#180] / [i915#3002] / [i915#4312] / [i915#5257]) -> ([FAIL][200], [FAIL][201], [FAIL][202], [FAIL][203], [FAIL][204], [FAIL][205], [FAIL][206], [FAIL][207]) ([i915#180] / [i915#3002] / [i915#4312] / [i915#5257] / [i915#92])
[193]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@[email protected]
[194]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@[email protected]
[195]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@[email protected]
[196]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@[email protected]
[197]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@[email protected]
[198]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl4/igt@[email protected]
[199]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11970/shard-kbl7/igt@[email protected]
[200]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]
[201]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]
[202]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]
[203]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]
[204]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]
[205]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]
[206]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]
[207]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_105085v4/shard-kbl4/igt@[email protected]

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

[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
[fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
[fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110254]: https://bugs.freedesktop.org/show_bug.cgi?id=110254
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111314]: https://bugs.freedesktop.org/show_bug.cgi?id=111314
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1188]: https://gitlab.freedesktop.org/drm/intel/issues/1188
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1722]: https://gitlab.freedesktop.org/drm/intel/issues/1722
[i915#1769]: https://gitlab.freedesktop.org/drm/intel/issues/1769
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2410]: https://gitlab.freedesktop.org/drm/intel/issues/2410
[i915#2434]: https://gitlab.freedesktop.org/drm/intel/issues/2434
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2530]: https://gitlab.freedesktop.org/drm/intel/issues/2530
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#2658]: https://gitlab.freedesktop.org/drm/intel/issues/2658
[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#2849]: https://gitlab.freedesktop.org/drm/intel/issues/2849
[i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#2994]: https://gitlab.freedesktop.org/drm/intel/issues/2994
[i915#3002]: https://gitlab.freedesktop.org/drm/intel/issues/3002
[i915#3012]: https://gitlab.freedesktop.org/drm/intel/issues/3012
[i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
[i915#3323]: https://gitlab.freedesktop.org/drm/intel/issues/3323
[i915#3371]: https://gitlab.freedesktop.org/drm/intel/issues/3371
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[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#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3743]: https://gitlab.freedesktop.org/drm/intel/issues/3743
[i915#3826]: https://gitlab.freedesktop.org/drm/intel/issues/3826
[i915#3828]: https://gitlab.freedesktop.org/drm/intel/issues/3828
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3987]: https://gitlab.freedesktop.org/drm/intel/issues/3987
[i915#4016]: https://gitlab.freedesktop.org/drm/intel/issues/4016
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4281]: https://gitlab.freedesktop.org/drm/intel/issues/4281
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4369]: https://gitlab.freedesktop.org/drm/intel/issues/4369
[i915#4525]: https://gitlab.freedesktop.org/drm/intel/issues/4525
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4767]: https://gitlab.freedesktop.org/drm/intel/issues/4767
[i915#4939]: https://gitlab.freedesktop.org/drm/intel/issues/4939
[i915#4991]: https://gitlab.freedesktop.org/drm/intel/issues/4991
[i915#5032]: https://gitlab.freedesktop.org/drm/intel/issues/5032
[i915#51]: https://gitlab.freedesktop.org/drm/intel/issues/51
[i915#5129]: https://gitlab.freedesktop.org/drm/intel/issues/5129
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5182]: https://gitlab.freedesktop.org/drm/intel/issues/5182
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5257]: https://gitlab.freedesktop.org/drm/intel/issues/5257
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5287]: https://gitlab.freedesktop.org/drm/intel/issues/5287
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#5327]: https://gitlab.freedesktop.org/drm/intel/issues/5327
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5519]: https://gitlab.freedesktop.org/drm/intel/issues/5519
[i915#5639]: https://gitlab.freedesktop.org/drm/intel/issues/5639
[i915#588]: https://gitlab.freedesktop.org/drm/intel/issues/588
[i915#5977]: https://gitlab.freedesktop.org/drm/intel/issues/5977
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6117]: https://gitlab.freedesktop.org/drm/intel/issues/6117
[i915#6247]: https://gitlab.freedesktop.org/drm/intel/issues/6247
[i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
[i915#6252]: https://gitlab.freedesktop.org/drm/intel/issues/6252
[i915#6259]: https://gitlab.freedesktop.org/drm/intel/issues/6259
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6493]: https://gitlab.freedesktop.org/drm/intel/issues/6493
[i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92

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

* Linux: CI_DRM_11970 -> Patchwork_105085v4

CI-20190529: 20190529
CI_DRM_11970: 1d7aa8092dbbaef7c6a81903e0432f5b90da4d63 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6613: 209230467200f2fa63a6f71fe6299996470dd813 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_105085v4: 1d7aa8092dbbaef7c6a81903e0432f5b90da4d63 @ 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_105085v4/index.html

Acked-by on v1 1/1
#4 lore raw
In reply to Umesh Nerlige Ramappa
Quoted 13 lines · Umesh Nerlige Ramappa

From: John Harrison <[email protected]>

GuC provides engine_id and last_switch_in ticks for an active context in the pphwsp. The context image provides a 32 bit total ticks which is the accumulated by the context (a.k.a. context[CTX_TIMESTAMP]). This information is used to calculate the context busyness as follows:

If the engine_id is valid, then busyness is the sum of accumulated total ticks and active ticks. Active ticks is calculated with current gt time as reference.

If engine_id is invalid, busyness is equal to accumulated total ticks.

Quoted 7 lines

Since KMD (CPU) retrieves busyness data from 2 sources - GPU and GuC, a potential race was highlighted in an earlier review that can lead to double accounting of busyness. While the solution to this is a wip, busyness is still usable for platforms running GuC submission.

Remaining work: Enable and test context busyness for virtual_parent_context_ops and virtual_child_context_ops.

I meant track the IGT work in the jira internally. :)

Otherwise:

Also, can someone else please do the full review? I'm afraid with the passage of time I forgot what little I knew about how GuC tracks this data. :(

Some nits and questions below.

Quoted 110 lines

v2: (Tvrtko)
- Use COPS_RUNTIME_ACTIVE_TOTAL
- Add code comment for the race
- Undo local variables initializations

v3:
- Add support for virtual engines based on
https://patchwork.freedesktop.org/series/105227/

v4:
- Update commit message with remaining work.
- Rebase

---
  drivers/gpu/drm/i915/gt/intel_context.c       | 12 +++-
  drivers/gpu/drm/i915/gt/intel_context.h       |  6 +-
  drivers/gpu/drm/i915/gt/intel_context_types.h |  6 ++
  drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h   |  5 ++
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 65 ++++++++++++++++++-
  drivers/gpu/drm/i915/i915_drm_client.c        |  6 +-
  6 files changed, 89 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +10 -2
index 654a092ed3d6..e2d70a9fdac0 100644
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent,
  	child->parallel.parent = parent;
  }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce)
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce)
  {
  	u64 total, active;
 
+	if (ce->ops->update_stats)
+		ce->ops->update_stats(ce);
+
  	total = ce->stats.runtime.total;
  	if (ce->ops->flags & COPS_RUNTIME_CYCLES)
  		total *= ce->engine->gt->clock_period_ns;
 
  	active = READ_ONCE(ce->stats.active);
-	if (active)
+	/*
+	 * When COPS_RUNTIME_ACTIVE_TOTAL is set for ce->cops, the backend
+	 * already provides the total active time of the context, so skip this
+	 * calculation when this flag is set.
+	 */
+	if (active && !(ce->ops->flags & COPS_RUNTIME_ACTIVE_TOTAL))
  		active = intel_context_clock() - active;
 
  	return total + active;
drivers/gpu/drm/i915/gt/intel_context.h +3 -3
index 8e2d70630c49..3d1d7436c1a4 100644
@@ -58,7 +58,7 @@ static inline bool intel_context_is_parent(struct intel_context *ce)
  	return !!ce->parallel.number_children;
  }
 
-static inline bool intel_context_is_pinned(struct intel_context *ce);
+static inline bool intel_context_is_pinned(const struct intel_context *ce);
 
  static inline struct intel_context *
  intel_context_to_parent(struct intel_context *ce)
@@ -118,7 +118,7 @@ static inline int intel_context_lock_pinned(struct intel_context *ce)
   * Returns: true if the context is currently pinned for use by the GPU.
   */
  static inline bool
-intel_context_is_pinned(struct intel_context *ce)
+intel_context_is_pinned(const struct intel_context *ce)
  {
  	return atomic_read(&ce->pin_count);
  }
@@ -362,7 +362,7 @@ intel_context_clear_nopreempt(struct intel_context *ce)
  	clear_bit(CONTEXT_NOPREEMPT, &ce->flags);
  }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce);
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce);
  u64 intel_context_get_avg_runtime_ns(struct intel_context *ce);
 
  static inline u64 intel_context_clock(void)
drivers/gpu/drm/i915/gt/intel_context_types.h +5 -0
index 04eacae1aca5..f7ff4c7d81c7 100644
@@ -38,6 +38,9 @@ struct intel_context_ops {
  #define COPS_RUNTIME_CYCLES_BIT 1
  #define COPS_RUNTIME_CYCLES BIT(COPS_RUNTIME_CYCLES_BIT)
 
+#define COPS_RUNTIME_ACTIVE_TOTAL_BIT 2
+#define COPS_RUNTIME_ACTIVE_TOTAL BIT(COPS_RUNTIME_ACTIVE_TOTAL_BIT)
+
  	int (*alloc)(struct intel_context *ce);
 
  	void (*revoke)(struct intel_context *ce, struct i915_request *rq,
@@ -56,6 +59,8 @@ struct intel_context_ops {
 
  	void (*sched_disable)(struct intel_context *ce);
 
+	void (*update_stats)(struct intel_context *ce);
+
  	void (*reset)(struct intel_context *ce);
  	void (*destroy)(struct kref *kref);
 

drivers/gpu/drm/i915/gt/intel_context_types.h struct intel_context { · line 156

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context_types.h +1 -0
@@ -148,6 +153,7 @@ struct intel_context {
  			struct ewma_runtime avg;
  			u64 total;
  			u32 last;
+			u64 start_gt_clk;

Nit - put u64 next to u64 and u32 next to u32 to avoid holes.

Quoted 24 lines
drivers/gpu/drm/i915/gt/intel_context_types.h +0 -0
  			I915_SELFTEST_DECLARE(u32 num_underflow);
  			I915_SELFTEST_DECLARE(u32 max_underflow);
  		} runtime;
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +5 -0
index 323b055e5db9..c7b54f1631b9 100644
@@ -196,6 +196,11 @@ static inline u8 guc_class_to_engine_class(u8 guc_class)
  	return guc_class_engine_class_map[guc_class];
  }
 
+/* Per context engine usage stats: */
+#define PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO	(0x500 / sizeof(u32))
+#define PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI	(PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO + 1)
+#define PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID	(PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI + 1)
+
  /* Work item for submitting workloads into work queue of GuC. */
  struct guc_wq_item {
  	u32 header;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
index 0d17da77e787..c9fefa254a7e 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static inline void set_context_guc_id_invalid(struct intel_context *ce) · line 381

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -1
@@ -378,7 +378,7 @@ static inline void set_context_guc_id_invalid(struct intel_context *ce)
  	ce->guc_id.id = GUC_INVALID_CONTEXT_ID;
  }
 
-static inline struct intel_guc *ce_to_guc(struct intel_context *ce)
+static inline struct intel_guc *ce_to_guc(const struct intel_context *ce)

This is odd since the helper now takes away constness. I can't really figure out why the change is needed?

Quoted 46 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +18 -0
  {
  	return &ce->engine->gt->uc.guc;
  }
@@ -1376,13 +1376,16 @@ static void __update_guc_busyness_stats(struct intel_guc *guc)
  	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
  }
 
+static void __guc_context_update_clks(struct intel_context *ce);
  static void guc_timestamp_ping(struct work_struct *wrk)
  {
  	struct intel_guc *guc = container_of(wrk, typeof(*guc),
  					     timestamp.work.work);
  	struct intel_uc *uc = container_of(guc, typeof(*uc), guc);
  	struct intel_gt *gt = guc_to_gt(guc);
+	struct intel_context *ce;
  	intel_wakeref_t wakeref;
+	unsigned long index;
  	int srcu, ret;
 
  	/*
@@ -1396,6 +1399,10 @@ static void guc_timestamp_ping(struct work_struct *wrk)
  	with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
  		__update_guc_busyness_stats(guc);
 
+	/* adjust context stats for overflow */
+	xa_for_each(&guc->context_lookup, index, ce)
+		__guc_context_update_clks(ce);
+
  	intel_gt_reset_unlock(gt, srcu);
 
  	mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
@@ -1469,6 +1476,56 @@ void intel_guc_busyness_unpark(struct intel_gt *gt)
  			 guc->timestamp.ping_delay);
  }
 
+static void __guc_context_update_clks(struct intel_context *ce)
+{
+	struct intel_guc *guc = ce_to_guc(ce);
+	struct intel_gt *gt = ce->engine->gt;
+	u32 *pphwsp, last_switch, engine_id;
+	u64 start_gt_clk, active;
+	unsigned long flags;
+	ktime_t unused;
+
+	spin_lock_irqsave(&guc->timestamp.lock, flags);
+

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1499

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10 -0
+	/*
+	 * GPU updates ce->lrc_reg_state[CTX_TIMESTAMP] when context is switched
+	 * out, however GuC updates PPHWSP offsets below. Hence KMD (CPU)
+	 * relies on GuC and GPU for busyness calculations. Due to this, A
+	 * potential race was highlighted in an earlier review that can lead to
+	 * double accounting of busyness. While the solution to this is a wip,
+	 * busyness is still usable for platforms running GuC submission.
+	 */
+	pphwsp = ((void *)ce->lrc_reg_state) - LRC_STATE_OFFSET;
+	last_switch = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO]);

What about PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI? I see it defined but isn't used so is the timestmap 32 bit just ABI reserved 64 bits for future proofing or something?

Regards,

Tvrtko

Quoted 90 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +35 -0
+	engine_id = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID]);
+
+	guc_update_pm_timestamp(guc, &unused);
+
+	if (engine_id != 0xffffffff && last_switch) {
+		start_gt_clk = READ_ONCE(ce->stats.runtime.start_gt_clk);
+		__extend_last_switch(guc, &start_gt_clk, last_switch);
+		active = intel_gt_clock_interval_to_ns(gt, guc->timestamp.gt_stamp - start_gt_clk);
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, start_gt_clk);
+		WRITE_ONCE(ce->stats.active, active);
+	} else {
+		lrc_update_runtime(ce);
+	}
+
+	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
+}
+
+static void guc_context_update_stats(struct intel_context *ce)
+{
+	if (!intel_context_pin_if_active(ce)) {
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, 0);
+		WRITE_ONCE(ce->stats.active, 0);
+		return;
+	}
+
+	__guc_context_update_clks(ce);
+	intel_context_unpin(ce);
+}
+
  static inline bool
  submission_disabled(struct intel_guc *guc)
  {
@@ -2723,6 +2780,7 @@ static void guc_context_unpin(struct intel_context *ce)
  {
  	struct intel_guc *guc = ce_to_guc(ce);
 
+	lrc_update_runtime(ce);
  	unpin_guc_id(guc, ce);
  	lrc_unpin(ce);
 
@@ -3344,6 +3402,7 @@ static void remove_from_context(struct i915_request *rq)
  }
 
  static const struct intel_context_ops guc_context_ops = {
+	.flags = COPS_RUNTIME_CYCLES | COPS_RUNTIME_ACTIVE_TOTAL,
  	.alloc = guc_context_alloc,
 
  	.pre_pin = guc_context_pre_pin,
@@ -3360,6 +3419,8 @@ static const struct intel_context_ops guc_context_ops = {
 
  	.sched_disable = guc_context_sched_disable,
 
+	.update_stats = guc_context_update_stats,
+
  	.reset = lrc_reset,
  	.destroy = guc_context_destroy,
 
@@ -3593,6 +3654,7 @@ static int guc_virtual_context_alloc(struct intel_context *ce)
  }
 
  static const struct intel_context_ops virtual_guc_context_ops = {
+	.flags = COPS_RUNTIME_CYCLES | COPS_RUNTIME_ACTIVE_TOTAL,
  	.alloc = guc_virtual_context_alloc,
 
  	.pre_pin = guc_virtual_context_pre_pin,
@@ -3608,6 +3670,7 @@ static const struct intel_context_ops virtual_guc_context_ops = {
  	.exit = guc_virtual_context_exit,
 
  	.sched_disable = guc_context_sched_disable,
+	.update_stats = guc_context_update_stats,
 
  	.destroy = guc_context_destroy,
 
drivers/gpu/drm/i915/i915_drm_client.c +1 -5
index b09d1d386574..8d81119fff14 100644
@@ -147,11 +147,7 @@ void i915_drm_client_fdinfo(struct seq_file *m, struct file *f)
  		   PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
  	seq_printf(m, "drm-client-id:\t%u\n", client->id);
 
-	/*
-	 * Temporarily skip showing client engine information with GuC submission till
-	 * fetching engine busyness is implemented in the GuC submission backend
-	 */
-	if (GRAPHICS_VER(i915) < 8 || intel_uc_uses_guc_submission(&i915->gt0.uc))
+	if (GRAPHICS_VER(i915) < 8)
  		return;
 
  	for (i = 0; i < ARRAY_SIZE(uabi_class_names); i++)
#5 lore raw
Quoted 20 lines · Tvrtko Ursulin
Quoted 18 lines · Umesh Nerlige Ramappa

From: John Harrison <[email protected]>

GuC provides engine_id and last_switch_in ticks for an active context in the pphwsp. The context image provides a 32 bit total ticks which is the accumulated by the context (a.k.a. context[CTX_TIMESTAMP]). This information is used to calculate the context busyness as follows:

If the engine_id is valid, then busyness is the sum of accumulated total ticks and active ticks. Active ticks is calculated with current gt time as reference.

If engine_id is invalid, busyness is equal to accumulated total ticks.

Since KMD (CPU) retrieves busyness data from 2 sources - GPU and GuC, a potential race was highlighted in an earlier review that can lead to double accounting of busyness. While the solution to this is a wip, busyness is still usable for platforms running GuC submission.

Quoted 4 lines
Quoted 2 lines

Remaining work: Enable and test context busyness for virtual_parent_context_ops and virtual_child_context_ops.

I meant track the IGT work in the jira internally. :)

Oh, I did do that and added this here as well. Note that I have not enabled the busyness in i915 for the parent/child context ops since I was not able to verify it yet.

Quoted 6 lines

Otherwise:

Also, can someone else please do the full review? I'm afraid with the passage of time I forgot what little I knew about how GuC tracks this data. :(

I will ask around

Quoted 182 lines

Some nits and questions below.

Quoted 97 lines

v2: (Tvrtko)
- Use COPS_RUNTIME_ACTIVE_TOTAL
- Add code comment for the race
- Undo local variables initializations

v3:
- Add support for virtual engines based on
https://patchwork.freedesktop.org/series/105227/

v4:
- Update commit message with remaining work.
- Rebase

---
 drivers/gpu/drm/i915/gt/intel_context.c       | 12 +++-
 drivers/gpu/drm/i915/gt/intel_context.h       |  6 +-
 drivers/gpu/drm/i915/gt/intel_context_types.h |  6 ++
 drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h   |  5 ++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 65 ++++++++++++++++++-
 drivers/gpu/drm/i915/i915_drm_client.c        |  6 +-
 6 files changed, 89 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +10 -2
index 654a092ed3d6..e2d70a9fdac0 100644
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent,
 	child->parallel.parent = parent;
 }
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce)
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce)
 {
 	u64 total, active;
+	if (ce->ops->update_stats)
+		ce->ops->update_stats(ce);
+
 	total = ce->stats.runtime.total;
 	if (ce->ops->flags & COPS_RUNTIME_CYCLES)
 		total *= ce->engine->gt->clock_period_ns;
 	active = READ_ONCE(ce->stats.active);
-	if (active)
+	/*
+	 * When COPS_RUNTIME_ACTIVE_TOTAL is set for ce->cops, the backend
+	 * already provides the total active time of the context, so skip this
+	 * calculation when this flag is set.
+	 */
+	if (active && !(ce->ops->flags & COPS_RUNTIME_ACTIVE_TOTAL))
 		active = intel_context_clock() - active;
 	return total + active;
drivers/gpu/drm/i915/gt/intel_context.h +3 -3
index 8e2d70630c49..3d1d7436c1a4 100644
@@ -58,7 +58,7 @@ static inline bool intel_context_is_parent(struct intel_context *ce)
 	return !!ce->parallel.number_children;
 }
-static inline bool intel_context_is_pinned(struct intel_context *ce);
+static inline bool intel_context_is_pinned(const struct intel_context *ce);
 static inline struct intel_context *
 intel_context_to_parent(struct intel_context *ce)
@@ -118,7 +118,7 @@ static inline int intel_context_lock_pinned(struct intel_context *ce)
  * Returns: true if the context is currently pinned for use by the GPU.
  */
 static inline bool
-intel_context_is_pinned(struct intel_context *ce)
+intel_context_is_pinned(const struct intel_context *ce)
 {
 	return atomic_read(&ce->pin_count);
 }
@@ -362,7 +362,7 @@ intel_context_clear_nopreempt(struct intel_context *ce)
 	clear_bit(CONTEXT_NOPREEMPT, &ce->flags);
 }
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce);
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce);
 u64 intel_context_get_avg_runtime_ns(struct intel_context *ce);
 static inline u64 intel_context_clock(void)
drivers/gpu/drm/i915/gt/intel_context_types.h +5 -0
index 04eacae1aca5..f7ff4c7d81c7 100644
@@ -38,6 +38,9 @@ struct intel_context_ops {
 #define COPS_RUNTIME_CYCLES_BIT 1
 #define COPS_RUNTIME_CYCLES BIT(COPS_RUNTIME_CYCLES_BIT)
+#define COPS_RUNTIME_ACTIVE_TOTAL_BIT 2
+#define COPS_RUNTIME_ACTIVE_TOTAL BIT(COPS_RUNTIME_ACTIVE_TOTAL_BIT)
+
 	int (*alloc)(struct intel_context *ce);
 	void (*revoke)(struct intel_context *ce, struct i915_request *rq,
@@ -56,6 +59,8 @@ struct intel_context_ops {
 	void (*sched_disable)(struct intel_context *ce);
+	void (*update_stats)(struct intel_context *ce);
+
 	void (*reset)(struct intel_context *ce);
 	void (*destroy)(struct kref *kref);

drivers/gpu/drm/i915/gt/intel_context_types.h struct intel_context { · line 156

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context_types.h +1 -0
@@ -148,6 +153,7 @@ struct intel_context {
 			struct ewma_runtime avg;
 			u64 total;
 			u32 last;
+			u64 start_gt_clk;

Nit - put u64 next to u64 and u32 next to u32 to avoid holes.

Quoted 23 lines
drivers/gpu/drm/i915/gt/intel_context_types.h +0 -0
 			I915_SELFTEST_DECLARE(u32 num_underflow);
 			I915_SELFTEST_DECLARE(u32 max_underflow);
 		} runtime;
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +5 -0
index 323b055e5db9..c7b54f1631b9 100644
@@ -196,6 +196,11 @@ static inline u8 guc_class_to_engine_class(u8 guc_class)
 	return guc_class_engine_class_map[guc_class];
 }
+/* Per context engine usage stats: */
+#define PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO	(0x500 / sizeof(u32))
+#define PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI	(PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO + 1)
+#define PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID	(PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI + 1)
+
 /* Work item for submitting workloads into work queue of GuC. */
 struct guc_wq_item {
 	u32 header;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
index 0d17da77e787..c9fefa254a7e 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static inline void set_context_guc_id_invalid(struct intel_context *ce) · line 380

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -1
@@ -378,7 +378,7 @@ static inline void set_context_guc_id_invalid(struct intel_context *ce)
 	ce->guc_id.id = GUC_INVALID_CONTEXT_ID;
 }
-static inline struct intel_guc *ce_to_guc(struct intel_context *ce)
+static inline struct intel_guc *ce_to_guc(const struct intel_context *ce)

This is odd since the helper now takes away constness. I can't really figure out why the change is needed?

Quoted 45 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +22 -0
 {
 	return &ce->engine->gt->uc.guc;
 }
@@ -1376,13 +1376,16 @@ static void __update_guc_busyness_stats(struct intel_guc *guc)
 	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
 }
+static void __guc_context_update_clks(struct intel_context *ce);
 static void guc_timestamp_ping(struct work_struct *wrk)
 {
 	struct intel_guc *guc = container_of(wrk, typeof(*guc),
 					     timestamp.work.work);
 	struct intel_uc *uc = container_of(guc, typeof(*uc), guc);
 	struct intel_gt *gt = guc_to_gt(guc);
+	struct intel_context *ce;
 	intel_wakeref_t wakeref;
+	unsigned long index;
 	int srcu, ret;
 	/*
@@ -1396,6 +1399,10 @@ static void guc_timestamp_ping(struct work_struct *wrk)
 	with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
 		__update_guc_busyness_stats(guc);
+	/* adjust context stats for overflow */
+	xa_for_each(&guc->context_lookup, index, ce)
+		__guc_context_update_clks(ce);
+
 	intel_gt_reset_unlock(gt, srcu);
 	mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
@@ -1469,6 +1476,56 @@ void intel_guc_busyness_unpark(struct intel_gt *gt)
 			 guc->timestamp.ping_delay);
 }
+static void __guc_context_update_clks(struct intel_context *ce)
+{
+	struct intel_guc *guc = ce_to_guc(ce);
+	struct intel_gt *gt = ce->engine->gt;
+	u32 *pphwsp, last_switch, engine_id;
+	u64 start_gt_clk, active;
+	unsigned long flags;
+	ktime_t unused;
+
+	spin_lock_irqsave(&guc->timestamp.lock, flags);
+
+	/*
+	 * GPU updates ce->lrc_reg_state[CTX_TIMESTAMP] when context is switched
+	 * out, however GuC updates PPHWSP offsets below. Hence KMD (CPU)
+	 * relies on GuC and GPU for busyness calculations. Due to this, A
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1499

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +6 -0
+	 * potential race was highlighted in an earlier review that can lead to
+	 * double accounting of busyness. While the solution to this is a wip,
+	 * busyness is still usable for platforms running GuC submission.
+	 */
+	pphwsp = ((void *)ce->lrc_reg_state) - LRC_STATE_OFFSET;
+	last_switch = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO]);

What about PPHWSP_GUC_CONTEXT_USAGE_STAMP_HI? I see it defined but isn't used so is the timestmap 32 bit just ABI reserved 64 bits for future proofing or something?

Yes, the _HI is not populated by GuC yet, but reserved for future extension to 64 bits.

Thanks,
Umesh

Quoted 81 lines

Regards,

Tvrtko

Quoted 76 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +35 -0
+	engine_id = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID]);
+
+	guc_update_pm_timestamp(guc, &unused);
+
+	if (engine_id != 0xffffffff && last_switch) {
+		start_gt_clk = READ_ONCE(ce->stats.runtime.start_gt_clk);
+		__extend_last_switch(guc, &start_gt_clk, last_switch);
+		active = intel_gt_clock_interval_to_ns(gt, guc->timestamp.gt_stamp - start_gt_clk);
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, start_gt_clk);
+		WRITE_ONCE(ce->stats.active, active);
+	} else {
+		lrc_update_runtime(ce);
+	}
+
+	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
+}
+
+static void guc_context_update_stats(struct intel_context *ce)
+{
+	if (!intel_context_pin_if_active(ce)) {
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, 0);
+		WRITE_ONCE(ce->stats.active, 0);
+		return;
+	}
+
+	__guc_context_update_clks(ce);
+	intel_context_unpin(ce);
+}
+
 static inline bool
 submission_disabled(struct intel_guc *guc)
 {
@@ -2723,6 +2780,7 @@ static void guc_context_unpin(struct intel_context *ce)
 {
 	struct intel_guc *guc = ce_to_guc(ce);
+	lrc_update_runtime(ce);
 	unpin_guc_id(guc, ce);
 	lrc_unpin(ce);
@@ -3344,6 +3402,7 @@ static void remove_from_context(struct i915_request *rq)
 }
 static const struct intel_context_ops guc_context_ops = {
+	.flags = COPS_RUNTIME_CYCLES | COPS_RUNTIME_ACTIVE_TOTAL,
 	.alloc = guc_context_alloc,
 	.pre_pin = guc_context_pre_pin,
@@ -3360,6 +3419,8 @@ static const struct intel_context_ops guc_context_ops = {
 	.sched_disable = guc_context_sched_disable,
+	.update_stats = guc_context_update_stats,
+
 	.reset = lrc_reset,
 	.destroy = guc_context_destroy,
@@ -3593,6 +3654,7 @@ static int guc_virtual_context_alloc(struct intel_context *ce)
 }
 static const struct intel_context_ops virtual_guc_context_ops = {
+	.flags = COPS_RUNTIME_CYCLES | COPS_RUNTIME_ACTIVE_TOTAL,
 	.alloc = guc_virtual_context_alloc,
 	.pre_pin = guc_virtual_context_pre_pin,
@@ -3608,6 +3670,7 @@ static const struct intel_context_ops virtual_guc_context_ops = {
 	.exit = guc_virtual_context_exit,
 	.sched_disable = guc_context_sched_disable,
+	.update_stats = guc_context_update_stats,
 	.destroy = guc_context_destroy,
drivers/gpu/drm/i915/i915_drm_client.c +1 -5
index b09d1d386574..8d81119fff14 100644
@@ -147,11 +147,7 @@ void i915_drm_client_fdinfo(struct seq_file *m, struct file *f)
 		   PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
 	seq_printf(m, "drm-client-id:\t%u\n", client->id);
-	/*
-	 * Temporarily skip showing client engine information with GuC submission till
-	 * fetching engine busyness is implemented in the GuC submission backend
-	 */
-	if (GRAPHICS_VER(i915) < 8 || intel_uc_uses_guc_submission(&i915->gt0.uc))
+	if (GRAPHICS_VER(i915) < 8)
 		return;
 	for (i = 0; i < ARRAY_SIZE(uabi_class_names); i++)

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 5 lines · Ashutosh
Quoted 4 lines · Umesh Nerlige Ramappa
Quoted 2 lines · Tvrtko Ursulin

On 05/08/2022 00:21, Umesh Nerlige Ramappa wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static inline void set_context_guc_id_invalid(struct intel_context *ce) · line 381

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -1
-static inline struct intel_guc *ce_to_guc(struct intel_context *ce)
+static inline struct intel_guc *ce_to_guc(const struct intel_context *ce)

This is odd since the helper now takes away constness. I can't really figure out why the change is needed?

Hi Umesh, I am also wondering about this, I think you missed answering this question from Tvrtko.

This helper 'adds' constness, so wasn't sure if the comment was intended for this helper.

Thanks,
Umesh

Quoted 4 lines

Thanks.
--
Ashutosh

#8 lore raw
In reply to Umesh Nerlige Ramappa
Quoted 1 line · Umesh Nerlige Ramappa

Hi Umesh,

Still reviewing but I have a question below.

Quoted 6 lines
drivers/gpu/drm/i915/gt/intel_context.c +0 -0
index 654a092ed3d6..e2d70a9fdac0 100644
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent,
 	child->parallel.parent = parent;

drivers/gpu/drm/i915/gt/intel_context.c void intel_context_bind_parent_child(struct intel_context *parent, · line 585

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.c +4 -1
 }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce)
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce)
 {
 	u64 total, active;
 
+	if (ce->ops->update_stats)
+		ce->ops->update_stats(ce);
+

/snip/

drivers/gpu/drm/i915/gt/intel_context.c static void guc_timestamp_ping(struct work_struct *wrk) · line 1405

Quoted 8 lines
drivers/gpu/drm/i915/gt/intel_context.c +4 -0
@@ -1396,6 +1399,10 @@ static void guc_timestamp_ping(struct work_struct *wrk)
 	with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
 		__update_guc_busyness_stats(guc);
 
+	/* adjust context stats for overflow */
+	xa_for_each(&guc->context_lookup, index, ce)
+		__guc_context_update_clks(ce);
+

The question is why do we have 2 functions: __guc_context_update_clks() (which we call periodically from guc_timestamp_ping()) and guc_context_update_stats() (which we call non-periodically from intel_context_get_total_runtime_ns()? Why don't we have just one function which is called from both places? Or rather why don't we call guc_context_update_stats() from both places?

If we don't call guc_context_update_stats() periodically from guc_timestamp_ping() how e.g. does ce->stats.runtime.start_gt_clk get reset to 0? If it gets reset to 0 in __guc_context_update_clks() then why do we need to reset it in guc_context_update_stats()?

Also IMO guc->timestamp.lock should be taken by this single function, (otherwise guc_context_update_stats() is modifying ce->stats.runtime.start_gt_clk without taking the lock).

Thanks.
--
Ashutosh

Quoted 49 lines
drivers/gpu/drm/i915/gt/intel_context.c +49 -0
+static void __guc_context_update_clks(struct intel_context *ce)
+{
+	struct intel_guc *guc = ce_to_guc(ce);
+	struct intel_gt *gt = ce->engine->gt;
+	u32 *pphwsp, last_switch, engine_id;
+	u64 start_gt_clk, active;
+	unsigned long flags;
+	ktime_t unused;
+
+	spin_lock_irqsave(&guc->timestamp.lock, flags);
+
+	/*
+	 * GPU updates ce->lrc_reg_state[CTX_TIMESTAMP] when context is switched
+	 * out, however GuC updates PPHWSP offsets below. Hence KMD (CPU)
+	 * relies on GuC and GPU for busyness calculations. Due to this, A
+	 * potential race was highlighted in an earlier review that can lead to
+	 * double accounting of busyness. While the solution to this is a wip,
+	 * busyness is still usable for platforms running GuC submission.
+	 */
+	pphwsp = ((void *)ce->lrc_reg_state) - LRC_STATE_OFFSET;
+	last_switch = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO]);
+	engine_id = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID]);
+
+	guc_update_pm_timestamp(guc, &unused);
+
+	if (engine_id != 0xffffffff && last_switch) {
+		start_gt_clk = READ_ONCE(ce->stats.runtime.start_gt_clk);
+		__extend_last_switch(guc, &start_gt_clk, last_switch);
+		active = intel_gt_clock_interval_to_ns(gt, guc->timestamp.gt_stamp - start_gt_clk);
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, start_gt_clk);
+		WRITE_ONCE(ce->stats.active, active);
+	} else {
+		lrc_update_runtime(ce);
+	}
+
+	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
+}
+
+static void guc_context_update_stats(struct intel_context *ce)
+{
+	if (!intel_context_pin_if_active(ce)) {
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, 0);
+		WRITE_ONCE(ce->stats.active, 0);
+		return;
+	}
+
+	__guc_context_update_clks(ce);
+	intel_context_unpin(ce);
+}
#9 lore raw
Quoted 7 lines · Ashutosh
Quoted 1 line · Umesh Nerlige Ramappa

Hi Umesh,

Still reviewing but I have a question below.

Please ignore this mail for now, mostly a result of my misunderstanding the code. I will ask again if I have any questions. Thanks.

Quoted 98 lines
Quoted 7 lines
drivers/gpu/drm/i915/gt/intel_context.c +0 -0
index 654a092ed3d6..e2d70a9fdac0 100644
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent,
 	child->parallel.parent = parent;

drivers/gpu/drm/i915/gt/intel_context.c void intel_context_bind_parent_child(struct intel_context *parent, · line 585

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.c +4 -1
 }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce)
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce)
 {
 	u64 total, active;
 
+	if (ce->ops->update_stats)
+		ce->ops->update_stats(ce);
+

/snip/

drivers/gpu/drm/i915/gt/intel_context.c static void guc_timestamp_ping(struct work_struct *wrk) · line 1405

Quoted 8 lines
drivers/gpu/drm/i915/gt/intel_context.c +4 -0
@@ -1396,6 +1399,10 @@ static void guc_timestamp_ping(struct work_struct *wrk)
 	with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
 		__update_guc_busyness_stats(guc);
 
+	/* adjust context stats for overflow */
+	xa_for_each(&guc->context_lookup, index, ce)
+		__guc_context_update_clks(ce);
+

The question is why do we have 2 functions: __guc_context_update_clks() (which we call periodically from guc_timestamp_ping()) and guc_context_update_stats() (which we call non-periodically from intel_context_get_total_runtime_ns()? Why don't we have just one function which is called from both places? Or rather why don't we call guc_context_update_stats() from both places?

If we don't call guc_context_update_stats() periodically from guc_timestamp_ping() how e.g. does ce->stats.runtime.start_gt_clk get reset to 0? If it gets reset to 0 in __guc_context_update_clks() then why do we need to reset it in guc_context_update_stats()?

Also IMO guc->timestamp.lock should be taken by this single function, (otherwise guc_context_update_stats() is modifying ce->stats.runtime.start_gt_clk without taking the lock).

Thanks.
--
Ashutosh

Quoted 49 lines
drivers/gpu/drm/i915/gt/intel_context.c +49 -0
+static void __guc_context_update_clks(struct intel_context *ce)
+{
+	struct intel_guc *guc = ce_to_guc(ce);
+	struct intel_gt *gt = ce->engine->gt;
+	u32 *pphwsp, last_switch, engine_id;
+	u64 start_gt_clk, active;
+	unsigned long flags;
+	ktime_t unused;
+
+	spin_lock_irqsave(&guc->timestamp.lock, flags);
+
+	/*
+	 * GPU updates ce->lrc_reg_state[CTX_TIMESTAMP] when context is switched
+	 * out, however GuC updates PPHWSP offsets below. Hence KMD (CPU)
+	 * relies on GuC and GPU for busyness calculations. Due to this, A
+	 * potential race was highlighted in an earlier review that can lead to
+	 * double accounting of busyness. While the solution to this is a wip,
+	 * busyness is still usable for platforms running GuC submission.
+	 */
+	pphwsp = ((void *)ce->lrc_reg_state) - LRC_STATE_OFFSET;
+	last_switch = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO]);
+	engine_id = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID]);
+
+	guc_update_pm_timestamp(guc, &unused);
+
+	if (engine_id != 0xffffffff && last_switch) {
+		start_gt_clk = READ_ONCE(ce->stats.runtime.start_gt_clk);
+		__extend_last_switch(guc, &start_gt_clk, last_switch);
+		active = intel_gt_clock_interval_to_ns(gt, guc->timestamp.gt_stamp - start_gt_clk);
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, start_gt_clk);
+		WRITE_ONCE(ce->stats.active, active);
+	} else {
+		lrc_update_runtime(ce);
+	}
+
+	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
+}
+
+static void guc_context_update_stats(struct intel_context *ce)
+{
+	if (!intel_context_pin_if_active(ce)) {
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, 0);
+		WRITE_ONCE(ce->stats.active, 0);
+		return;
+	}
+
+	__guc_context_update_clks(ce);
+	intel_context_unpin(ce);
+}
#10 lore raw
In reply to Umesh Nerlige Ramappa

On Thu, 04 Aug 2022 16:21:25 -0700, Umesh Nerlige Ramappa wrote:

Hi Umesh, I am fairly new to this code so some questions will be below will be newbie questions, thanks for bearing with me.

Quoted 21 lines
drivers/gpu/drm/i915/gt/intel_context.c +4 -1
index 654a092ed3d6..e2d70a9fdac0 100644
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent,
 	child->parallel.parent = parent;
 }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce)
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce)
 {
 	u64 total, active;
 
+	if (ce->ops->update_stats)
+		ce->ops->update_stats(ce);
+
 	total = ce->stats.runtime.total;
 	if (ce->ops->flags & COPS_RUNTIME_CYCLES)
 		total *= ce->engine->gt->clock_period_ns;
 
 	active = READ_ONCE(ce->stats.active);

drivers/gpu/drm/i915/gt/intel_context.c void intel_context_bind_parent_child(struct intel_context *parent, · line 599

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.c +6 -1
-	if (active)
+	/*
+	 * When COPS_RUNTIME_ACTIVE_TOTAL is set for ce->cops, the backend
+	 * already provides the total active time of the context, so skip this
+	 * calculation when this flag is set.
+	 */
+	if (active && !(ce->ops->flags & COPS_RUNTIME_ACTIVE_TOTAL))
 		active = intel_context_clock() - active;
 
 	return total + active;

/snip/

drivers/gpu/drm/i915/gt/intel_context.c static void guc_timestamp_ping(struct work_struct *wrk) · line 1404

Quoted 7 lines
drivers/gpu/drm/i915/gt/intel_context.c +3 -0
@@ -1396,6 +1399,10 @@ static void guc_timestamp_ping(struct work_struct *wrk)
 	with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
 		__update_guc_busyness_stats(guc);
 
+	/* adjust context stats for overflow */
+	xa_for_each(&guc->context_lookup, index, ce)
+		__guc_context_update_clks(ce);

What is the reason for calling __guc_context_update_clks() periodically from guc_timestamp_ping() since it appears we should just be able to call __guc_context_update_clks() from intel_context_get_total_runtime_ns() to update 'active'? Is the reason for calling __guc_context_update_clks() periodically that the calculations in __guc_context_update_clks() become invalid if the counters overflow?

Quoted 29 lines
drivers/gpu/drm/i915/gt/intel_context.c +22 -0
+
 	intel_gt_reset_unlock(gt, srcu);
 
 	mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
@@ -1469,6 +1476,56 @@ void intel_guc_busyness_unpark(struct intel_gt *gt)
 			 guc->timestamp.ping_delay);
 }
 
+static void __guc_context_update_clks(struct intel_context *ce)
+{
+	struct intel_guc *guc = ce_to_guc(ce);
+	struct intel_gt *gt = ce->engine->gt;
+	u32 *pphwsp, last_switch, engine_id;
+	u64 start_gt_clk, active;
+	unsigned long flags;
+	ktime_t unused;
+
+	spin_lock_irqsave(&guc->timestamp.lock, flags);
+
+	/*
+	 * GPU updates ce->lrc_reg_state[CTX_TIMESTAMP] when context is switched
+	 * out, however GuC updates PPHWSP offsets below. Hence KMD (CPU)
+	 * relies on GuC and GPU for busyness calculations. Due to this, A
+	 * potential race was highlighted in an earlier review that can lead to
+	 * double accounting of busyness. While the solution to this is a wip,
+	 * busyness is still usable for platforms running GuC submission.
+	 */
+	pphwsp = ((void *)ce->lrc_reg_state) - LRC_STATE_OFFSET;
+	last_switch = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO]);

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1509

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.c +10 -0
+	engine_id = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID]);
+
+	guc_update_pm_timestamp(guc, &unused);
+
+	if (engine_id != 0xffffffff && last_switch) {
+		start_gt_clk = READ_ONCE(ce->stats.runtime.start_gt_clk);
+		__extend_last_switch(guc, &start_gt_clk, last_switch);
+		active = intel_gt_clock_interval_to_ns(gt, guc->timestamp.gt_stamp - start_gt_clk);
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, start_gt_clk);
+		WRITE_ONCE(ce->stats.active, active);

Should not need WRITE_ONCE to update regular memory. Not even sure we need READ_ONCE above.

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1511

Quoted 2 lines
drivers/gpu/drm/i915/gt/intel_context.c +2 -0
+	} else {
+		lrc_update_runtime(ce);

As was being discussed, should not need this here in this function. See below too.

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1521

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.c +10 -0
+	}
+
+	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
+}
+
+static void guc_context_update_stats(struct intel_context *ce)
+{
+	if (!intel_context_pin_if_active(ce)) {
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, 0);
+		WRITE_ONCE(ce->stats.active, 0);

Why do these need to be initialized to 0? Looks like the calculations in __guc_context_update_clks() will work even if we don't do this? Also I didn't follow the 'if (!intel_context_pin_if_active(ce))' check.

Quoted 11 lines
drivers/gpu/drm/i915/gt/intel_context.c +7 -0
+		return;
+	}
+
+	__guc_context_update_clks(ce);
+	intel_context_unpin(ce);
+}
+
 static inline bool
 submission_disabled(struct intel_guc *guc)
 {

drivers/gpu/drm/i915/gt/intel_context.c static void guc_context_unpin(struct intel_context *ce) · line 2783

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context.c +1 -0
@@ -2723,6 +2780,7 @@ static void guc_context_unpin(struct intel_context *ce)
 {
 	struct intel_guc *guc = ce_to_guc(ce);
 
+	lrc_update_runtime(ce);

How about moving this into lrc_unpin() since that gets called from all guc context types (parent/child/virtual).

Quoted 56 lines
drivers/gpu/drm/i915/gt/intel_context.c +5 -0
 	unpin_guc_id(guc, ce);
 	lrc_unpin(ce);
 
@@ -3344,6 +3402,7 @@ static void remove_from_context(struct i915_request *rq)
 }
 
 static const struct intel_context_ops guc_context_ops = {
+	.flags = COPS_RUNTIME_CYCLES | COPS_RUNTIME_ACTIVE_TOTAL,
 	.alloc = guc_context_alloc,
 
 	.pre_pin = guc_context_pre_pin,
@@ -3360,6 +3419,8 @@ static const struct intel_context_ops guc_context_ops = {
 
 	.sched_disable = guc_context_sched_disable,
 
+	.update_stats = guc_context_update_stats,
+
 	.reset = lrc_reset,
 	.destroy = guc_context_destroy,
 
@@ -3593,6 +3654,7 @@ static int guc_virtual_context_alloc(struct intel_context *ce)
 }
 
 static const struct intel_context_ops virtual_guc_context_ops = {
+	.flags = COPS_RUNTIME_CYCLES | COPS_RUNTIME_ACTIVE_TOTAL,
 	.alloc = guc_virtual_context_alloc,
 
 	.pre_pin = guc_virtual_context_pre_pin,
@@ -3608,6 +3670,7 @@ static const struct intel_context_ops virtual_guc_context_ops = {
 	.exit = guc_virtual_context_exit,
 
 	.sched_disable = guc_context_sched_disable,
+	.update_stats = guc_context_update_stats,
 
 	.destroy = guc_context_destroy,
 
drivers/gpu/drm/i915/i915_drm_client.c +1 -6
index b09d1d386574..8d81119fff14 100644
@@ -147,11 +147,7 @@ void i915_drm_client_fdinfo(struct seq_file *m, struct file *f)
 		   PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
 	seq_printf(m, "drm-client-id:\t%u\n", client->id);
 
-	/*
-	 * Temporarily skip showing client engine information with GuC submission till
-	 * fetching engine busyness is implemented in the GuC submission backend
-	 */
-	if (GRAPHICS_VER(i915) < 8 || intel_uc_uses_guc_submission(&i915->gt0.uc))
+	if (GRAPHICS_VER(i915) < 8)
 		return;
 
 	for (i = 0; i < ARRAY_SIZE(uabi_class_names); i++)
--

2.37.1

#11 lore raw
Quoted 43 lines · Ashutosh

On Thu, 04 Aug 2022 16:21:25 -0700, Umesh Nerlige Ramappa wrote:

Hi Umesh, I am fairly new to this code so some questions will be below will be newbie questions, thanks for bearing with me.

Quoted 21 lines
drivers/gpu/drm/i915/gt/intel_context.c +4 -1
index 654a092ed3d6..e2d70a9fdac0 100644
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent,
 	child->parallel.parent = parent;
 }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce)
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce)
 {
 	u64 total, active;
 
+	if (ce->ops->update_stats)
+		ce->ops->update_stats(ce);
+
 	total = ce->stats.runtime.total;
 	if (ce->ops->flags & COPS_RUNTIME_CYCLES)
 		total *= ce->engine->gt->clock_period_ns;
 
 	active = READ_ONCE(ce->stats.active);

drivers/gpu/drm/i915/gt/intel_context.c void intel_context_bind_parent_child(struct intel_context *parent, · line 599

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.c +6 -1
-	if (active)
+	/*
+	 * When COPS_RUNTIME_ACTIVE_TOTAL is set for ce->cops, the backend
+	 * already provides the total active time of the context, so skip this
+	 * calculation when this flag is set.
+	 */
+	if (active && !(ce->ops->flags & COPS_RUNTIME_ACTIVE_TOTAL))
 		active = intel_context_clock() - active;
 
 	return total + active;

/snip/

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context.c +0 -0
@@ -1396,6 +1399,10 @@ static void guc_timestamp_ping(struct work_struct *wrk)
 	with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
 		__update_guc_busyness_stats(guc);
 
Quoted 10 lines

drivers/gpu/drm/i915/gt/intel_context.c static void guc_timestamp_ping(struct work_struct *wrk) · line 1404

Quoted 3 lines
drivers/gpu/drm/i915/gt/intel_context.c +3 -0
+	/* adjust context stats for overflow */
+	xa_for_each(&guc->context_lookup, index, ce)
+		__guc_context_update_clks(ce);

What is the reason for calling __guc_context_update_clks() periodically from guc_timestamp_ping() since it appears we should just be able to call __guc_context_update_clks() from intel_context_get_total_runtime_ns() to update 'active'? Is the reason for calling __guc_context_update_clks() periodically that the calculations in __guc_context_update_clks() become invalid if the counters overflow?

Correct, these are 32-bit counters and the worker just tracks overflow.

Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/i915/gt/intel_context.c +27 -0
+
 	intel_gt_reset_unlock(gt, srcu);
 
 	mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
@@ -1469,6 +1476,56 @@ void intel_guc_busyness_unpark(struct intel_gt *gt)
 			 guc->timestamp.ping_delay);
 }
 
+static void __guc_context_update_clks(struct intel_context *ce)
+{
+	struct intel_guc *guc = ce_to_guc(ce);
+	struct intel_gt *gt = ce->engine->gt;
+	u32 *pphwsp, last_switch, engine_id;
+	u64 start_gt_clk, active;
+	unsigned long flags;
+	ktime_t unused;
+
+	spin_lock_irqsave(&guc->timestamp.lock, flags);
+
+	/*
+	 * GPU updates ce->lrc_reg_state[CTX_TIMESTAMP] when context is switched
+	 * out, however GuC updates PPHWSP offsets below. Hence KMD (CPU)
+	 * relies on GuC and GPU for busyness calculations. Due to this, A
+	 * potential race was highlighted in an earlier review that can lead to
+	 * double accounting of busyness. While the solution to this is a wip,
+	 * busyness is still usable for platforms running GuC submission.
+	 */
+	pphwsp = ((void *)ce->lrc_reg_state) - LRC_STATE_OFFSET;
+	last_switch = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO]);
+	engine_id = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID]);
+
+	guc_update_pm_timestamp(guc, &unused);
+
+	if (engine_id != 0xffffffff && last_switch) {
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1509

Quoted 5 lines
drivers/gpu/drm/i915/gt/intel_context.c +5 -0
+		start_gt_clk = READ_ONCE(ce->stats.runtime.start_gt_clk);
+		__extend_last_switch(guc, &start_gt_clk, last_switch);
+		active = intel_gt_clock_interval_to_ns(gt, guc->timestamp.gt_stamp - start_gt_clk);
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, start_gt_clk);
+		WRITE_ONCE(ce->stats.active, active);

Should not need WRITE_ONCE to update regular memory. Not even sure we need READ_ONCE above.

Not sure I checked what they do. I was thinking these are needed for the memory ordering (as in be sure that start_gt_clk is updated before active).

Quoted 6 lines

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1511

Quoted 3 lines
drivers/gpu/drm/i915/gt/intel_context.c +2 -0
+	} else {
+		lrc_update_runtime(ce);

As was being discussed, should not need this here in this function. See below too.

In short, I added this here so that a query for busyness following idle can be obtained immediately. For GuC backend, the context is unpinned after disabling scheduling on that context and that is asynchronous. Also if there are more requests on that context, the scheduling may not be disabled and unpin may not happen, so updated runtime would only be seen much much later.

It is still safe to call from here because we know that the context is not active and has switched out. If it did switch in while we were reading this, that's still fine, we would only report the value stored in the context image.

Quoted 15 lines

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1521

Quoted 11 lines
drivers/gpu/drm/i915/gt/intel_context.c +10 -0
+	}
+
+	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
+}
+
+static void guc_context_update_stats(struct intel_context *ce)
+{
+	if (!intel_context_pin_if_active(ce)) {
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, 0);
+		WRITE_ONCE(ce->stats.active, 0);

Why do these need to be initialized to 0? Looks like the calculations in __guc_context_update_clks() will work even if we don't do this? Also I didn't follow the 'if (!intel_context_pin_if_active(ce))' check.

__guc_context_update_clks accesses the context image, so we need to make sure it's pinned. pin if active will not sleep/wait, so we can use it in this path.

if context is not active, then we update the active stats to 0.

Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/gt/intel_context.c +7 -0
+		return;
+	}
+
+	__guc_context_update_clks(ce);
+	intel_context_unpin(ce);
+}
+
 static inline bool
 submission_disabled(struct intel_guc *guc)
 {
@@ -2723,6 +2780,7 @@ static void guc_context_unpin(struct intel_context *ce)
 {
 	struct intel_guc *guc = cce_to_guc(ce);
 
Quoted 4 lines

drivers/gpu/drm/i915/gt/intel_context.c static void guc_context_unpin(struct intel_context *ce) · line 2783

Quoted 1 line
drivers/gpu/drm/i915/gt/intel_context.c +1 -0
+	lrc_update_runtime(ce);

How about moving this into lrc_unpin() since that gets called from all guc context types (parent/child/virtual).

looks like lrc_unpin is called from context_unpin path.

Same as above: for GuC, the context_unpin is an async operation and may not happen if there are multiple requests in queue.

Thanks,
Umesh

Quoted 57 lines
Quoted 57 lines
drivers/gpu/drm/i915/gt/intel_context.c +5 -0
 	unpin_guc_id(guc, ce);
 	lrc_unpin(ce);
 
@@ -3344,6 +3402,7 @@ static void remove_from_context(struct i915_request *rq)
 }
 
 static const struct intel_context_ops guc_context_ops = {
+	.flags = COPS_RUNTIME_CYCLES | COPS_RUNTIME_ACTIVE_TOTAL,
 	.alloc = guc_context_alloc,
 
 	.pre_pin = guc_context_pre_pin,
@@ -3360,6 +3419,8 @@ static const struct intel_context_ops guc_context_ops = {
 
 	.sched_disable = guc_context_sched_disable,
 
+	.update_stats = guc_context_update_stats,
+
 	.reset = lrc_reset,
 	.destroy = guc_context_destroy,
 
@@ -3593,6 +3654,7 @@ static int guc_virtual_context_alloc(struct intel_context *ce)
 }
 
 static const struct intel_context_ops virtual_guc_context_ops = {
+	.flags = COPS_RUNTIME_CYCLES | COPS_RUNTIME_ACTIVE_TOTAL,
 	.alloc = guc_virtual_context_alloc,
 
 	.pre_pin = guc_virtual_context_pre_pin,
@@ -3608,6 +3670,7 @@ static const struct intel_context_ops virtual_guc_context_ops = {
 	.exit = guc_virtual_context_exit,
 
 	.sched_disable = guc_context_sched_disable,
+	.update_stats = guc_context_update_stats,
 
 	.destroy = guc_context_destroy,
 
drivers/gpu/drm/i915/i915_drm_client.c +1 -6
index b09d1d386574..8d81119fff14 100644
@@ -147,11 +147,7 @@ void i915_drm_client_fdinfo(struct seq_file *m, struct file *f)
 		   PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
 	seq_printf(m, "drm-client-id:\t%u\n", client->id);
 
-	/*
-	 * Temporarily skip showing client engine information with GuC submission till
-	 * fetching engine busyness is implemented in the GuC submission backend
-	 */
-	if (GRAPHICS_VER(i915) < 8 || intel_uc_uses_guc_submission(&i915->gt0.uc))
+	if (GRAPHICS_VER(i915) < 8)
 		return;
 
 	for (i = 0; i < ARRAY_SIZE(uabi_class_names); i++)
--

2.37.1

#12 lore raw
Quoted 1 line · Umesh Nerlige Ramappa

Hi Umesh,

Just to communicate my thoughts I have posted this patch on top of your patch:

[1] https://patchwork.freedesktop.org/series/107983/

Could you please take a look at that and see if it makes sense.

Quoted 55 lines · Ashutosh
Quoted 43 lines · Umesh Nerlige Ramappa

Hi Umesh, I am fairly new to this code so some questions will be below will be newbie questions, thanks for bearing with me.

Quoted 21 lines
drivers/gpu/drm/i915/gt/intel_context.c +4 -1
index 654a092ed3d6..e2d70a9fdac0 100644
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent,
 	child->parallel.parent = parent;
 }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce)
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce)
 {
 	u64 total, active;
 
+	if (ce->ops->update_stats)
+		ce->ops->update_stats(ce);
+
 	total = ce->stats.runtime.total;
 	if (ce->ops->flags & COPS_RUNTIME_CYCLES)
 		total *= ce->engine->gt->clock_period_ns;
 
 	active = READ_ONCE(ce->stats.active);

drivers/gpu/drm/i915/gt/intel_context.c void intel_context_bind_parent_child(struct intel_context *parent, · line 599

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.c +6 -1
-	if (active)
+	/*
+	 * When COPS_RUNTIME_ACTIVE_TOTAL is set for ce->cops, the backend
+	 * already provides the total active time of the context, so skip this
+	 * calculation when this flag is set.
+	 */
+	if (active && !(ce->ops->flags & COPS_RUNTIME_ACTIVE_TOTAL))
 		active = intel_context_clock() - active;
 
 	return total + active;

/snip/

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context.c +0 -0
@@ -1396,6 +1399,10 @@ static void guc_timestamp_ping(struct work_struct *wrk)
 	with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
 		__update_guc_busyness_stats(guc);
 
Quoted 10 lines

drivers/gpu/drm/i915/gt/intel_context.c static void guc_timestamp_ping(struct work_struct *wrk) · line 1404

Quoted 3 lines
drivers/gpu/drm/i915/gt/intel_context.c +3 -0
+	/* adjust context stats for overflow */
+	xa_for_each(&guc->context_lookup, index, ce)
+		__guc_context_update_clks(ce);

What is the reason for calling __guc_context_update_clks() periodically from guc_timestamp_ping() since it appears we should just be able to call __guc_context_update_clks() from intel_context_get_total_runtime_ns() to update 'active'? Is the reason for calling __guc_context_update_clks() periodically that the calculations in __guc_context_update_clks() become invalid if the counters overflow?

Quoted 1 line

Correct, these are 32-bit counters and the worker just tracks overflow.

OK.

Quoted 45 lines
Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/i915/gt/intel_context.c +27 -0
+
 	intel_gt_reset_unlock(gt, srcu);
 
 	mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
@@ -1469,6 +1476,56 @@ void intel_guc_busyness_unpark(struct intel_gt *gt)
 			 guc->timestamp.ping_delay);
 }
 
+static void __guc_context_update_clks(struct intel_context *ce)
+{
+	struct intel_guc *guc = ce_to_guc(ce);
+	struct intel_gt *gt = ce->engine->gt;
+	u32 *pphwsp, last_switch, engine_id;
+	u64 start_gt_clk, active;
+	unsigned long flags;
+	ktime_t unused;
+
+	spin_lock_irqsave(&guc->timestamp.lock, flags);
+
+	/*
+	 * GPU updates ce->lrc_reg_state[CTX_TIMESTAMP] when context is switched
+	 * out, however GuC updates PPHWSP offsets below. Hence KMD (CPU)
+	 * relies on GuC and GPU for busyness calculations. Due to this, A
+	 * potential race was highlighted in an earlier review that can lead to
+	 * double accounting of busyness. While the solution to this is a wip,
+	 * busyness is still usable for platforms running GuC submission.
+	 */
+	pphwsp = ((void *)ce->lrc_reg_state) - LRC_STATE_OFFSET;
+	last_switch = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO]);
+	engine_id = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID]);
+
+	guc_update_pm_timestamp(guc, &unused);
+
+	if (engine_id != 0xffffffff && last_switch) {
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1509

Quoted 5 lines
drivers/gpu/drm/i915/gt/intel_context.c +5 -0
+		start_gt_clk = READ_ONCE(ce->stats.runtime.start_gt_clk);
+		__extend_last_switch(guc, &start_gt_clk, last_switch);
+		active = intel_gt_clock_interval_to_ns(gt, guc->timestamp.gt_stamp - start_gt_clk);
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, start_gt_clk);
+		WRITE_ONCE(ce->stats.active, active);

Should not need WRITE_ONCE to update regular memory. Not even sure we need READ_ONCE above.

Quoted 3 lines

Not sure I checked what they do. I was thinking these are needed for the memory ordering (as in be sure that start_gt_clk is updated before active).

As long as our operations are done under correct locks we don't have to worry about memory ordering. That is one of the reasons I am doing everything under the spinlock in [1].

Quoted 15 lines
Quoted 7 lines

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1511

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context.c +2 -0
+	} else {
+		lrc_update_runtime(ce);

As was being discussed, should not need this here in this function. See below too.

In short, I added this here so that a query for busyness following idle can be obtained immediately. For GuC backend, the context is unpinned after disabling scheduling on that context and that is asynchronous. Also if there are more requests on that context, the scheduling may not be disabled and unpin may not happen, so updated runtime would only be seen much much later.

Quoted 4 lines

It is still safe to call from here because we know that the context is not active and has switched out. If it did switch in while we were reading this, that's still fine, we would only report the value stored in the context image.

Agreed, but in [1] I have made this unconditional, not sure if you will agree or see problems with that.

Quoted 17 lines
Quoted 16 lines

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1521

Quoted 12 lines
drivers/gpu/drm/i915/gt/intel_context.c +10 -0
+	}
+
+	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
+}
+
+static void guc_context_update_stats(struct intel_context *ce)
+{
+	if (!intel_context_pin_if_active(ce)) {
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, 0);
+		WRITE_ONCE(ce->stats.active, 0);

Why do these need to be initialized to 0? Looks like the calculations in __guc_context_update_clks() will work even if we don't do this? Also I didn't follow the 'if (!intel_context_pin_if_active(ce))' check.

Quoted 3 lines

__guc_context_update_clks accesses the context image, so we need to make sure it's pinned. pin if active will not sleep/wait, so we can use it in this path.

I have added pinning in [1].

Quoted 1 line

if context is not active, then we update the active stats to 0.

In [1] active is just a local variable and I don't touch ce->stats.active at all.

Quoted 19 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/gt/intel_context.c +7 -0
+		return;
+	}
+
+	__guc_context_update_clks(ce);
+	intel_context_unpin(ce);
+}
+
 static inline bool
 submission_disabled(struct intel_guc *guc)
 {
@@ -2723,6 +2780,7 @@ static void guc_context_unpin(struct intel_context *ce)
 {
 	struct intel_guc *guc = cce_to_guc(ce);
 
Quoted 4 lines

drivers/gpu/drm/i915/gt/intel_context.c static void guc_context_unpin(struct intel_context *ce) · line 2783

Quoted 1 line
drivers/gpu/drm/i915/gt/intel_context.c +1 -0
+	lrc_update_runtime(ce);

How about moving this into lrc_unpin() since that gets called from all guc context types (parent/child/virtual).

Quoted 4 lines

looks like lrc_unpin is called from context_unpin path.

Same as above: for GuC, the context_unpin is an async operation and may not happen if there are multiple requests in queue.

In [1] I have left lrc_unpin in guc_context_unpin but changed to lrc_update_runtime_locked.

Thanks.
--
Ashutosh

#13 lore raw
Quoted 139 lines · Ashutosh
Quoted 1 line · Umesh Nerlige Ramappa

Hi Umesh,

Just to communicate my thoughts I have posted this patch on top of your patch:

[1] https://patchwork.freedesktop.org/series/107983/

Could you please take a look at that and see if it makes sense.

Quoted 55 lines · Ashutosh
Quoted 43 lines · Umesh Nerlige Ramappa

Hi Umesh, I am fairly new to this code so some questions will be below will be newbie questions, thanks for bearing with me.

Quoted 21 lines
drivers/gpu/drm/i915/gt/intel_context.c +4 -1
index 654a092ed3d6..e2d70a9fdac0 100644
@@ -576,16 +576,24 @@ void intel_context_bind_parent_child(struct intel_context *parent,
 	child->parallel.parent = parent;
 }
 
-u64 intel_context_get_total_runtime_ns(const struct intel_context *ce)
+u64 intel_context_get_total_runtime_ns(struct intel_context *ce)
 {
 	u64 total, active;
 
+	if (ce->ops->update_stats)
+		ce->ops->update_stats(ce);
+
 	total = ce->stats.runtime.total;
 	if (ce->ops->flags & COPS_RUNTIME_CYCLES)
 		total *= ce->engine->gt->clock_period_ns;
 
 	active = READ_ONCE(ce->stats.active);

drivers/gpu/drm/i915/gt/intel_context.c void intel_context_bind_parent_child(struct intel_context *parent, · line 599

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.c +6 -1
-	if (active)
+	/*
+	 * When COPS_RUNTIME_ACTIVE_TOTAL is set for ce->cops, the backend
+	 * already provides the total active time of the context, so skip this
+	 * calculation when this flag is set.
+	 */
+	if (active && !(ce->ops->flags & COPS_RUNTIME_ACTIVE_TOTAL))
 		active = intel_context_clock() - active;
 
 	return total + active;

/snip/

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context.c +0 -0
@@ -1396,6 +1399,10 @@ static void guc_timestamp_ping(struct work_struct *wrk)
 	with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
 		__update_guc_busyness_stats(guc);
 
Quoted 10 lines

drivers/gpu/drm/i915/gt/intel_context.c static void guc_timestamp_ping(struct work_struct *wrk) · line 1404

Quoted 3 lines
drivers/gpu/drm/i915/gt/intel_context.c +3 -0
+	/* adjust context stats for overflow */
+	xa_for_each(&guc->context_lookup, index, ce)
+		__guc_context_update_clks(ce);

What is the reason for calling __guc_context_update_clks() periodically from guc_timestamp_ping() since it appears we should just be able to call __guc_context_update_clks() from intel_context_get_total_runtime_ns() to update 'active'? Is the reason for calling __guc_context_update_clks() periodically that the calculations in __guc_context_update_clks() become invalid if the counters overflow?

Quoted 1 line

Correct, these are 32-bit counters and the worker just tracks overflow.

OK.

Quoted 45 lines
Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/i915/gt/intel_context.c +27 -0
+
 	intel_gt_reset_unlock(gt, srcu);
 
 	mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
@@ -1469,6 +1476,56 @@ void intel_guc_busyness_unpark(struct intel_gt *gt)
 			 guc->timestamp.ping_delay);
 }
 
+static void __guc_context_update_clks(struct intel_context *ce)
+{
+	struct intel_guc *guc = ce_to_guc(ce);
+	struct intel_gt *gt = ce->engine->gt;
+	u32 *pphwsp, last_switch, engine_id;
+	u64 start_gt_clk, active;
+	unsigned long flags;
+	ktime_t unused;
+
+	spin_lock_irqsave(&guc->timestamp.lock, flags);
+
+	/*
+	 * GPU updates ce->lrc_reg_state[CTX_TIMESTAMP] when context is switched
+	 * out, however GuC updates PPHWSP offsets below. Hence KMD (CPU)
+	 * relies on GuC and GPU for busyness calculations. Due to this, A
+	 * potential race was highlighted in an earlier review that can lead to
+	 * double accounting of busyness. While the solution to this is a wip,
+	 * busyness is still usable for platforms running GuC submission.
+	 */
+	pphwsp = ((void *)ce->lrc_reg_state) - LRC_STATE_OFFSET;
+	last_switch = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_STAMP_LO]);
+	engine_id = READ_ONCE(pphwsp[PPHWSP_GUC_CONTEXT_USAGE_ENGINE_ID]);
+
+	guc_update_pm_timestamp(guc, &unused);
+
+	if (engine_id != 0xffffffff && last_switch) {
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1509

Quoted 5 lines
drivers/gpu/drm/i915/gt/intel_context.c +5 -0
+		start_gt_clk = READ_ONCE(ce->stats.runtime.start_gt_clk);
+		__extend_last_switch(guc, &start_gt_clk, last_switch);
+		active = intel_gt_clock_interval_to_ns(gt, guc->timestamp.gt_stamp - start_gt_clk);
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, start_gt_clk);
+		WRITE_ONCE(ce->stats.active, active);

Should not need WRITE_ONCE to update regular memory. Not even sure we need READ_ONCE above.

Quoted 3 lines

Not sure I checked what they do. I was thinking these are needed for the memory ordering (as in be sure that start_gt_clk is updated before active).

As long as our operations are done under correct locks we don't have to worry about memory ordering. That is one of the reasons I am doing everything under the spinlock in [1].

Quoted 15 lines
Quoted 7 lines

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1511

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context.c +2 -0
+	} else {
+		lrc_update_runtime(ce);

As was being discussed, should not need this here in this function. See below too.

In short, I added this here so that a query for busyness following idle can be obtained immediately. For GuC backend, the context is unpinned after disabling scheduling on that context and that is asynchronous. Also if there are more requests on that context, the scheduling may not be disabled and unpin may not happen, so updated runtime would only be seen much much later.

Quoted 7 lines
Quoted 4 lines

It is still safe to call from here because we know that the context is not active and has switched out. If it did switch in while we were reading this, that's still fine, we would only report the value stored in the context image.

Agreed, but in [1] I have made this unconditional, not sure if you will agree or see problems with that.

That would get called every second (default intel_gpu_top query internal) for a long running workload. multiply that with all active contexts.

Quoted 48 lines
Quoted 18 lines
Quoted 17 lines

drivers/gpu/drm/i915/gt/intel_context.c void intel_guc_busyness_unpark(struct intel_gt *gt) · line 1521

Quoted 13 lines
drivers/gpu/drm/i915/gt/intel_context.c +10 -0
+	}
+
+	spin_unlock_irqrestore(&guc->timestamp.lock, flags);
+}
+
+static void guc_context_update_stats(struct intel_context *ce)
+{
+	if (!intel_context_pin_if_active(ce)) {
+		WRITE_ONCE(ce->stats.runtime.start_gt_clk, 0);
+		WRITE_ONCE(ce->stats.active, 0);

Why do these need to be initialized to 0? Looks like the calculations in __guc_context_update_clks() will work even if we don't do this? Also I didn't follow the 'if (!intel_context_pin_if_active(ce))' check.

Quoted 3 lines

__guc_context_update_clks accesses the context image, so we need to make sure it's pinned. pin if active will not sleep/wait, so we can use it in this path.

I have added pinning in [1].

Quoted 1 line

if context is not active, then we update the active stats to 0.

In [1] active is just a local variable and I don't touch ce->stats.active at all.

Quoted 19 lines
Quoted 18 lines
Quoted 11 lines
drivers/gpu/drm/i915/gt/intel_context.c +7 -0
+		return;
+	}
+
+	__guc_context_update_clks(ce);
+	intel_context_unpin(ce);
+}
+
 static inline bool
 submission_disabled(struct intel_guc *guc)
 {

drivers/gpu/drm/i915/gt/intel_context.c static void guc_context_unpin(struct intel_context *ce) · line 2783

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context.c +1 -0
@@ -2723,6 +2780,7 @@ static void guc_context_unpin(struct intel_context *ce)
 {
 	struct intel_guc *guc = cce_to_guc(ce);
 
+	lrc_update_runtime(ce);

How about moving this into lrc_unpin() since that gets called from all guc context types (parent/child/virtual).

Quoted 7 lines
Quoted 4 lines

looks like lrc_unpin is called from context_unpin path.

Same as above: for GuC, the context_unpin is an async operation and may not happen if there are multiple requests in queue.

In [1] I have left lrc_unpin in guc_context_unpin but changed to lrc_update_runtime_locked.

From your rfc patch, I like
- the idea of not touching ce->stats.active
- having the update_stats return u64
- not doing a rmw for start_gt_clk

With those changes, we are only accessing total in ce->stats, so we don't really need a lrc_update_runtime_locked.

Thanks,
Umesh

Quoted 4 lines

Thanks.
--
Ashutosh