diff mbox

[i-g-t] tests/pm_rc6_residency: Add subtest to check RC6 suspend handling

Message ID 20170424125523.3654-1-ewelina.musial@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Musial, Ewelina April 24, 2017, 12:55 p.m. UTC
In some cases we observed that forcewake isn't kept after
resume and then RC6 residency is not constant.

References: HSD#1804921797
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>
Signed-off-by: Ewelina Musial <ewelina.musial@intel.com>
---
 tests/pm_rc6_residency.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

Comments

Szwichtenberg, Radoslaw April 25, 2017, 9:10 a.m. UTC | #1
On Mon, 2017-04-24 at 14:55 +0200, Ewelina Musial wrote:
> In some cases we observed that forcewake isn't kept after

> resume and then RC6 residency is not constant.

> 

> References: HSD#1804921797

> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

> Cc: Michal Winiarski <michal.winiarski@intel.com>

> Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>

> Signed-off-by: Ewelina Musial <ewelina.musial@intel.com>

Reviewed-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
Michał Winiarski April 25, 2017, 10:44 a.m. UTC | #2
On Mon, Apr 24, 2017 at 02:55:23PM +0200, Ewelina Musial wrote:
> In some cases we observed that forcewake isn't kept after
> resume and then RC6 residency is not constant.
> 
> References: HSD#1804921797
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>
> Signed-off-by: Ewelina Musial <ewelina.musial@intel.com>

Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>

-Michał

> ---
>  tests/pm_rc6_residency.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
Chris Wilson April 25, 2017, 10:54 a.m. UTC | #3
On Mon, Apr 24, 2017 at 02:55:23PM +0200, Ewelina Musial wrote:
> In some cases we observed that forcewake isn't kept after
> resume and then RC6 residency is not constant.

This test only asks whether the debugfs/forcewake-user is kept across
resume. What benefit does this have over the existing tests?

P.S. Please keep to the kernel CodingStyle for igt.
-Chris
diff mbox

Patch

diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index bdb9747..4e61326 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -165,6 +165,44 @@  static void measure_residencies(int devid, unsigned int rc6_mask,
 	res->rc6 += res->rc6p;
 }
 
+enum sleep_state { NOSLEEP, SUSPEND, HIBERNATE };
+static void test_rc6_forcewake(enum sleep_state sleep_state)
+{
+	int fd, fw_fd;
+	unsigned long residency_pre, residency_post;
+
+	fd = drm_open_driver(DRIVER_INTEL);
+	igt_assert_lte(0, fd);
+
+	fw_fd = igt_open_forcewake_handle(fd);
+	igt_assert_lte(0, fw_fd);
+
+	switch (sleep_state) {
+		case NOSLEEP:
+			break;
+		case SUSPEND:
+			igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
+						      SUSPEND_TEST_NONE);
+			break;
+		case HIBERNATE:
+			igt_system_suspend_autoresume(SUSPEND_STATE_DISK,
+						      SUSPEND_TEST_NONE);
+			break;
+	}
+
+	sleep(1); // time to fully resume
+
+	// forcewake should keep residency constant after resume
+	residency_pre = read_rc6_residency("rc6");
+	sleep(SLEEP_DURATION);
+	residency_post = read_rc6_residency("rc6");
+
+	igt_assert_eq(residency_pre, residency_post);
+
+	close(fw_fd);
+	close(fd);
+}
+
 igt_main
 {
 	unsigned int rc6_mask;
@@ -209,4 +247,19 @@  igt_main
 
 		residency_accuracy(res.rc6pp, res.duration, "rc6pp");
 	}
+	igt_subtest("rc6-forcewake") {
+		igt_skip_on(!(rc6_mask & RC6_ENABLED));
+
+		test_rc6_forcewake(NOSLEEP);
+	}
+	igt_subtest("rc6-forcewake-suspend") {
+		igt_skip_on(!(rc6_mask & RC6_ENABLED));
+
+		test_rc6_forcewake(SUSPEND);
+	}
+	igt_subtest("rc6-forcewake-hibernate") {
+		igt_skip_on(!(rc6_mask & RC6_ENABLED));
+
+		test_rc6_forcewake(HIBERNATE);
+	}
 }