[Intel-gfx] [PATCH 4/4 v2] pm_rps: Require that cur reaches min at idle

jeff.mcgee at intel.com jeff.mcgee at intel.com
Thu Jan 23 22:54:50 CET 2014


From: Jeff McGee <jeff.mcgee at intel.com>

The current frequency should reach the minimum frequency within a
reasonable time during idle.

v2: Not using forcewake for this particular subtest per Daniel's
    suggestion.

Signed-off-by: Jeff McGee <jeff.mcgee at intel.com>
---
 tests/pm_rps.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 7ae0438..24a1ad6 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -206,13 +206,27 @@ static void min_max_config(void (*check)(void))
 	check();
 }
 
+#define IDLE_WAIT_TIMESTEP_MSEC 100
+#define IDLE_WAIT_TIMEOUT_MSEC 3000
 static void idle_check(void)
 {
 	int freqs[NUMFREQ];
-
-	read_freqs(freqs);
-	dump(freqs);
-	checkit(freqs);
+	int wait = 0;
+
+	/* Monitor frequencies until cur settles down to min, which should
+	 * happen within the allotted time */
+	do {
+		read_freqs(freqs);
+		dump(freqs);
+		checkit(freqs);
+		if (freqs[CUR] == freqs[MIN])
+			break;
+		usleep(1000 * IDLE_WAIT_TIMESTEP_MSEC);
+		wait += IDLE_WAIT_TIMESTEP_MSEC;
+	} while (wait < IDLE_WAIT_TIMEOUT_MSEC);
+
+	igt_assert(freqs[CUR] == freqs[MIN]);
+	log("Required %d msec to reach cur=min\n", wait);
 }
 
 static void pm_rps_exit_handler(int sig)
-- 
1.8.5.2




More information about the Intel-gfx mailing list