Skip to contentSkip to conversation

drm/i915/selftests: Verify frequency scaling with RPS

PATCH New Chris Wilson 2 participants 8 messages Apr 20, 2020

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

PATCH 1/6 drm/i915/selftests: Verify frequency scaling with RPS

One of the core tenents of reclocking the GPU is that its throughput scales with the clock frequency. We can observe this by incrementing a loop counter on the GPU, and compare the different execution rates at the notional RPS frequencies.

---
 drivers/gpu/drm/i915/gt/selftest_gt_pm.c |   3 +-
 drivers/gpu/drm/i915/gt/selftest_rps.c   | 249 +++++++++++++++++++++--
 drivers/gpu/drm/i915/gt/selftest_rps.h   |   1 +
 3 files changed, 240 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/gt/selftest_gt_pm.c +2 -1
index 0141c334f2ac..4b2733967c42 100644
@@ -53,8 +53,9 @@ int intel_gt_pm_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
 		SUBTEST(live_rc6_manual),
-		SUBTEST(live_rps_interrupt),
+		SUBTEST(live_rps_frequency),
 		SUBTEST(live_rps_power),
+		SUBTEST(live_rps_interrupt),
 		SUBTEST(live_gt_resume),
 	};
 
drivers/gpu/drm/i915/gt/selftest_rps.c +237 -12

267 lines not on this page · raw message

drivers/gpu/drm/i915/gt/selftest_rps.h +1 -0
index cad515a7f0e5..07c2bddf8899 100644
@@ -6,6 +6,7 @@
 #ifndef SELFTEST_RPS_H
 #define SELFTEST_RPS_H
 
+int live_rps_frequency(void *arg);
 int live_rps_interrupt(void *arg);
 int live_rps_power(void *arg);
 
Signature · 6 lines
2.20.1

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

PATCH 2/6 drm/i915/selftests: Skip energy consumption tests if not controlling freq

If we can not manipulate the frequency with RPS, then comparing min/max power consumption is pointless / misleading. We will leave the warning about not being able to control the frequency selection via RPS to other tests so as not to confuse this more specialised check.

---
 drivers/gpu/drm/i915/gt/selftest_rps.c | 37 ++++++++++++++++----------
 1 file changed, 23 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gt/selftest_rps.c +23 -14
index b1a435db1edc..149a3de86cb9 100644
@@ -485,26 +485,21 @@ static u64 __measure_power(int duration_ms)
 	return div64_u64(1000 * 1000 * dE, dt);
 }
 
-static u64 measure_power_at(struct intel_rps *rps, int freq)
+static u64 measure_power_at(struct intel_rps *rps, int *freq)
 {
 	u64 x[5];
 	int i;
 
 	mutex_lock(&rps->lock);
 	GEM_BUG_ON(!rps->active);
-	intel_rps_set(rps, freq);
+	intel_rps_set(rps, *freq);
 	mutex_unlock(&rps->lock);
 
 	msleep(20); /* more than enough time to stabilise! */
 
-	i = read_cagf(rps);
-	if (i != freq)
-		pr_notice("Running at %x [%uMHz], not target %x [%uMHz]\n",
-			  i, intel_gpu_freq(rps, i),
-			  freq, intel_gpu_freq(rps, freq));
-
 	for (i = 0; i < 5; i++)
 		x[i] = __measure_power(5);
+	*freq = read_cagf(rps);
 
 	/* A simple triangle filter for better result stability */
 	sort(x, 5, sizeof(*x), cmp_u64, NULL);
@@ -542,7 +537,10 @@ int live_rps_power(void *arg)
 
 	for_each_engine(engine, gt, id) {
 		struct i915_request *rq;
-		u64 min, max;
+		struct {
+			u64 power;
+			int freq;
+		} min, max;
 
 		if (!intel_engine_can_store_dword(engine))
 			continue;
@@ -565,16 +563,27 @@ int live_rps_power(void *arg)
 			break;
 		}
 
-		max = measure_power_at(rps, rps->max_freq);
-		min = measure_power_at(rps, rps->min_freq);
+		max.freq = rps->max_freq;
+		max.power = measure_power_at(rps, &max.freq);
+
+		min.freq = rps->min_freq;
+		min.power = measure_power_at(rps, &min.freq);
 
 		igt_spinner_end(&spin);
 
 		pr_info("%s: min:%llumW @ %uMHz, max:%llumW @ %uMHz\n",
 			engine->name,
-			min, intel_gpu_freq(rps, rps->min_freq),
-			max, intel_gpu_freq(rps, rps->max_freq));
-		if (11 * min > 10 * max) {
+			min.power, intel_gpu_freq(rps, min.freq),
+			max.power, intel_gpu_freq(rps, max.freq));
+
+		if (10 * min.freq >= 9 * max.freq) {
+			pr_notice("Could not control frequency, ran at [%d:%uMHz, %d:%uMhz]\n",
+				  min.freq, intel_gpu_freq(rps, min.freq),
+				  max.freq, intel_gpu_freq(rps, max.freq));
+			continue;
+		}
+
+		if (11 * min.power > 10 * max.power) {
 			pr_err("%s: did not conserve power when setting lower frequency!\n",
 			       engine->name);
 			err = -EINVAL;
Signature · 6 lines
2.20.1

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

PATCH 3/6 drm/i915/selftests: Check RPS controls

In reply to Chris Wilson

Check that the GPU does respond to our RPS frequency requests by setting our desired frequency.

---
 drivers/gpu/drm/i915/gt/selftest_gt_pm.c |   1 +
 drivers/gpu/drm/i915/gt/selftest_rps.c   | 196 ++++++++++++++++++++---
 drivers/gpu/drm/i915/gt/selftest_rps.h   |   1 +
 3 files changed, 174 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/gt/selftest_gt_pm.c +1 -0
index 4b2733967c42..de3eaef40596 100644
@@ -53,6 +53,7 @@ int intel_gt_pm_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
 		SUBTEST(live_rc6_manual),
+		SUBTEST(live_rps_control),
 		SUBTEST(live_rps_frequency),
 		SUBTEST(live_rps_power),
 		SUBTEST(live_rps_interrupt),
drivers/gpu/drm/i915/gt/selftest_rps.c +172 -24

230 lines not on this page · raw message

drivers/gpu/drm/i915/gt/selftest_rps.h +1 -0
index 07c2bddf8899..be0bf8e3f639 100644
@@ -6,6 +6,7 @@
 #ifndef SELFTEST_RPS_H
 #define SELFTEST_RPS_H
 
+int live_rps_control(void *arg);
 int live_rps_frequency(void *arg);
 int live_rps_interrupt(void *arg);
 int live_rps_power(void *arg);
Signature · 6 lines
2.20.1

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

PATCH 4/6 drm/i915/selftests: Split RPS frequency measurement

In reply to Chris Wilson

Split the frequency measurement into two modes, so that we can judge the impact of the llc setup on top of the pure CS frequency scaling.

---
 drivers/gpu/drm/i915/gt/selftest_gt_pm.c |   3 +-
 drivers/gpu/drm/i915/gt/selftest_rps.c   | 157 ++++++++++++++++++++++-
 drivers/gpu/drm/i915/gt/selftest_rps.h   |   3 +-
 3 files changed, 154 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gt/selftest_gt_pm.c +2 -1
index de3eaef40596..9855e6f0ce7c 100644
@@ -54,7 +54,8 @@ int intel_gt_pm_live_selftests(struct drm_i915_private *i915)
 	static const struct i915_subtest tests[] = {
 		SUBTEST(live_rc6_manual),
 		SUBTEST(live_rps_control),
-		SUBTEST(live_rps_frequency),
+		SUBTEST(live_rps_frequency_cs),
+		SUBTEST(live_rps_frequency_srm),
 		SUBTEST(live_rps_power),
 		SUBTEST(live_rps_interrupt),
 		SUBTEST(live_gt_resume),
drivers/gpu/drm/i915/gt/selftest_rps.c +150 -7

192 lines not on this page · raw message

drivers/gpu/drm/i915/gt/selftest_rps.h +2 -1
index be0bf8e3f639..22e46c5341c5 100644
@@ -7,7 +7,8 @@
 #define SELFTEST_RPS_H
 
 int live_rps_control(void *arg);
-int live_rps_frequency(void *arg);
+int live_rps_frequency_cs(void *arg);
+int live_rps_frequency_srm(void *arg);
 int live_rps_interrupt(void *arg);
 int live_rps_power(void *arg);
 
Signature · 6 lines
2.20.1

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

PATCH 5/6 drm/i915/selftests: Show the pcode frequency table on error

In reply to Chris Wilson

If we encounter an error while scaling, read back the frequency tables from the pcu.

---
 drivers/gpu/drm/i915/gt/selftest_rps.c | 39 ++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/gpu/drm/i915/gt/selftest_rps.c +39 -0
index dbca673519a2..5264ff86f235 100644
@@ -276,6 +276,43 @@ int live_rps_control(void *arg)
 	return err;
 }
 
+static void show_pcu_config(struct intel_rps *rps)
+{
+	struct drm_i915_private *i915 = rps_to_i915(rps);
+	unsigned int max_gpu_freq, min_gpu_freq;
+	intel_wakeref_t wakeref;
+	int gpu_freq;
+
+	if (!HAS_LLC(i915))
+		return;
+
+	min_gpu_freq = rps->min_freq;
+	max_gpu_freq = rps->max_freq;
+	if (INTEL_GEN(i915) >= 9) {
+		/* Convert GT frequency to 50 HZ units */
+		min_gpu_freq /= GEN9_FREQ_SCALER;
+		max_gpu_freq /= GEN9_FREQ_SCALER;
+	}
+
+	wakeref = intel_runtime_pm_get(rps_to_uncore(rps)->rpm);
+
+	pr_info("%5s  %5s  %5s\n", "GPU", "eCPU", "eRing");
+	for (gpu_freq = min_gpu_freq; gpu_freq <= max_gpu_freq; gpu_freq++) {
+		int ia_freq = gpu_freq;
+
+		sandybridge_pcode_read(i915,
+				       GEN6_PCODE_READ_MIN_FREQ_TABLE,
+				       &ia_freq, NULL);
+
+		pr_info("%5d  %5d  %5d\n",
+			gpu_freq * 50,
+			((ia_freq >> 0) & 0xff) * 100,
+			((ia_freq >> 8) & 0xff) * 100);
+	}
+
+	intel_runtime_pm_put(rps_to_uncore(rps)->rpm, wakeref);
+}
+
 static u64 __measure_frequency(u32 *cntr, int duration_ms)
 {
 	u64 dc, dt;
@@ -428,6 +465,7 @@ int live_rps_frequency_cs(void *arg)
 			       engine->name,
 			       max.freq * min.count,
 			       min.freq * max.count);
+			show_pcu_config(rps);
 			err = -EINVAL;
 		}
 
@@ -536,6 +574,7 @@ int live_rps_frequency_srm(void *arg)
 			       engine->name,
 			       max.freq * min.count,
 			       min.freq * max.count);
+			show_pcu_config(rps);
 			err = -EINVAL;
 		}
 
Signature · 6 lines
2.20.1

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

PATCH 6/6 drm/i915/selftests: Exercise dynamic reclocking with RPS

In reply to Chris Wilson

After having testing all the RPS controls individually, we need to take a step back and check how our RPS worker integrates them to perform dynamic GPU reclocking. So do that by submitting a spinner and wait and see what happens.

---
 drivers/gpu/drm/i915/gt/selftest_gt_pm.c |   1 +
 drivers/gpu/drm/i915/gt/selftest_rps.c   | 112 +++++++++++++++++++++--
 drivers/gpu/drm/i915/gt/selftest_rps.h   |   3 +-
 3 files changed, 105 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/gt/selftest_gt_pm.c +1 -0
index 9855e6f0ce7c..e02fdec58826 100644
@@ -58,6 +58,7 @@ int intel_gt_pm_live_selftests(struct drm_i915_private *i915)
 		SUBTEST(live_rps_frequency_srm),
 		SUBTEST(live_rps_power),
 		SUBTEST(live_rps_interrupt),
+		SUBTEST(live_rps_dynamic),
 		SUBTEST(live_gt_resume),
 	};
 
drivers/gpu/drm/i915/gt/selftest_rps.c +102 -10

140 lines not on this page · raw message

drivers/gpu/drm/i915/gt/selftest_rps.h +2 -1
index 22e46c5341c5..76c4b19553e6 100644
@@ -9,7 +9,8 @@
 int live_rps_control(void *arg);
 int live_rps_frequency_cs(void *arg);
 int live_rps_frequency_srm(void *arg);
-int live_rps_interrupt(void *arg);
 int live_rps_power(void *arg);
+int live_rps_interrupt(void *arg);
+int live_rps_dynamic(void *arg);
 
 #endif /* SELFTEST_RPS_H */
Signature · 6 lines
2.20.1

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

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [CI,1/6] drm/i915/selftests: Verify frequency scaling with RPS

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: series starting with [CI,1/6] drm/i915/selftests: Verify frequency scaling with RPS
URL : https://patchwork.freedesktop.org/series/76207/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
18dc228e78a3 drm/i915/selftests: Verify frequency scaling with RPS
5596606385a1 drm/i915/selftests: Skip energy consumption tests if not controlling freq
8a8b4c6f9d90 drm/i915/selftests: Check RPS controls
094283df407d drm/i915/selftests: Split RPS frequency measurement
8b44ad32661e drm/i915/selftests: Show the pcode frequency table on error
5a1eb55b410f drm/i915/selftests: Exercise dynamic reclocking with RPS
-:113: ERROR:SPACING: space required after that ',' (ctx:VxV)
#113: FILE: drivers/gpu/drm/i915/gt/selftest_rps.c:969:
+		} min,max;
 		     ^

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

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

#7 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [CI,1/6] drm/i915/selftests: Verify frequency scaling with RPS

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: series starting with [CI,1/6] drm/i915/selftests: Verify frequency scaling with RPS
URL : https://patchwork.freedesktop.org/series/76207/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_8332 -> Patchwork_17387
====================================================

Summary
-------

**FAILURE**

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

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

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

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

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

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@gt_pm:
- fi-icl-y: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8332/fi-icl-y/igt@i915_selftest@live@gt_pm.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17387/fi-icl-y/igt@i915_selftest@live@gt_pm.html
- fi-skl-6600u: [PASS][3] -> [DMESG-FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8332/fi-skl-6600u/igt@i915_selftest@live@gt_pm.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17387/fi-skl-6600u/igt@i915_selftest@live@gt_pm.html
- fi-cfl-8109u: [PASS][5] -> [DMESG-FAIL][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8332/fi-cfl-8109u/igt@i915_selftest@live@gt_pm.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17387/fi-cfl-8109u/igt@i915_selftest@live@gt_pm.html
- fi-whl-u: [PASS][7] -> [DMESG-FAIL][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8332/fi-whl-u/igt@i915_selftest@live@gt_pm.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17387/fi-whl-u/igt@i915_selftest@live@gt_pm.html

#### Suppressed ####

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

* igt@i915_selftest@live@gt_pm:
- {fi-kbl-7560u}: NOTRUN -> [DMESG-FAIL][9]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17387/fi-kbl-7560u/igt@i915_selftest@live@gt_pm.html

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

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

### IGT changes ###

#### Possible fixes ####

* igt@kms_cursor_legacy@basic-flip-after-cursor-atomic:
- fi-skl-6770hq: [SKIP][10] ([fdo#109271]) -> [PASS][11] +20 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8332/fi-skl-6770hq/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17387/fi-skl-6770hq/igt@[email protected]

#### Warnings ####

* igt@i915_selftest@live@gt_pm:
- fi-tgl-y: [DMESG-FAIL][12] ([i915#1725]) -> [DMESG-FAIL][13] ([i915#1744])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8332/fi-tgl-y/igt@i915_selftest@live@gt_pm.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17387/fi-tgl-y/igt@i915_selftest@live@gt_pm.html

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

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1725]: https://gitlab.freedesktop.org/drm/intel/issues/1725
[i915#1744]: https://gitlab.freedesktop.org/drm/intel/issues/1744

Participating hosts (51 -> 44)
------------------------------

Missing (7): fi-cml-u2 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_8332 -> Patchwork_17387

CI-20190529: 20190529
CI_DRM_8332: ebfd6b831ffba0c7b50a59f228d236e92f4fa729 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5602: a8fcccd15dcc2dd409edd23785a2d6f6e85fb682 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17387: 5a1eb55b410f070470f539ee3432d5e1e1d71d33 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

5a1eb55b410f drm/i915/selftests: Exercise dynamic reclocking with RPS 8b44ad32661e drm/i915/selftests: Show the pcode frequency table on error 094283df407d drm/i915/selftests: Split RPS frequency measurement 8a8b4c6f9d90 drm/i915/selftests: Check RPS controls
5596606385a1 drm/i915/selftests: Skip energy consumption tests if not controlling freq 18dc228e78a3 drm/i915/selftests: Verify frequency scaling with RPS

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17387/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx