summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-04-10 20:44:58 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-04-10 20:49:26 +0100
commitc46f3c341caebfbe114aaafa412173db419083e9 (patch)
tree34aef18b34064f0d5f81ffa6bb56fc000c5bb1e3
parente8bcd678a6e570ccda0d694939d17285fb394da2 (diff)
igt/gem_concurrent_blit: Purge the libdrm caches before cloning
When forking, the entire VM is cloned including the VMA backed by GEM objects from the libdrm buffer cache. This is not only slow, but can also cause the system to exceed the maximum number of VMA and premature test failure. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/gem_concurrent_all.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c
index 10e535750942..b4b1e9ad4639 100644
--- a/tests/gem_concurrent_all.c
+++ b/tests/gem_concurrent_all.c
@@ -650,7 +650,8 @@ static int read_sysctl(const char *path)
FILE *file = fopen(path, "r");
int max = 0;
if (file) {
- fscanf(file, "%d", &max);
+ if (fscanf(file, "%d", &max) != 1)
+ max = 0; /* silence! */
fclose(file);
}
return max;
@@ -757,6 +758,27 @@ static void buffers_create(struct buffers *b)
b->snoop = snoop_create_bo(b);
}
+static void buffers_reset(struct buffers *b, bool enable_reuse)
+{
+ buffers_destroy(b);
+
+ igt_assert(b->count == 0);
+ igt_assert(b->tmp);
+ igt_assert(b->src);
+ igt_assert(b->dst);
+
+ intel_batchbuffer_free(b->batch);
+ drm_intel_bufmgr_destroy(b->bufmgr);
+
+ b->bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+ igt_assert(b->bufmgr);
+
+ if (enable_reuse)
+ drm_intel_bufmgr_gem_enable_reuse(b->bufmgr);
+ b->batch = intel_batchbuffer_alloc(b->bufmgr, devid);
+ igt_assert(b->batch);
+}
+
static void buffers_fini(struct buffers *b)
{
if (b->bufmgr == NULL)
@@ -1301,20 +1323,17 @@ static void __run_forked(struct buffers *buffers,
do_hang do_hang_func)
{
- int _num_buffers = buffers->num_buffers;
-
- _num_buffers /= num_children;
- _num_buffers += MIN_BUFFERS;
-
- buffers_destroy(buffers);
+ /* purge the libdrm caches before cloing the process */
+ buffers_reset(buffers, true);
igt_fork(child, num_children) {
/* recreate process local variables */
fd = drm_open_driver(DRIVER_INTEL);
- buffers_init(buffers, buffers->name,
- buffers->create, buffers->mode,
- buffers->size, _num_buffers, fd, true);
+ buffers->num_buffers /= num_children;
+ buffers->num_buffers += MIN_BUFFERS;
+
+ buffers_reset(buffers, true);
buffers_create(buffers);
igt_interruptible(interrupt) {