summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-09-26 10:22:33 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-09-26 10:29:22 +0100
commitf2775039b1d2f3c24876622e4528604496de8abc (patch)
tree98004e11a607db59cb8101f1985d9b1ce1a6425b
parent3e766b8255efb6c994e6501be2af44b4bdc4d191 (diff)
igt/gem_userptr_blits: Test interruptible create-destroy
In order to exercise https://bugs.freedesktop.org/show_bug.cgi?id=84207 we need to interrupt the mmu_notifier_register with a signal. This is likely to be quite difficult, but let's just try running the create-destroy test in an interruptible loop for 5s. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/gem_userptr_blits.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c
index 96aee524..638b74c2 100644
--- a/tests/gem_userptr_blits.c
+++ b/tests/gem_userptr_blits.c
@@ -47,6 +47,7 @@
#include <sys/mman.h>
#include <signal.h>
#include <pthread.h>
+#include <time.h>
#include "drm.h"
#include "i915_drm.h"
@@ -833,19 +834,32 @@ static int test_usage_restrictions(int fd)
return 0;
}
-static int test_create_destroy(int fd)
+static int test_create_destroy(int fd, int time)
{
- void *ptr;
- int ret;
+ struct timespec start, now;
uint32_t handle;
+ void *ptr;
+ int n;
- igt_assert(posix_memalign(&ptr, PAGE_SIZE, PAGE_SIZE) == 0);
+ igt_fork_signal_helper();
- ret = gem_userptr(fd, ptr, PAGE_SIZE, 0, &handle);
- igt_assert(ret == 0);
+ clock_gettime(CLOCK_MONOTONIC, &start);
+ do {
+ for (n = 0; n < 1000; n++) {
+ igt_assert(posix_memalign(&ptr, PAGE_SIZE, PAGE_SIZE) == 0);
- gem_close(fd, handle);
- free(ptr);
+ do_or_die(gem_userptr(fd, ptr, PAGE_SIZE, 0, &handle));
+
+ gem_close(fd, handle);
+ free(ptr);
+ }
+
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ now.tv_sec -= time;
+ } while (now.tv_sec < start.tv_sec ||
+ (now.tv_sec == start.tv_sec && now.tv_nsec < start.tv_nsec));
+
+ igt_stop_signal_helper();
return 0;
}
@@ -1264,7 +1278,7 @@ int main(int argc, char **argv)
gem_userptr_test_unsynchronized();
igt_subtest("create-destroy-unsync")
- test_create_destroy(fd);
+ test_create_destroy(fd, 5);
igt_subtest("unsync-overlap")
test_overlap(fd, 0);
@@ -1355,7 +1369,7 @@ int main(int argc, char **argv)
test_process_exit(fd, PE_GTT_MAP | PE_BUSY);
igt_subtest("create-destroy-sync")
- test_create_destroy(fd);
+ test_create_destroy(fd, 5);
igt_subtest("sync-overlap")
test_overlap(fd, EINVAL);