[Intel-gfx] [PATCH] tests/prime_self_import: Track leaked objects accurately

Daniel Vetter daniel.vetter at ffwll.ch
Tue Nov 18 13:55:17 CET 2014


drm_open_any keeps a buffer handle around for the cleanup sync work,
so we can only grab the buffer count after the latst drm_open_any
call. Otherwise we'll detect a fake leak.

This broke in

commit 2f2c491cf3167befe7c79e4b17afb4f6284dfc84
Author: Mika Kuoppala <mika.kuoppala at intel.com>
Date:   Fri Mar 28 10:52:46 2014 +0200

    lib/drmtest: don't dup quiescent fd

since that additional open drm fd keeps a gem object for the default
context around. Hence why this also only blows up on gen6+ - earlier
platforms don't have hw context support.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79821
Cc: Mika Kuoppala <mika.kuoppala at intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 tests/prime_self_import.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c
index 3e482b79b2ff..dd9c2933110e 100644
--- a/tests/prime_self_import.c
+++ b/tests/prime_self_import.c
@@ -341,8 +341,6 @@ static void test_export_close_race(void)
 	int obj_count;
 	void *status;
 
-	obj_count = get_object_count();
-
 	num_threads = sysconf(_SC_NPROCESSORS_ONLN);
 
 	threads = calloc(num_threads, sizeof(pthread_t));
@@ -350,6 +348,8 @@ static void test_export_close_race(void)
 	fd = drm_open_any();
 	igt_assert(fd >= 0);
 
+	obj_count = get_object_count();
+
 	for (i = 0; i < num_threads; i++) {
 		r = pthread_create(&threads[i], NULL,
 				   thread_fn_export_vs_close,
-- 
1.9.3




More information about the Intel-gfx mailing list