All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Antoine <peter.antoine@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [I-G-T 3/3] igt/gem_mocs_settings: Reduce the amount of cascading failures
Date: Fri, 29 Jul 2016 10:34:36 +0100	[thread overview]
Message-ID: <1469784876-33201-5-git-send-email-peter.antoine@intel.com> (raw)
In-Reply-To: <1469784876-33201-1-git-send-email-peter.antoine@intel.com>

If one of the previous tests fails then the following tests fail.
This patch means that the following tests do not fail when the previous
test fails (for some cases).

Signed-off-by: Peter Antoine <peter.antoine@intel.com>
---
 lib/igt_aux.c             | 67 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_aux.h             |  2 ++
 tests/gem_mocs_settings.c | 56 +++++++++++++++++++++------------------
 3 files changed, 99 insertions(+), 26 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 1cb9398..cc3ce26 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -629,6 +629,41 @@ void igt_cleanup_aperture_trashers(void)
 #define SQUELCH ">/dev/null 2>&1"
 
 /**
+ * igt_system_suspend_autoresume_no_assert:
+ *
+ * Execute a system suspend-to-mem cycle and automatically wake up again using
+ * the firmware's resume timer.
+ *
+ * This is very handy for implementing any kind of suspend/resume test.
+ *
+ * This version does not cause an "exception" as the test will need to tidy-up
+ * to allow for subsequent tests to run.
+ */
+bool igt_system_suspend_autoresume_no_assert(void)
+{
+	/* FIXME: Simulation doesn't like suspend/resume, and not even a lighter
+	 * approach using /sys/power/pm_test to just test our driver's callbacks
+	 * seems to fare better. We need to investigate what's going on. */
+	if (igt_run_in_simulation()) {
+		igt_debug("autoresume cannot be used in simulation\n");
+		return false;
+
+	} else if (system("rtcwake -n -s 15 -m mem" SQUELCH) != 0) {
+		igt_debug("rtcwake -n -s 15 -m mem is not supported\n");
+		return false;
+
+	} else if (system("rtcwake -s 15 -m mem") != 0) {
+		igt_debug(
+		     "This failure means that something is wrong with the "
+		     "rtcwake tool or how your distro is set up. This is not "
+		     "a i915.ko or i-g-t bug.\n");
+		return false;
+	}
+
+	return true;
+}
+
+/**
  * igt_system_suspend_autoresume:
  *
  * Execute a system suspend-to-mem cycle and automatically wake up again using
@@ -653,6 +688,38 @@ void igt_system_suspend_autoresume(void)
 }
 
 /**
+ * igt_system_hibernate_autoresume_no_assert:
+ *
+ * Execute a system suspend-to-disk cycle and automatically wake up again using
+ * the firmware's resume timer.
+ *
+ * This is very handy for implementing any kind of hibernate/resume test.
+ *
+ * This version does not cause an "exception" as the test will need to tidy-up
+ * to allow for subsequent tests to run.
+ */
+bool igt_system_hibernate_autoresume_no_assert(void)
+{
+	if (igt_run_in_simulation()) {
+		igt_debug("autoresume cannot be used in simulation\n");
+		return false;
+
+	} else if (system("rtcwake -n -s 30 -m disk" SQUELCH) != 0) {
+		igt_debug("rtcwake -n -s 30 -m disk is not supported\n");
+		return false;
+
+	} else if (system("rtcwake -s 30 -m disk") != 0) {
+		igt_debug(
+		     "This failure means that something is wrong with the "
+		     "rtcwake tool or how your distro is set up. This is not "
+		     "a i915.ko or i-g-t bug.\n");
+		return false;
+	}
+
+	return true;
+}
+
+/**
  * igt_system_hibernate_autoresume:
  *
  * Execute a system suspend-to-disk cycle and automatically wake up again using
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index be0d2d6..483c444 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -103,7 +103,9 @@ void igt_cleanup_aperture_trashers(void);
 
 /* suspend/hibernate and auto-resume system */
 void igt_system_suspend_autoresume(void);
+bool igt_system_suspend_autoresume_no_assert(void);
 void igt_system_hibernate_autoresume(void);
+bool igt_system_hibernate_autoresume_no_assert(void);
 
 /* dropping priviledges */
 void igt_drop_root(void);
diff --git a/tests/gem_mocs_settings.c b/tests/gem_mocs_settings.c
index 66d02d9..1da7473 100644
--- a/tests/gem_mocs_settings.c
+++ b/tests/gem_mocs_settings.c
@@ -373,6 +373,27 @@ static void test_mocs_values(int fd)
 	}
 }
 
+static void action_test(int fd, unsigned int mode)
+{
+	switch (mode) {
+	case RESET:
+			igt_force_gpu_reset();
+			break;
+	case SUSPEND:
+			if (!igt_system_suspend_autoresume_no_assert()) {
+				close(fd);
+				igt_fail(1);
+			}
+			break;
+	case HIBERNATE:
+			if (!igt_system_hibernate_autoresume_no_assert()) {
+				close(fd);
+				igt_fail(1);
+			}
+			break;
+	}
+}
+
 static void default_context_tests(unsigned mode)
 {
 	int fd = drm_open_driver_master(DRIVER_INTEL);
@@ -380,12 +401,7 @@ static void default_context_tests(unsigned mode)
 	igt_debug("Testing Non/Default Context Engines\n");
 	test_mocs_values(fd);
 
-	switch (mode) {
-	case NONE:	break;
-	case RESET:	igt_force_gpu_reset();	break;
-	case SUSPEND:	igt_system_suspend_autoresume(); break;
-	case HIBERNATE:	igt_system_hibernate_autoresume(); break;
-	}
+	action_test(fd, mode);
 
 	test_mocs_values(fd);
 	close(fd);
@@ -419,12 +435,7 @@ static void default_dirty_tests(unsigned mode)
 				engine);
 	}
 
-	switch (mode) {
-	case NONE:	break;
-	case RESET:	igt_force_gpu_reset();	break;
-	case SUSPEND:	igt_system_suspend_autoresume(); break;
-	case HIBERNATE:	igt_system_hibernate_autoresume(); break;
-	}
+	action_test(fd, mode);
 
 	close(fd);
 
@@ -442,12 +453,7 @@ static void context_save_restore_test(unsigned mode)
 	check_control_registers(fd, I915_EXEC_RENDER, ctx_id, false);
 	check_l3cc_registers(fd, I915_EXEC_RENDER, ctx_id, false);
 
-	switch (mode) {
-	case NONE:	break;
-	case RESET:	igt_force_gpu_reset();	break;
-	case SUSPEND:	igt_system_suspend_autoresume(); break;
-	case HIBERNATE:	igt_system_hibernate_autoresume(); break;
-	}
+	action_test(fd, mode);
 
 	check_control_registers(fd, I915_EXEC_RENDER, ctx_id, false);
 	check_l3cc_registers(fd, I915_EXEC_RENDER, ctx_id, false);
@@ -485,12 +491,7 @@ static void context_dirty_test(unsigned mode)
 	check_control_registers(fd, I915_EXEC_RENDER, ctx_id, true);
 	check_l3cc_registers(fd, I915_EXEC_RENDER, ctx_id, true);
 
-	switch (mode) {
-	case NONE:	break;
-	case RESET:	igt_force_gpu_reset();	break;
-	case SUSPEND:	igt_system_suspend_autoresume(); break;
-	case HIBERNATE:	igt_system_hibernate_autoresume(); break;
-	}
+	action_test(fd, mode);
 
 	check_control_registers(fd, I915_EXEC_RENDER, ctx_id, true);
 	check_l3cc_registers(fd, I915_EXEC_RENDER, ctx_id, true);
@@ -562,8 +563,11 @@ static void context_rc6_test(void)
 	check_l3cc_registers(fd, I915_EXEC_RENDER, ctx_id, false);
 
 	res_ms = read_rc6_residency();
-	sleep(3);
-	igt_assert_neq(res_ms, read_rc6_residency());
+	sleep(6);
+	if (res_ms == read_rc6_residency()) {
+		close(fd);
+		igt_assert_neq(res_ms, read_rc6_residency());
+	}
 
 	check_control_registers(fd, I915_EXEC_RENDER, ctx_id, false);
 	check_l3cc_registers(fd, I915_EXEC_RENDER, ctx_id, false);
-- 
1.9.1

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

  parent reply	other threads:[~2016-07-29  9:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-29  9:34 [I-G-T 0/3] igt/gem_mocs_settings: Update MOCS tests Peter Antoine
2016-07-29  9:34 ` [I-G-T 1/3] igt/gem_mocs_settings: Remove direct register tests Peter Antoine
2016-07-29  9:34 ` [I-G-T 2/3] igt/gem_mocs_settings: adding RC6 testings Peter Antoine
2016-07-29  9:50   ` Antoine, Peter
2016-07-29  9:34 ` [I-G-T 2/3] igt/gem_mocs_settings: adding RC6 tests Peter Antoine
2016-08-01  9:04   ` Chris Wilson
2016-08-01  9:16     ` Peter Antoine
2016-08-01 10:03     ` Peter Antoine
2016-08-01 10:11       ` Chris Wilson
2016-08-01 10:43         ` Peter Antoine
2016-07-29  9:34 ` Peter Antoine [this message]
2016-08-01  9:02   ` [I-G-T 3/3] igt/gem_mocs_settings: Reduce the amount of cascading failures Chris Wilson
2016-08-01  9:33     ` Peter Antoine
2016-08-02 14:37       ` Daniel Vetter
2016-08-02 14:47         ` Antoine, Peter
2016-08-03  7:36           ` Daniel Vetter
2016-08-03  8:49             ` Antoine, Peter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469784876-33201-5-git-send-email-peter.antoine@intel.com \
    --to=peter.antoine@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.