[Intel-gfx] [PATCH i-g-t] i915/perf_pmu: Verify RC6 measurements before/after suspend

Chris Wilson chris at chris-wilson.co.uk
Fri Dec 11 14:39:09 UTC 2020


RC6 should work before suspend, and continue to increment while idle
after suspend. Should.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 tests/i915/perf_pmu.c | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/tests/i915/perf_pmu.c b/tests/i915/perf_pmu.c
index cb7273142..29119b236 100644
--- a/tests/i915/perf_pmu.c
+++ b/tests/i915/perf_pmu.c
@@ -170,6 +170,7 @@ static unsigned int measured_usleep(unsigned int usec)
 #define TEST_RUNTIME_PM (8)
 #define FLAG_LONG (16)
 #define FLAG_HANG (32)
+#define TEST_S3 (64)
 
 static igt_spin_t * __spin_poll(int fd, uint32_t ctx,
 				const struct intel_execution_engine2 *e)
@@ -1639,12 +1640,34 @@ test_rc6(int gem_fd, unsigned int flags)
 	igt_require(wait_for_rc6(fd));
 
 	/* While idle check full RC6. */
-	prev = __pmu_read_single(fd, &ts[0]);
-	slept = measured_usleep(duration_ns / 1000);
-	idle = __pmu_read_single(fd, &ts[1]);
-	igt_debug("slept=%lu perf=%"PRIu64"\n", slept, ts[1] - ts[0]);
+	for (int pass = 0; pass < 3; pass++) {
+		prev = __pmu_read_single(fd, &ts[0]);
+		slept = measured_usleep(duration_ns / 1000);
+		idle = __pmu_read_single(fd, &ts[1]);
+
+		igt_debug("slept=%lu perf=%"PRIu64"\n", slept, ts[1] - ts[0]);
+		assert_within_epsilon(idle - prev, ts[1] - ts[0], tolerance);
+	}
+
+	if (flags & TEST_S3) {
+		prev = __pmu_read_single(fd, &ts[0]);
+		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
+					      SUSPEND_TEST_NONE);
+		idle = __pmu_read_single(fd, &ts[1]);
+		igt_debug("suspend=%"PRIu64"\n", ts[1] - ts[0]);
+		//assert_within_epsilon(idle - prev, ts[1] - ts[0], tolerance);
+	}
 
-	assert_within_epsilon(idle - prev, ts[1] - ts[0], tolerance);
+	igt_assert(wait_for_rc6(fd));
+
+	for (int pass = 0; pass < 3; pass++) {
+		prev = __pmu_read_single(fd, &ts[0]);
+		slept = measured_usleep(duration_ns / 1000);
+		idle = __pmu_read_single(fd, &ts[1]);
+
+		igt_debug("slept=%lu perf=%"PRIu64"\n", slept, ts[1] - ts[0]);
+		assert_within_epsilon(idle - prev, ts[1] - ts[0], tolerance);
+	}
 
 	/* Wake up device and check no RC6. */
 	fw = igt_open_forcewake_handle(gem_fd);
@@ -2245,6 +2268,9 @@ igt_main
 	igt_subtest("rc6-runtime-pm-long")
 		test_rc6(fd, TEST_RUNTIME_PM | FLAG_LONG);
 
+	igt_subtest("rc6-suspend")
+		test_rc6(fd, TEST_S3);
+
 	/**
 	 * Check render nodes are counted.
 	 */
-- 
2.29.2



More information about the Intel-gfx mailing list