[Intel-gfx] [PATCH igt] lib: Force global reset + uevents for hang detector
Chris Wilson
chris at chris-wilson.co.uk
Mon Jun 5 11:05:09 UTC 2017
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 at chris-wilson.co.uk>
cc: Michel Thierr <michel.thierry at intel.com>
---
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
More information about the Intel-gfx
mailing list