mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-10 09:26:10 +00:00
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>
This commit is contained in:
parent
afa38a4d45
commit
174a06b129
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user