mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-13 02:46:23 +00:00
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>
This commit is contained in:
parent
3e766b8255
commit
f2775039b1
@ -47,6 +47,7 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "drm.h"
|
#include "drm.h"
|
||||||
#include "i915_drm.h"
|
#include "i915_drm.h"
|
||||||
@ -833,19 +834,32 @@ static int test_usage_restrictions(int fd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int test_create_destroy(int fd)
|
static int test_create_destroy(int fd, int time)
|
||||||
{
|
{
|
||||||
void *ptr;
|
struct timespec start, now;
|
||||||
int ret;
|
|
||||||
uint32_t handle;
|
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);
|
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||||
igt_assert(ret == 0);
|
do {
|
||||||
|
for (n = 0; n < 1000; n++) {
|
||||||
|
igt_assert(posix_memalign(&ptr, PAGE_SIZE, PAGE_SIZE) == 0);
|
||||||
|
|
||||||
gem_close(fd, handle);
|
do_or_die(gem_userptr(fd, ptr, PAGE_SIZE, 0, &handle));
|
||||||
free(ptr);
|
|
||||||
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1264,7 +1278,7 @@ int main(int argc, char **argv)
|
|||||||
gem_userptr_test_unsynchronized();
|
gem_userptr_test_unsynchronized();
|
||||||
|
|
||||||
igt_subtest("create-destroy-unsync")
|
igt_subtest("create-destroy-unsync")
|
||||||
test_create_destroy(fd);
|
test_create_destroy(fd, 5);
|
||||||
|
|
||||||
igt_subtest("unsync-overlap")
|
igt_subtest("unsync-overlap")
|
||||||
test_overlap(fd, 0);
|
test_overlap(fd, 0);
|
||||||
@ -1355,7 +1369,7 @@ int main(int argc, char **argv)
|
|||||||
test_process_exit(fd, PE_GTT_MAP | PE_BUSY);
|
test_process_exit(fd, PE_GTT_MAP | PE_BUSY);
|
||||||
|
|
||||||
igt_subtest("create-destroy-sync")
|
igt_subtest("create-destroy-sync")
|
||||||
test_create_destroy(fd);
|
test_create_destroy(fd, 5);
|
||||||
|
|
||||||
igt_subtest("sync-overlap")
|
igt_subtest("sync-overlap")
|
||||||
test_overlap(fd, EINVAL);
|
test_overlap(fd, EINVAL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user