summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-11-17 10:14:32 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2020-11-17 15:47:00 +0000
commitd9b09131eaeed3f3bf5b68d8b5f18516b1659b1d (patch)
treec18c1b50344c8f783ecdce66a0e2e6de79455b72
parentbe529747d8eac29f4dd8b9bf159f34468f5ce477 (diff)
i915/gem_close_race: Race process-exit harder
Avoid accidentally applying our own serialisation prior to the process exit from the over-eager libigt atexit handlers. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
-rw-r--r--tests/i915/gem_close_race.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/i915/gem_close_race.c b/tests/i915/gem_close_race.c
index 4b72d353..06b80100 100644
--- a/tests/i915/gem_close_race.c
+++ b/tests/i915/gem_close_race.c
@@ -140,18 +140,17 @@ static uint32_t load(int fd)
return handle;
}
-static void process(int child)
+static void process(int fd, int child)
{
uint32_t handle;
- int fd;
- fd = drm_open_driver(DRIVER_INTEL);
+ fd = gem_reopen_driver(fd);
handle = load(fd);
if ((child & 63) == 63)
gem_read(fd, handle, 0, &handle, sizeof(handle));
- gem_quiescent_gpu(fd);
+ /* leave fd to be closed by process termination */
}
struct crashme {
@@ -262,18 +261,28 @@ igt_main
}
igt_subtest("basic-process") {
+ int fd = drm_open_driver(DRIVER_INTEL);
+
igt_fork(child, 1)
- process(child);
+ process(fd, child);
igt_waitchildren();
+
+ gem_quiescent_gpu(fd);
+ close(fd);
}
igt_subtest("basic-threads")
threads(1, 0);
igt_subtest("process-exit") {
+ int fd = drm_open_driver(DRIVER_INTEL);
+
igt_fork(child, 768)
- process(child);
+ process(fd, child);
igt_waitchildren();
+
+ gem_quiescent_gpu(fd);
+ close(fd);
}
igt_subtest("contexts")