[Intel-gfx] [PATCH igt] igt/perf_pmu: Tweak wait_for_rc6, yet again

Chris Wilson chris at chris-wilson.co.uk
Wed Dec 6 23:12:22 UTC 2017


Still CI remains obstinate that RC6 is not smoothly incrementing during
the sample period. Tweak the wait_for_rc6() to first wait for the
initial Evaluation Interval before polling.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 tests/perf_pmu.c         | 15 +++++++++++----
 tests/pm_rc6_residency.c | 15 +++++++++++----
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index ff6568221..917832d1b 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -1000,13 +1000,20 @@ static bool wait_for_rc6(int fd)
 	struct timespec tv = {};
 	uint64_t start, now;
 
-	start = pmu_read_single(fd);
+	/* First wait for roughly an RC6 Evaluation Interval */
+	usleep(160 * 1000);
+
+	/* Then poll for RC6 to start ticking */
+	now = pmu_read_single(fd);
 	do {
-		usleep(50);
+		start = now;
+		usleep(5000);
 		now = pmu_read_single(fd);
-	} while (start == now && !igt_seconds_elapsed(&tv));
+		if (now - start > 2e6)
+			return true;
+	} while (!igt_seconds_elapsed(&tv));
 
-	return start != now;
+	return false;
 }
 
 static void
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index 16f4b1421..7cc62dac8 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -170,13 +170,20 @@ static bool wait_for_rc6(void)
 	struct timespec tv = {};
 	unsigned long start, now;
 
-	start = read_rc6_residency("rc6");
+	/* First wait for roughly an RC6 Evaluation Interval */
+        usleep(160 * 1000);
+
+        /* Then poll for RC6 to start ticking */
+	now = read_rc6_residency("rc6");
 	do {
-		usleep(50);
+		start = now;
+		usleep(5000);
 		now = read_rc6_residency("rc6");
-	} while (now == start && !igt_seconds_elapsed(&tv));
+		if (now - start > 2)
+			return true;
+	} while (!igt_seconds_elapsed(&tv));
 
-	return now != start;
+	return false;
 }
 
 igt_main
-- 
2.15.1



More information about the Intel-gfx mailing list