diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2016-03-04 14:39:06 +0000 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2016-03-07 13:03:04 +0000 |
commit | 174a06b129d63a09486dd9ee8d6368cbf46a64c1 (patch) | |
tree | 4306151c1ba400eefcd64e09d9ff3ffd629f87b3 /tests | |
parent | afa38a4d454c4d7058e56fd84d5b9fe42dad1ee2 (diff) |
gem_ppgtt: Fix flink-and-exit-vma-leak for engine->last_context
Now that engines keep references on the last executed contexts,
to fix this test we need to execute an unrelated context last to
ensure the one we are interested in is free to be cleaned up when
we expect it to be.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gem_ppgtt.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/gem_ppgtt.c b/tests/gem_ppgtt.c index 78d5b48f..1a620ad8 100644 --- a/tests/gem_ppgtt.c +++ b/tests/gem_ppgtt.c @@ -252,8 +252,8 @@ static void flink_and_close(void) static void flink_and_exit(void) { - uint32_t fd, fd2; - uint32_t bo, flinked_bo, name; + uint32_t fd, fd2, fd3; + uint32_t bo, bo2, flinked_bo, name; char match[100]; int to_match; bool matched; @@ -270,12 +270,19 @@ static void flink_and_exit(void) igt_assert(to_match < sizeof(match)); fd2 = drm_open_driver(DRIVER_INTEL); - flinked_bo = gem_open(fd2, name); + + fd3 = drm_open_driver(DRIVER_INTEL); + bo2 = gem_create(fd3, 4096); + + /* Verify VMA is not there yet. */ + matched = igt_debugfs_search("i915_gem_gtt", match); + igt_assert_eq(matched, false); + exec_and_get_offset(fd2, flinked_bo); gem_sync(fd2, flinked_bo); - /* Verify looking for string works OK. */ + /* Verify VMA has been created. */ matched = igt_debugfs_search("i915_gem_gtt", match); igt_assert_eq(matched, true); @@ -284,6 +291,11 @@ static void flink_and_exit(void) /* Close the context. */ close(fd2); + /* Execute a different and unrelated (wrt object sharing) context to + * ensure engine drops its last context reference. + */ + exec_and_get_offset(fd3, bo2); + retry: /* Give cleanup some time to run. */ usleep(100000); @@ -297,6 +309,9 @@ retry: igt_assert_eq(matched, false); + gem_close(fd3, bo2); + close(fd3); + gem_close(fd, bo); close(fd); } |