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

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 9 14:32:32 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 | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index 01eeaa307..42a41c833 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;
@@ -201,6 +210,8 @@ igt_main
 		devid = intel_get_drm_devid(fd);
 		sysfs = igt_sysfs_open(fd, NULL);
 
+		igt_require(has_rc6_residency("rc6"));
+
 		/* Make sure rc6 counters are running */
 		igt_drop_caches_set(fd, DROP_IDLE);
 		igt_require(wait_for_rc6());
-- 
2.16.1



More information about the igt-dev mailing list