Skip to contentSkip to conversation

drm/i915/selftests: Verify frequency scaling with RPS

PATCH New Chris Wilson 2 participants 6 messages Apr 19, 2020

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

PATCH 1/4 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   | 243 +++++++++++++++++++++--
 drivers/gpu/drm/i915/gt/selftest_rps.h   |   1 +
 3 files changed, 234 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 +231 -12

261 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/4 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 380a65ca1cae..67c287282d38 100644
@@ -479,26 +479,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);
@@ -536,7 +531,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;
@@ -559,16 +557,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/4 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/4 drm/i915/gt: Convert gen9+ frequency range to 50MHz increments

In reply to Chris Wilson

The RPS bins are in units of 33MHz, so if we want 50MHz increments, we need 2/3, not 1/3!

---
 drivers/gpu/drm/i915/gt/intel_llc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_llc.c +4 -2
index e3f637b3650e..474d82a52859 100644
@@ -67,8 +67,10 @@ static bool get_ia_constants(struct intel_llc *llc,
 	consts->max_gpu_freq = rps->max_freq;
 	if (INTEL_GEN(i915) >= 9) {
 		/* Convert GT frequency to 50 HZ units */
-		consts->min_gpu_freq /= GEN9_FREQ_SCALER;
-		consts->max_gpu_freq /= GEN9_FREQ_SCALER;
+		consts->min_gpu_freq =
+			mult_frac(consts->min_gpu_freq, 2, GEN9_FREQ_SCALER);
+		consts->max_gpu_freq =
+			mult_frac(consts->max_gpu_freq, 2, GEN9_FREQ_SCALER);
 	}
 
 	return true;
Signature · 6 lines
2.20.1

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

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

In reply to Chris Wilson
== Series Details ==

== Series Details ==

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

== Summary ==

$ make htmldocs 2>&1 > /dev/null | grep i915
/home/cidrm/kernel/Documentation/gpu/i915.rst:610: WARNING: duplicate label gpu/i915:layout, other instance in /home/cidrm/kernel/Documentation/gpu/i915.rst

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

#5 lore raw

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

In reply to Chris Wilson
== Series Details ==

== Series Details ==

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

== Summary ==

CI Bug Log - changes from CI_DRM_8323 -> Patchwork_17371
====================================================

Summary
-------

**FAILURE**

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

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

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

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

### 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_8323/fi-icl-y/igt@i915_selftest@live@gt_pm.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-icl-y/igt@i915_selftest@live@gt_pm.html
- fi-cfl-8109u: [PASS][3] -> [DMESG-FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8323/fi-cfl-8109u/igt@i915_selftest@live@gt_pm.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-cfl-8109u/igt@i915_selftest@live@gt_pm.html

#### Warnings ####

* igt@i915_selftest@live@gt_pm:
- fi-tgl-y: [DMESG-FAIL][5] ([i915#1725]) -> [DMESG-FAIL][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8323/fi-tgl-y/igt@i915_selftest@live@gt_pm.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-tgl-y/igt@i915_selftest@live@gt_pm.html
- fi-kbl-soraka: [DMESG-FAIL][7] ([i915#1744]) -> [DMESG-FAIL][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8323/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-kbl-soraka/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-tgl-dsi}: [DMESG-FAIL][9] ([i915#1725]) -> [DMESG-FAIL][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8323/fi-tgl-dsi/igt@i915_selftest@live@gt_pm.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-tgl-dsi/igt@i915_selftest@live@gt_pm.html
- {fi-tgl-u}: [DMESG-FAIL][11] ([i915#1725]) -> [DMESG-FAIL][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8323/fi-tgl-u/igt@i915_selftest@live@gt_pm.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-tgl-u/igt@i915_selftest@live@gt_pm.html

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rpm@module-reload:
- fi-kbl-guc: [PASS][13] -> [FAIL][14] ([i915#579])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8323/fi-kbl-guc/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-kbl-guc/igt@[email protected]

* igt@i915_selftest@live@workarounds:
- fi-bwr-2160: [PASS][15] -> [INCOMPLETE][16] ([i915#489])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8323/fi-bwr-2160/igt@i915_selftest@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-bwr-2160/igt@i915_selftest@[email protected]

#### Possible fixes ####

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-skl-6770hq: [FAIL][17] ([fdo#103375]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8323/fi-skl-6770hq/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-skl-6770hq/igt@[email protected]

#### Warnings ####

* igt@i915_pm_rpm@module-reload:
- fi-kbl-x1275: [SKIP][19] ([fdo#109271]) -> [FAIL][20] ([i915#62])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8323/fi-kbl-x1275/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17371/fi-kbl-x1275/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#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[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
[i915#489]: https://gitlab.freedesktop.org/drm/intel/issues/489
[i915#579]: https://gitlab.freedesktop.org/drm/intel/issues/579
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62

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

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

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_8323 -> Patchwork_17371

CI-20190529: 20190529
CI_DRM_8323: 65545bfa1e4f92bb86462bf7226b8a33d13715a1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5599: cdb07101dda33e2fcb0f4c2aa199c47159d88f35 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17371: e83f3356349df00bcb14f1e42969d764d8f45de8 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

e83f3356349d drm/i915/gt: Convert gen9+ frequency range to 50MHz increments 0abd90294f86 drm/i915/selftests: Check RPS controls
9d5ef5015e3a drm/i915/selftests: Skip energy consumption tests if not controlling freq ba330b589188 drm/i915/selftests: Verify frequency scaling with RPS

== Logs ==

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