[PATCH igt] lib: Force global reset + uevents for hang detector

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

 



The hang detector relies on a uevent for notification and aborting the
test. As proposed, fine-grained resets may not produce a global uevent
and so this hang detection becomes void. As we don't expect any hang, we
can just reduce the reset to only a global + uevent and so maintain
functionality, and switch back to fine-grained resets afterwards.

Note that any test that requires testing fine-grained resets should
ensure that they are enabled first as igt may leave the global
parameters in an inconsistent state.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
cc: Michel Thierr <michel.thierry@xxxxxxxxx>
---
 lib/igt_aux.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 1222806c..ca2feac3 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -60,6 +60,7 @@
 #include "igt_debugfs.h"
 #include "igt_gt.h"
 #include "igt_rand.h"
+#include "igt_sysfs.h"
 #include "config.h"
 #include "intel_reg.h"
 #include "ioctl_wrappers.h"
@@ -443,12 +444,34 @@ static void sig_abort(int sig)
 	igt_assert(!"GPU hung");
 }
 
+static bool set_parameter(int fd, const char *parameter, int value)
+{
+	int dir;
+
+	dir = igt_sysfs_open_parameters(fd);
+	if (dir < 0)
+		return false;
+
+	igt_sysfs_printf(dir, parameter, "%d", value);
+	close(dir);
+
+	return true;
+}
+
 void igt_fork_hang_detector(int fd)
 {
 	struct stat st;
 
 	igt_assert(fstat(fd, &st) == 0);
 
+	/*
+	 * Disable per-engine reset to force an error uevent. We don't
+	 * expect to get any hangs whilst the detector is enabled (if we do
+	 * they are a test failure!) and so the loss of per-engine reset
+	 * functionality is not an issue.
+	 */
+	igt_assert(set_parameter(fd, "reset", 1 /* global reset only */));
+
 	signal(SIGIO, sig_abort);
 	igt_fork_helper(&hang_detector)
 		hang_detector_process(getppid(), st.st_rdev);
-- 
2.11.0

_______________________________________________
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