Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt 1/2] igt/pm_rc6_residency: Replace hard-coded sleep before rc6 with a probe
@ 2017-12-05 10:56 Chris Wilson
  2017-12-05 10:56 ` [PATCH igt 2/2] igt/perf_pmu: " Chris Wilson
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Chris Wilson @ 2017-12-05 10:56 UTC (permalink / raw)
  To: intel-gfx

Instead of trying to sleep for 2 evaluations intervals and then assuming
that rc6 is working, poll the rc6 residency instead.

References: https://bugs.freedesktop.org/show_bug.cgi?id=104099
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tests/pm_rc6_residency.c | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index 3f6860199..16f4b1421 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -122,9 +122,6 @@ static void measure_residencies(int devid, unsigned int mask,
 	struct residencies end = { };
 	int retry;
 
-	if (!mask)
-		return;
-
 	/*
 	 * Retry in case of counter wrap-around. We simply re-run the
 	 * measurement, since the valid counter range is different on
@@ -168,17 +165,18 @@ static void measure_residencies(int devid, unsigned int mask,
 	res->rc6 += res->rc6p;
 }
 
-static unsigned long rc6_enable_us(void)
+static bool wait_for_rc6(void)
 {
-	/*
-	 * To know how long we need to wait for the device to enter rc6 once
-	 * idle, we need to look at GEN6_RC_EVALUATION_INTERVAL. Currently,
-	 * this is set to 125000 (12500 * 1280ns or 0.16s) on all platforms.
-	 * We must complete at least one EI with activity below the
-	 * per-platform threshold for RC6 to kick. Therefore, we must wait
-	 * at least 2 EI cycles, before we can expect rc6 to start ticking.
-	 */
-	return 2 * 160 * 1000;
+	struct timespec tv = {};
+	unsigned long start, now;
+
+	start = read_rc6_residency("rc6");
+	do {
+		usleep(50);
+		now = read_rc6_residency("rc6");
+	} while (now == start && !igt_seconds_elapsed(&tv));
+
+	return now != start;
 }
 
 igt_main
@@ -198,19 +196,17 @@ igt_main
 
 		/* Make sure rc6 counters are running */
 		igt_drop_caches_set(fd, DROP_IDLE);
-		usleep(rc6_enable_us());
+		igt_require(wait_for_rc6());
 
 		close(fd);
 
 		rc6_enabled = get_rc6_enabled_mask();
-		igt_require(rc6_enabled);
+		igt_require(rc6_enabled & RC6_ENABLED);
 	}
 
 	igt_subtest("rc6-accuracy") {
 		struct residencies res;
 
-		igt_require(rc6_enabled & RC6_ENABLED);
-
 		measure_residencies(devid, rc6_enabled, &res);
 		residency_accuracy(res.rc6, res.duration, "rc6");
 	}
@@ -218,8 +214,7 @@ igt_main
 	igt_subtest("media-rc6-accuracy") {
 		struct residencies res;
 
-		igt_require((rc6_enabled & RC6_ENABLED) &&
-			    (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)));
+		igt_require(IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid));
 
 		measure_residencies(devid, rc6_enabled, &res);
 		residency_accuracy(res.media_rc6, res.duration, "media_rc6");
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-05 12:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-05 10:56 [PATCH igt 1/2] igt/pm_rc6_residency: Replace hard-coded sleep before rc6 with a probe Chris Wilson
2017-12-05 10:56 ` [PATCH igt 2/2] igt/perf_pmu: " Chris Wilson
2017-12-05 12:05   ` Tvrtko Ursulin
2017-12-05 12:16     ` Chris Wilson
2017-12-05 11:51 ` ✓ Fi.CI.BAT: success for series starting with [1/2] igt/pm_rc6_residency: " Patchwork
2017-12-05 12:12 ` [PATCH igt 1/2] " Tvrtko Ursulin
2017-12-05 12:53 ` ✗ Fi.CI.IGT: warning for series starting with [1/2] " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox