From 69ecedea735425cfb9a5d7dfcaa5840393553fd1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 22 Jan 2016 22:14:33 +0000 Subject: [PATCH] igt/gem_concurrent_blit: Allocate a private batch cache for the child We have to avoid the COW alias for the intel_bufmgr and intel_batch cache as the child may close the object (in its local cache) leaving an alias in the parent cache pointing to a stale object. Signed-off-by: Chris Wilson --- tests/gem_concurrent_all.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c index 130a4de0..1ce2a562 100644 --- a/tests/gem_concurrent_all.c +++ b/tests/gem_concurrent_all.c @@ -1135,9 +1135,21 @@ static void run_child(struct buffers *buffers, do_hang do_hang_func) { - igt_fork(child, 1) + /* We inherit the buffers from the parent, but the bufmgr/batch + * needs to be local as the cache of reusable itself will be COWed, + * leading to the child closing an object without the parent knowing. + */ + igt_fork(child, 1) { + buffers->bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); + drm_intel_bufmgr_gem_enable_reuse(buffers->bufmgr); + batch = intel_batchbuffer_alloc(buffers->bufmgr, devid); + do_test_func(buffers, do_copy_func, do_hang_func); + intel_batchbuffer_free(batch); + drm_intel_bufmgr_destroy(buffers->bufmgr); + } + igt_waitchildren(); igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); }