[igt-dev] [PATCH igt] igt/pm_rc6_residency: Check debugfs existence before reading

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 9 14:30:58 UTC 2018


During the startup, we try to determine if the system supports rc6 prior
to testing. However, the startup check asserts the residency debugfs
exists, instead of testing for a requirement.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/pm_rc6_residency.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index 01eeaa307..cd36f7378 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -60,6 +60,15 @@ static unsigned long get_rc6_enabled_mask(void)
 	return enabled;
 }
 
+static bool has_rc6_residency(const char *name)
+{
+	unsigned long residency;
+	char path[128];
+
+	sprintf(path, "power/%s_residency_ms", name);
+	return igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1;
+}
+
 static unsigned long read_rc6_residency(const char *name)
 {
 	unsigned long residency;
@@ -170,6 +179,9 @@ static bool wait_for_rc6(void)
 	struct timespec tv = {};
 	unsigned long start, now;
 
+	if (!has_rc6_residency("rc6"))
+		return false;
+
 	/* First wait for roughly an RC6 Evaluation Interval */
         usleep(160 * 1000);
 
-- 
2.16.1



More information about the igt-dev mailing list