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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 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

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux