diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2021-02-06 10:51:39 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2021-02-06 10:53:47 +0000 |
commit | 98f37176f6a12c3b64169e86491b8402bd8b9e16 (patch) | |
tree | fc37af3687864ab606d8e827f41f60465adb3b6b /tests/i915/gem_eio.c | |
parent | 45f9e585007f8a4f10d3c60d98335cc0ed1ed771 (diff) |
i915/gem_eio: Trim the heartbeat fast for faster testing
On more recent kernels, we can set the heartbeat interval and so reduce
how long it takes to declare the system wedged, speeding up the testing.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_eio.c')
-rw-r--r-- | tests/i915/gem_eio.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/tests/i915/gem_eio.c b/tests/i915/gem_eio.c index 9be0f218..8fa588a9 100644 --- a/tests/i915/gem_eio.c +++ b/tests/i915/gem_eio.c @@ -27,17 +27,18 @@ * */ +#include <dirent.h> +#include <errno.h> +#include <fcntl.h> +#include <inttypes.h> #include <sched.h> -#include <stdlib.h> +#include <signal.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <inttypes.h> -#include <errno.h> #include <sys/ioctl.h> -#include <signal.h> #include <time.h> +#include <unistd.h> #include <drm.h> @@ -910,6 +911,35 @@ static void test_kms(int i915, igt_display_t *dpy) munmap(shared, 4096); } +static void set_heartbeat(int i915, int interval) +{ + int fd, engines; + DIR *dir; + + fd = igt_sysfs_open(i915); + if (fd < 0) + return; + + engines = openat(fd, "engine", O_RDONLY | O_DIRECTORY); + close(fd); + if (engines < 0) + return; + + dir = fdopendir(engines); + for (struct dirent *de; (de = readdir(dir)); ) { + if (de->d_type != DT_DIR) + continue; + + fd = openat(engines, de->d_name, O_DIRECTORY | O_RDONLY); + if (fd < 0) + continue; + + igt_sysfs_printf(fd, "heartbeat_interval_ms", "%d", interval); + close(fd); + } + closedir(dir); +} + static int fd = -1; static void @@ -929,6 +959,7 @@ igt_main igt_require_gem(fd); igt_allow_hang(fd, 0, 0); + set_heartbeat(fd, 250); igt_require(i915_reset_control(fd, true)); igt_force_gpu_reset(fd); |