[igt-dev] [PATCH i-g-t] tests/xe/debugfs: fix xe_device_get() placement

Matthew Auld matthew.auld at intel.com
Wed Mar 22 10:22:11 UTC 2023


Accidentally broke this when moving the xe_device_get(), missing that
for_each_gt() also relies on the cached query state:

Starting subtest: gt
(xe_debugfs:6941) xe/xe_query-CRITICAL: Test assertion failure function
xe_number_gt, file ../lib/xe/xe_query.c:327:
(xe_debugfs:6941) xe/xe_query-CRITICAL: Failed assertion: xe_dev
Stack trace:
  #0 ../lib/igt_core.c:1963 __igt_fail_assert()
  #1 ../lib/xe/xe_query.c:327 xe_number_gt()
  #2 ../tests/xe/xe_debugfs.c:262 __igt_unique____real_main245()
  #3 ../tests/xe/xe_debugfs.c:245 main()
  #4 ../sysdeps/nptl/libc_start_call_main.h:58 __libc_start_call_main()
  #5 ../csu/libc-start.c:128 __libc_start_main@@GLIBC_2.34()
  #6 [_start+0x25]
Subtest gt failed.

Fixes: c01d2733 ("tests/xe/debugfs: fix double-free in test_base")
Signed-off-by: Matthew Auld <matthew.auld at intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/xe/xe_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/xe/xe_debugfs.c b/tests/xe/xe_debugfs.c
index ad6191fb..f2480845 100644
--- a/tests/xe/xe_debugfs.c
+++ b/tests/xe/xe_debugfs.c
@@ -145,8 +145,6 @@ test_base(int fd)
 	igt_debugfs_dump(fd, "gem_names");
 
 	validate_entries(fd, "", expected_files, ARRAY_SIZE(expected_files));
-
-	xe_device_put(fd);
 }
 
 /**
@@ -250,6 +248,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
+		xe_device_get(fd);
 		__igt_debugfs_dump(fd, "info", IGT_LOG_INFO);
 	}
 
@@ -271,6 +270,7 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 	}
 
 	igt_fixture {
+		xe_device_put(fd);
 		close(fd);
 	}
 }
-- 
2.39.2



More information about the igt-dev mailing list