Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit
@ 2022-09-26  6:17 Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 01/76] lib: Introduce typed cleanups Mauro Carvalho Chehab
                   ` (76 more replies)
  0 siblings, 77 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Mauro Carvalho Chehab <mchehab@kernel.org>

GCC is usually smart enough to close devices on exit, but that doesn't work
with the logic inside igt_skip(), as it uses longjmp, causing the code to
go out of scope. Such scoped variables must be tracked in an outer scope to
the skipping subtest.

Change the logic on IGT tests in order to avoid keeping device opened at
the end of the test.

Chris Wilson (76):
  lib: Introduce typed cleanups
  i915/gem_basic: Close device before exit
  i915/gem_flink_basic: Close device before exit
  i915/gem_linear_blits: Close device before exit
  i915/gem_blits: Close device before exit
  i915/gem_close: Close device before exit
  i915/gem_create: Close device before exit
  i915/gem_ctx_engines: Close device before exit
  i915/gem_ctx_shared: Close device before exit
  i915/gem_exec_alignment: Close device before exit
  i915/gem_render_copy: Close device before exit
  i915/gem_render_copy_redux: Close device before exit
  i915/gem_media_fill: Close device before exit
  i915/gem_userptr_blits: Close device before exit
  i915/gem_workarounds: Close device before exit
  i915/gem_unref_active_buffers: Close device before exit
  i915/gem_exec_endless: Close device before exit
  i915/gem_request_retire: Close device before exit
  i915/gem_unfence_active_buffers: Close device before exit
  i915/i915_pciid: Close device before exit
  kms_cursor_legacy: Close device before exit
  kms_flip: Close device before exit
  kms_pipe_crc_basic: Close device before exit
  kms_psr: Close device before exit
  kms_flip: Close device before exit
  kms_force_connector_basic: Close device before exit
  dumb_buffer: Close device before exit
  kms_atomic: Close device before exit
  kms_atomic_interruptible: Close device before exit
  kms_atomic_transition: Close device before exit
  i915/kms_big_fb: Close device before exit
  i915/kms_ccs: Close device before exit
  kms_color: Close device before exit
  kms_cursor_crc: Close device before exit
  i915/kms_big_joiner: Close device before exit
  i915/kms_cdclk: Close device before exit
  i915/kms_fence_pin_leak: Close device before exit
  i915/kms_flip_scaled_crc: Close device before exit
  i915/kms_flip_tiling: Close device before exit
  i915/kms_mmap_write_crc: Close device before exit
  i915/kms_pipe_b_c_ivb: Close device before exit
  i915/kms_psr2_sf: Close device before exit
  i915/kms_psr2_su: Close device before exit
  i915/kms_pwrite_crc: Close device before exit
  kms_flip_event_leak: Close device before exit
  kms_hdr: Close device before exit
  kms_invalid_mode: Close device before exit
  kms_panel_fitting: Close device before exit
  kms_plane: Close device before exit
  kms_plane_alpha_blend: Close device before exit
  kms_plane_cursor: Close device before exit
  kms_plane_multiple: Close device before exit
  kms_plane_scaling: Close device before exit
  kms_properties: Close device before exit
  kms_rotation_crc: Close device before exit
  kms_sequence: Close device before exit
  kms_universal_plane: Close device before exit
  kms_vblank: Close device before exit
  syncobj_wait: Close device before exit
  syncobj_basic: Close device before exit
  syncobj_timeline: Close device before exit
  drm_import_export: Close device before exit
  kms_dp_aux_dev: Close device before exit
  kms_hdmi_inject: Close device before exit
  kms_3d: Close device before exit
  kms_scaling_modes: Close device before exit
  kms_dither: Close device before exit
  drm_read: Close device before exit
  kms_cursor_edge_walk: Close device before exit
  kms_plane_lowres: Close device before exit
  kms_content_protection: Close device before exit
  feature_discovery: Close device before exit
  i915/i915_pm_dc: Close device before exit
  core_auth: Close(master) before exit
  i915/gem_exec_balancer: Close device before exit
  i915/gem_ctx_isolation: Close device before exit

 lib/igt_core.c                          |   6 ++
 lib/igt_core.h                          |   2 +
 lib/igt_types.c                         |  17 +++
 lib/igt_types.h                         |  47 ++++++++
 lib/meson.build                         |   1 +
 lib/tests/bad_subtest_type.c            |  19 ++++
 lib/tests/igt_types.c                   | 136 ++++++++++++++++++++++++
 lib/tests/meson.build                   |   2 +
 tests/core_auth.c                       |   8 +-
 tests/drm_import_export.c               |   5 +
 tests/drm_read.c                        |   4 +-
 tests/dumb_buffer.c                     |   4 +
 tests/feature_discovery.c               |   5 +-
 tests/i915/gem_basic.c                  |   8 +-
 tests/i915/gem_blits.c                  |   1 +
 tests/i915/gem_close.c                  |   3 +-
 tests/i915/gem_create.c                 |   3 +-
 tests/i915/gem_ctx_engines.c            |   3 +-
 tests/i915/gem_ctx_isolation.c          |   3 +-
 tests/i915/gem_ctx_shared.c             |   3 +-
 tests/i915/gem_exec_alignment.c         |   3 +-
 tests/i915/gem_exec_balancer.c          |   3 +-
 tests/i915/gem_exec_endless.c           |   3 +-
 tests/i915/gem_flink_basic.c            |  11 +-
 tests/i915/gem_linear_blits.c           |   3 +-
 tests/i915/gem_media_fill.c             |   1 +
 tests/i915/gem_render_copy.c            |   1 +
 tests/i915/gem_render_copy_redux.c      |   4 +
 tests/i915/gem_request_retire.c         |   5 +-
 tests/i915/gem_unfence_active_buffers.c |   1 +
 tests/i915/gem_unref_active_buffers.c   |   1 +
 tests/i915/gem_userptr_blits.c          |   4 +-
 tests/i915/gem_workarounds.c            |   3 +-
 tests/i915/i915_pciid.c                 |   2 +
 tests/i915/i915_pm_dc.c                 |   1 +
 tests/i915/kms_big_fb.c                 |   1 +
 tests/i915/kms_big_joiner.c             |   1 +
 tests/i915/kms_busy.c                   |   1 +
 tests/i915/kms_ccs.c                    |   4 +-
 tests/i915/kms_cdclk.c                  |   1 +
 tests/i915/kms_fence_pin_leak.c         |   1 +
 tests/i915/kms_flip_scaled_crc.c        |   1 +
 tests/i915/kms_flip_tiling.c            |   1 +
 tests/i915/kms_mmap_write_crc.c         |   1 +
 tests/i915/kms_pipe_b_c_ivb.c           |   1 +
 tests/i915/kms_psr.c                    |   1 +
 tests/i915/kms_psr2_sf.c                |   1 +
 tests/i915/kms_psr2_su.c                |   1 +
 tests/i915/kms_pwrite_crc.c             |   1 +
 tests/kms_3d.c                          |   1 +
 tests/kms_atomic.c                      |   1 +
 tests/kms_atomic_interruptible.c        |   1 +
 tests/kms_atomic_transition.c           |   1 +
 tests/kms_color.c                       |   1 +
 tests/kms_content_protection.c          |   1 +
 tests/kms_cursor_crc.c                  |   1 +
 tests/kms_cursor_edge_walk.c            |   4 +-
 tests/kms_cursor_legacy.c               |   1 +
 tests/kms_dither.c                      |   1 +
 tests/kms_dp_aux_dev.c                  |   1 +
 tests/kms_flip.c                        |   3 +
 tests/kms_flip_event_leak.c             |   1 +
 tests/kms_force_connector_basic.c       |   7 +-
 tests/kms_hdmi_inject.c                 |   1 +
 tests/kms_hdr.c                         |   1 +
 tests/kms_invalid_mode.c                |   1 +
 tests/kms_panel_fitting.c               |   4 +-
 tests/kms_pipe_crc_basic.c              |   1 +
 tests/kms_plane.c                       |   1 +
 tests/kms_plane_alpha_blend.c           |   1 +
 tests/kms_plane_cursor.c                |   1 +
 tests/kms_plane_lowres.c                |   4 +-
 tests/kms_plane_multiple.c              |   4 +-
 tests/kms_plane_scaling.c               |   4 +-
 tests/kms_properties.c                  |   1 +
 tests/kms_rotation_crc.c                |   1 +
 tests/kms_scaling_modes.c               |   4 +-
 tests/kms_sequence.c                    |   4 +
 tests/kms_universal_plane.c             |   1 +
 tests/kms_vblank.c                      |   4 +
 tests/syncobj_basic.c                   |   4 +
 tests/syncobj_timeline.c                |   4 +
 tests/syncobj_wait.c                    |   4 +
 83 files changed, 385 insertions(+), 33 deletions(-)
 create mode 100644 lib/igt_types.c
 create mode 100644 lib/igt_types.h
 create mode 100644 lib/tests/bad_subtest_type.c
 create mode 100644 lib/tests/igt_types.c

-- 
2.37.3


^ permalink raw reply	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 01/76] lib: Introduce typed cleanups
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
       [not found]   ` <YzcISxi01TrOL4aU@kamilkon-desk1>
       [not found]   ` <Yz02HL4ue1N1O4hi@zkempczy-mobl2>
  2022-09-26  6:17 ` [igt-dev] [PATCH 02/76] i915/gem_basic: Close device before exit Mauro Carvalho Chehab
                   ` (75 subsequent siblings)
  76 siblings, 2 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris@chris-wilson.co.uk>

Start introducing standard types with automatic cleanup courtesy of
gcc's __attribute__((cleanup)). As an example, we start with an fd
that will automatically call close() on going out of scope, and
crucially before atexit where we will want to check for resource leaks.

Suggested-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Acked-by: Nirmoy Das <nirmoy.das@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 lib/igt_core.c               |   6 ++
 lib/igt_core.h               |   2 +
 lib/igt_types.c              |  17 +++++
 lib/igt_types.h              |  47 ++++++++++++
 lib/meson.build              |   1 +
 lib/tests/bad_subtest_type.c |  19 +++++
 lib/tests/igt_types.c        | 136 +++++++++++++++++++++++++++++++++++
 lib/tests/meson.build        |   2 +
 8 files changed, 230 insertions(+)
 create mode 100644 lib/igt_types.c
 create mode 100644 lib/igt_types.h
 create mode 100644 lib/tests/bad_subtest_type.c
 create mode 100644 lib/tests/igt_types.c

diff --git a/lib/igt_core.c b/lib/igt_core.c
index e7425326b7f0..dc6486c841f0 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -624,6 +624,12 @@ uint64_t igt_nsec_elapsed(struct timespec *start)
 		(uint64_t)NSEC_PER_SEC*(now.tv_sec - start->tv_sec));
 }
 
+void __igt_assert_in_outer_scope(void)
+{
+	internal_assert(!in_subtest,
+			"must only be called outside of a subtest");
+}
+
 bool __igt_fixture(void)
 {
 	internal_assert(!in_fixture,
diff --git a/lib/igt_core.h b/lib/igt_core.h
index aa98e8ed8deb..f21723dec4bc 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -135,6 +135,8 @@ struct _GKeyFile *igt_load_igtrc(void);
  */
 #define IGT_EXIT_ABORT 112
 
+void __igt_assert_in_outer_scope(void);
+
 bool __igt_fixture(void);
 void __igt_fixture_complete(void);
 __noreturn void __igt_fixture_end(void);
diff --git a/lib/igt_types.c b/lib/igt_types.c
new file mode 100644
index 000000000000..392f30fcab23
--- /dev/null
+++ b/lib/igt_types.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: MIT
+/*
+* Copyright © 2022 Intel Corporation
+*/
+
+#include <unistd.h>
+
+#include "igt_types.h"
+
+void igt_cleanup_fd(volatile int *fd)
+{
+	if (!fd || *fd < 0)
+		return;
+
+	close(*fd);
+	*fd = -1;
+}
diff --git a/lib/igt_types.h b/lib/igt_types.h
new file mode 100644
index 000000000000..c4bc01ecdb3b
--- /dev/null
+++ b/lib/igt_types.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef IGT_TYPES_H
+#define IGT_TYPES_H
+
+/*
+ * GCC can automatically cleanup variables that go out of scope, but only
+ * through normal means. Breaking out of scope using longjmp (i.e. igt_skip)
+ * is not handled automatically by GCC. Such scoped variables must be tracked
+ * in an outer scope to the skipping subtest.
+ *
+ * BAD:
+ * 	igt_subtest("bad") {
+ * 		igt_fd_t(fd);
+ *
+ * 		fd = drm_open_driver();
+ * 	}
+ *
+ * GOOD:
+ * 	igt_subtest_group() {
+ * 		igt_fd_t(fd);
+ *
+ * 		igt_fixture {
+ * 			fd = drm_open_driver();
+ * 		}
+ *
+ * 		igt_subtest("good")
+ * 			;
+ * 	}
+ *
+ * A rule of thumb is that anything that is initialised through a fixture can
+ * be combined with automatic cleanup.
+ */
+
+#define cleanup_with(fn) __attribute__((__cleanup__(fn)))
+
+/* Prevent use within the inner scope subtests, it will be broken by igt_skip */
+#define IGT_OUTER_SCOPE_INIT(x) ({ __igt_assert_in_outer_scope(); x; })
+
+void igt_cleanup_fd(volatile int *fd);
+#define igt_fd_t(x__) \
+	volatile int x__ cleanup_with(igt_cleanup_fd) = IGT_OUTER_SCOPE_INIT(-1)
+
+#endif /* IGT_TYPES_H */
diff --git a/lib/meson.build b/lib/meson.build
index 548835b5833f..c665bd25073a 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -38,6 +38,7 @@ lib_sources = [
 	'igt_sysrq.c',
 	'igt_taints.c',
 	'igt_thread.c',
+	'igt_types.c',
 	'igt_vec.c',
 	'igt_vgem.c',
 	'igt_x86.c',
diff --git a/lib/tests/bad_subtest_type.c b/lib/tests/bad_subtest_type.c
new file mode 100644
index 000000000000..7f5efdfba8e2
--- /dev/null
+++ b/lib/tests/bad_subtest_type.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: MIT
+/*
+* Copyright © 2022 Intel Corporation
+*/
+
+#include "igt_core.h"
+#include "igt_types.h"
+
+igt_main
+{
+	igt_subtest("bad-scoped-variable") {
+		/*
+		 * Not allowed to nest a scoped variable inside a subtest as
+		 * we expect to longjmp out of the subtest on failure/skip
+		 * and automatic cleanup is not invoked for such jmps.
+		 */
+		igt_fd_t(f);
+	}
+}
diff --git a/lib/tests/igt_types.c b/lib/tests/igt_types.c
new file mode 100644
index 000000000000..2bd74df3a7d6
--- /dev/null
+++ b/lib/tests/igt_types.c
@@ -0,0 +1,136 @@
+// SPDX-License-Identifier: MIT
+/*
+* Copyright © 2022 Intel Corporation
+*/
+
+#include "igt_core.h"
+#include "igt_types.h"
+
+/* a lookalike of igt_fd_t for testing */
+#define scoped_int_t(x__) \
+	volatile int x__ cleanup_with(cleanup) = IGT_OUTER_SCOPE_INIT(-1)
+
+static int cleanup_called;
+
+static void cleanup(volatile int *x)
+{
+	cleanup_called++;
+	*x = -1;
+}
+
+static void delegate(void)
+{
+	scoped_int_t(x);
+
+	igt_fixture
+		x = 1;
+
+	igt_subtest("empty-subtest")
+		x = 2;
+
+	igt_fixture {
+		/* Check that we went through both blocks without cleanup */
+		igt_assert(!cleanup_called);
+		igt_assert(x == 2);
+	}
+}
+
+static void skip_delegate(void)
+{
+	scoped_int_t(x);
+
+	igt_fixture
+		x = 1;
+
+	igt_subtest("skipped-subtest") {
+		igt_skip("Early skip for testing\n");
+		x = 2; /* not reached due to lonjmp from igt_skip */
+	}
+
+	igt_fixture {
+		/* Check that we went through both blocks without cleanup */
+		igt_assert(!cleanup_called);
+		igt_assert(x == 1);
+	}
+}
+
+igt_main
+{
+	/* Basic check that scopes will call their destructor */
+	cleanup_called = 0;
+	igt_fixture {
+		scoped_int_t(x);
+	}
+	igt_subtest("cleanup-after-fixture")
+		igt_assert(cleanup_called);
+
+	/* But not before we go out of scope! */
+	cleanup_called = 0;
+	igt_subtest_group {
+		scoped_int_t(x);
+
+		igt_fixture {
+			x = 0xdeadbeef;
+		}
+
+		igt_subtest("cleanup-not-before-subtest-group") {
+			/* Check no scope destructor was called */
+			igt_assert(cleanup_called == 0);
+			/* Confirm that we did pass through a scoped block */
+			igt_assert_eq_u32(x, 0xdeadbeef);
+		}
+	}
+	igt_subtest("cleanup-after-subtest-group")
+		igt_assert(cleanup_called);
+
+	/* longjmp and __attribute__(cleanup) do not mix well together */
+#if 0 /* See bad_subtest_type, this is caught by an internal assertion */
+	cleanup_called = 0;
+	igt_subtest("skip-subtest") {
+		scoped_int_t(x);
+
+		igt_skip("Checking scoped cleanup on skip\n");
+	}
+	igt_subtest("cleanup-after-skip")
+		igt_assert_f(!cleanup_called,
+				"scoped closure was not compatible with igt_skip\n");
+#endif
+
+	/*
+	 * However, if we igt_skip inside another block (subtest-group), then we
+	 * will get cleanup on the outer scope.
+	 */
+	cleanup_called = 0;
+	igt_subtest_group {
+		scoped_int_t(x);
+
+		igt_subtest("skip-subtest-group")
+			igt_skip("Checking scoped cleanup after skip\n");
+	}
+	igt_subtest("cleanup-after-skip-group")
+		igt_assert(cleanup_called);
+
+	/* Check the same holds true for function calls */
+	cleanup_called = 0;
+	delegate();
+	igt_subtest("cleanup-after-delegation")
+		igt_assert(cleanup_called);
+
+	cleanup_called = 0;
+	igt_subtest_group
+		delegate();
+	igt_subtest("cleanup-after-group-delegation")
+		igt_assert(cleanup_called);
+
+	/* Check what happens with a igt_skip inside a function */
+	cleanup_called = 0;
+	skip_delegate();
+	igt_subtest("cleanup-after-skipped-delegation")
+		igt_assert(cleanup_called);
+
+	cleanup_called = 0;
+	igt_subtest_group
+		skip_delegate();
+	igt_subtest("cleanup-after-group-skipped-0delegation")
+		igt_assert(cleanup_called);
+}
diff --git a/lib/tests/meson.build b/lib/tests/meson.build
index ceaf548b2b2f..d5666c246146 100644
--- a/lib/tests/meson.build
+++ b/lib/tests/meson.build
@@ -19,10 +19,12 @@ lib_tests = [
 	'igt_stats',
 	'igt_subtest_group',
 	'igt_thread',
+	'igt_types',
 	'i915_perf_data_alignment',
 ]
 
 lib_fail_tests = [
+	'bad_subtest_type',
 	'igt_no_subtest',
 	'igt_simple_test_subtests',
 	'igt_timeout',
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 02/76] i915/gem_basic: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 01/76] lib: Introduce typed cleanups Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 03/76] i915/gem_flink_basic: " Mauro Carvalho Chehab
                   ` (74 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_basic.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_basic.c b/tests/i915/gem_basic.c
index 17ae190cb2cb..2aa5d850cc10 100644
--- a/tests/i915/gem_basic.c
+++ b/tests/i915/gem_basic.c
@@ -25,7 +25,6 @@
  *
  */
 
-#include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -37,7 +36,10 @@
 #include <sys/ioctl.h>
 
 #include "drm.h"
+
 #include "i915/gem_create.h"
+#include "igt.h"
+#include "igt_types.h"
 
 IGT_TEST_DESCRIPTION("Tests basic gem_create and gem_close IOCTLs");
 
@@ -78,10 +80,10 @@ test_create_fd_close(int fd)
 	close(fd);
 }
 
-int fd;
-
 igt_main
 {
+	igt_fd_t(fd);
+
 	igt_fixture
 		fd = drm_open_driver(DRIVER_INTEL);
 
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 03/76] i915/gem_flink_basic: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 01/76] lib: Introduce typed cleanups Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 02/76] i915/gem_basic: Close device before exit Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 04/76] i915/gem_linear_blits: " Mauro Carvalho Chehab
                   ` (73 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_flink_basic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_flink_basic.c b/tests/i915/gem_flink_basic.c
index 4e207c2ab546..2620bc55daf0 100644
--- a/tests/i915/gem_flink_basic.c
+++ b/tests/i915/gem_flink_basic.c
@@ -25,7 +25,6 @@
  *
  */
 
-#include "igt.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -34,8 +33,12 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
+
 #include "drm.h"
 
+#include "igt.h"
+#include "igt_types.h"
+
 IGT_TEST_DESCRIPTION("Tests for flink - a way to export a gem object by name");
 
 static void
@@ -152,12 +155,14 @@ test_flink_lifetime(int fd)
 	ret = ioctl(fd2, DRM_IOCTL_GEM_OPEN, &open_struct);
 	igt_assert_eq(ret, 0);
 	igt_assert(open_struct.handle != 0);
-}
 
-int fd;
+	close(fd2);
+}
 
 igt_main
 {
+	igt_fd_t(fd);
+
 	igt_fixture
 		fd = drm_open_driver(DRIVER_INTEL);
 
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 04/76] i915/gem_linear_blits: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (2 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 03/76] i915/gem_flink_basic: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 05/76] i915/gem_blits: " Mauro Carvalho Chehab
                   ` (72 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_linear_blits.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_linear_blits.c b/tests/i915/gem_linear_blits.c
index 1fd5b733c3ce..d02751be9232 100644
--- a/tests/i915/gem_linear_blits.c
+++ b/tests/i915/gem_linear_blits.c
@@ -47,6 +47,7 @@
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
+#include "igt_types.h"
 
 IGT_TEST_DESCRIPTION("Test doing many blits with a working set larger than the"
 		     " aperture size.");
@@ -236,7 +237,7 @@ igt_main
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	uint64_t count = 0;
 	bool do_relocs;
-	int fd = -1;
+	igt_fd_t(fd);
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 05/76] i915/gem_blits: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (3 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 04/76] i915/gem_linear_blits: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 06/76] i915/gem_close: " Mauro Carvalho Chehab
                   ` (71 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_blits.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/gem_blits.c b/tests/i915/gem_blits.c
index 46f157b9367a..24e83b9f512d 100644
--- a/tests/i915/gem_blits.c
+++ b/tests/i915/gem_blits.c
@@ -852,5 +852,6 @@ igt_main
 
 	igt_fixture {
 		put_ahnd(device.ahnd);
+		close(device.fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 06/76] i915/gem_close: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (4 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 05/76] i915/gem_blits: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 07/76] i915/gem_create: " Mauro Carvalho Chehab
                   ` (70 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_close.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_close.c b/tests/i915/gem_close.c
index ee2d690bfb54..e1ae701c17a1 100644
--- a/tests/i915/gem_close.c
+++ b/tests/i915/gem_close.c
@@ -24,6 +24,7 @@
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
+#include "igt_types.h"
 
 static int batch_create(int fd)
 {
@@ -125,7 +126,7 @@ static void test_many_handles(int fd)
 
 igt_main
 {
-	int fd = -1;
+	igt_fd_t(fd);
 
 	igt_fixture {
 		/* Create an flink requires DRM_AUTH */
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 07/76] i915/gem_create: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (5 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 06/76] i915/gem_close: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 08/76] i915/gem_ctx_engines: " Mauro Carvalho Chehab
                   ` (69 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_create.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index c39390f3266b..c0c7c1883626 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -54,6 +54,7 @@
 #include "intel_chipset.h"
 #include "igt_aux.h"
 #include "igt_dummyload.h"
+#include "igt_types.h"
 #include "igt_x86.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
@@ -828,7 +829,7 @@ static void create_ext_cpu_access_big(int fd)
 
 igt_main
 {
-	int fd = -1;
+	igt_fd_t(fd);
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 08/76] i915/gem_ctx_engines: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (6 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 07/76] i915/gem_create: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 09/76] i915/gem_ctx_shared: " Mauro Carvalho Chehab
                   ` (68 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_ctx_engines.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_ctx_engines.c b/tests/i915/gem_ctx_engines.c
index 4b8e51457a8f..b0646516fa6f 100644
--- a/tests/i915/gem_ctx_engines.c
+++ b/tests/i915/gem_ctx_engines.c
@@ -41,6 +41,7 @@
 #include "i915/gem_context.h"
 #include "i915/gem_create.h"
 #include "igt.h"
+#include "igt_types.h"
 #include "sw_sync.h"
 
 #define engine_class(e, n) ((e)->engines[(n)].engine_class)
@@ -593,7 +594,7 @@ static void independent_all(int i915, const intel_ctx_t *ctx)
 igt_main
 {
 	const struct intel_execution_engine2 *e;
-	int i915 = -1;
+	igt_fd_t(i915);
 
 	igt_fixture {
 		i915 = drm_open_driver(DRIVER_INTEL);
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 09/76] i915/gem_ctx_shared: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (7 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 08/76] i915/gem_ctx_engines: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 10/76] i915/gem_exec_alignment: " Mauro Carvalho Chehab
                   ` (67 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_ctx_shared.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_ctx_shared.c b/tests/i915/gem_ctx_shared.c
index eb3b024f8e5b..d6b56b72abdc 100644
--- a/tests/i915/gem_ctx_shared.c
+++ b/tests/i915/gem_ctx_shared.c
@@ -42,6 +42,7 @@
 #include "i915/gem_engine_topology.h"
 #include "i915/gem_vm.h"
 #include "igt.h"
+#include "igt_types.h"
 #include "igt_rand.h"
 #include "igt_vgem.h"
 #include "sw_sync.h"
@@ -987,7 +988,7 @@ igt_main
 {
 	const struct intel_execution_engine2 *e;
 	intel_ctx_cfg_t cfg;
-	int i915 = -1;
+	igt_fd_t(i915);
 
 	igt_fixture {
 		i915 = drm_open_driver(DRIVER_INTEL);
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 10/76] i915/gem_exec_alignment: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (8 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 09/76] i915/gem_ctx_shared: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 11/76] i915/gem_render_copy: " Mauro Carvalho Chehab
                   ` (66 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_exec_alignment.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_exec_alignment.c b/tests/i915/gem_exec_alignment.c
index 3e5f9d52cbed..a9fcd2a747d1 100644
--- a/tests/i915/gem_exec_alignment.c
+++ b/tests/i915/gem_exec_alignment.c
@@ -44,6 +44,7 @@
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
+#include "igt_types.h"
 
 IGT_TEST_DESCRIPTION("Exercises the basic execbuffer using object alignments");
 
@@ -525,7 +526,7 @@ static void single(int fd)
 
 igt_main
 {
-	int fd = -1;
+	igt_fd_t(fd);
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 11/76] i915/gem_render_copy: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (9 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 10/76] i915/gem_exec_alignment: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 12/76] i915/gem_render_copy_redux: " Mauro Carvalho Chehab
                   ` (65 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_render_copy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/gem_render_copy.c b/tests/i915/gem_render_copy.c
index 3da29ec4e316..70b96c8f42ad 100644
--- a/tests/i915/gem_render_copy.c
+++ b/tests/i915/gem_render_copy.c
@@ -879,5 +879,6 @@ igt_main_args("dac", NULL, help_str, opt_handler, NULL)
 		igt_stop_hang_detector();
 		buf_ops_destroy(data.bops);
 		igt_collection_destroy(set);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 12/76] i915/gem_render_copy_redux: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (10 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 11/76] i915/gem_render_copy: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 13/76] i915/gem_media_fill: " Mauro Carvalho Chehab
                   ` (64 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_render_copy_redux.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/i915/gem_render_copy_redux.c b/tests/i915/gem_render_copy_redux.c
index 525c14d1814d..5e1daccf1801 100644
--- a/tests/i915/gem_render_copy_redux.c
+++ b/tests/i915/gem_render_copy_redux.c
@@ -233,4 +233,8 @@ igt_main
 			copy_flink(&data);
 		igt_stop_signal_helper();
 	}
+
+	igt_fixture {
+		data_fini(&data);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 13/76] i915/gem_media_fill: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (11 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 12/76] i915/gem_render_copy_redux: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 14/76] i915/gem_userptr_blits: " Mauro Carvalho Chehab
                   ` (63 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_media_fill.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/gem_media_fill.c b/tests/i915/gem_media_fill.c
index 1d08df2473d1..e418047c2e74 100644
--- a/tests/i915/gem_media_fill.c
+++ b/tests/i915/gem_media_fill.c
@@ -173,5 +173,6 @@ igt_main
 	igt_fixture {
 		igt_collection_destroy(set);
 		igt_stop_hang_detector();
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 14/76] i915/gem_userptr_blits: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (12 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 13/76] i915/gem_media_fill: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 15/76] i915/gem_workarounds: " Mauro Carvalho Chehab
                   ` (62 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_userptr_blits.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 1343b1097aef..6985086694c4 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -62,6 +62,7 @@
 #include "i915/gem_create.h"
 #include "igt.h"
 #include "igt_sysfs.h"
+#include "igt_types.h"
 #include "sw_sync.h"
 
 #include "eviction_common.c"
@@ -2299,7 +2300,7 @@ static void test_userfault(int i915)
 
 uint64_t total_ram;
 uint64_t aperture_size;
-int fd, count;
+int count;
 
 static int opt_handler(int opt, int opt_index, void *data)
 {
@@ -2319,6 +2320,7 @@ const char *help_str = "  -c\tBuffer count\n";
 igt_main_args("c:", NULL, help_str, opt_handler, NULL)
 {
 	int size = sizeof(linear);
+	igt_fd_t(fd);
 
 	igt_fixture {
 		unsigned int mmo_max = 0;
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 15/76] i915/gem_workarounds: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (13 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 14/76] i915/gem_userptr_blits: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 16/76] i915/gem_unref_active_buffers: " Mauro Carvalho Chehab
                   ` (61 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_workarounds.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_workarounds.c b/tests/i915/gem_workarounds.c
index fc5184925a88..5fb2d73fdd30 100644
--- a/tests/i915/gem_workarounds.c
+++ b/tests/i915/gem_workarounds.c
@@ -31,6 +31,7 @@
 #include "i915/gem_create.h"
 #include "igt.h"
 #include "igt_device.h"
+#include "igt_types.h"
 
 #define PAGE_SIZE 4096
 #define PAGE_ALIGN(x) ALIGN(x, PAGE_SIZE)
@@ -238,7 +239,6 @@ static void check_workarounds(int fd, enum operation op, unsigned int flags)
 igt_main
 {
 	struct intel_mmio_data mmio_data;
-	int device = -1;
 	const struct {
 		const char *name;
 		enum operation op;
@@ -258,6 +258,7 @@ igt_main
 		{ "-fd", FD },
 		{ }
 	}, *m;
+	igt_fd_t(device);
 
 	igt_fixture {
 		FILE *file;
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 16/76] i915/gem_unref_active_buffers: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (14 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 15/76] i915/gem_workarounds: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 17/76] i915/gem_exec_endless: " Mauro Carvalho Chehab
                   ` (60 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_unref_active_buffers.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/gem_unref_active_buffers.c b/tests/i915/gem_unref_active_buffers.c
index 3b8c981dae62..735c1472038a 100644
--- a/tests/i915/gem_unref_active_buffers.c
+++ b/tests/i915/gem_unref_active_buffers.c
@@ -121,4 +121,5 @@ igt_simple_main
 
 	igt_spin_free(i915, spin);
 	put_ahnd(ahnd);
+	close(i915);
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 17/76] i915/gem_exec_endless: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (15 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 16/76] i915/gem_unref_active_buffers: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
       [not found]   ` <YzbgHzTKxDBM9DjG@kamilkon-desk1>
  2022-09-26  6:17 ` [igt-dev] [PATCH 18/76] i915/gem_request_retire: " Mauro Carvalho Chehab
                   ` (59 subsequent siblings)
  76 siblings, 1 reply; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_exec_endless.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_exec_endless.c b/tests/i915/gem_exec_endless.c
index b83d5a2c1480..2c56cc212036 100644
--- a/tests/i915/gem_exec_endless.c
+++ b/tests/i915/gem_exec_endless.c
@@ -28,6 +28,7 @@
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
+#include "igt_types.h"
 #include "sw_sync.h"
 
 #define MAX_ENGINES 64
@@ -341,7 +342,7 @@ static void unpin_rps(int sysfs)
 igt_main
 {
 	const struct intel_execution_engine2 *e;
-	int i915 = -1;
+	igt_fd_t(i915);
 
 	igt_skip_on_simulation();
 
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 18/76] i915/gem_request_retire: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (16 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 17/76] i915/gem_exec_endless: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 19/76] i915/gem_unfence_active_buffers: " Mauro Carvalho Chehab
                   ` (58 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_request_retire.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_request_retire.c b/tests/i915/gem_request_retire.c
index da9d405ed443..9e163bd3af60 100644
--- a/tests/i915/gem_request_retire.c
+++ b/tests/i915/gem_request_retire.c
@@ -48,6 +48,7 @@
 
 #include "i915/gem.h"
 #include "igt.h"
+#include "igt_types.h"
 
 IGT_TEST_DESCRIPTION("Collection of tests targeting request retirement code"
 		     " paths.");
@@ -103,10 +104,10 @@ test_retire_vma_not_inactive(int fd)
 	put_ahnd(ahnd);
 }
 
-int fd;
-
 igt_main
 {
+	igt_fd_t(fd);
+
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 19/76] i915/gem_unfence_active_buffers: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (17 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 18/76] i915/gem_request_retire: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 20/76] i915/i915_pciid: " Mauro Carvalho Chehab
                   ` (57 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_unfence_active_buffers.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/gem_unfence_active_buffers.c b/tests/i915/gem_unfence_active_buffers.c
index 532eed2e76d4..a0a601de241d 100644
--- a/tests/i915/gem_unfence_active_buffers.c
+++ b/tests/i915/gem_unfence_active_buffers.c
@@ -99,4 +99,5 @@ igt_simple_main
 
 	igt_spin_free(i915, spin);
 	put_ahnd(ahnd);
+	close(i915);
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 20/76] i915/i915_pciid: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (18 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 19/76] i915/gem_unfence_active_buffers: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 21/76] kms_cursor_legacy: " Mauro Carvalho Chehab
                   ` (56 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/i915_pciid.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/i915/i915_pciid.c b/tests/i915/i915_pciid.c
index 7de44ff2ff1f..377eec58cf13 100644
--- a/tests/i915/i915_pciid.c
+++ b/tests/i915/i915_pciid.c
@@ -64,4 +64,6 @@ igt_simple_main
 	int intel = drm_open_driver(DRIVER_INTEL);
 
 	igt_assert(has_known_intel_chipset(intel));
+
+	close(intel);
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 21/76] kms_cursor_legacy: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (19 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 20/76] i915/i915_pciid: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 22/76] kms_flip: " Mauro Carvalho Chehab
                   ` (55 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_cursor_legacy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 1b69766781c4..1ad92eaae881 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1753,5 +1753,6 @@ igt_main
 		if (intel_psr2_restore)
 			i915_psr2_sel_fetch_restore(display.drm_fd);
 		igt_display_fini(&display);
+		close(display.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 22/76] kms_flip: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (20 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 21/76] kms_cursor_legacy: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 23/76] kms_pipe_crc_basic: " Mauro Carvalho Chehab
                   ` (54 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_flip.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 0567edeaf2ab..5e82f4a2f842 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1877,4 +1877,7 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)
 			run_pair(tests[i].duration, tests[i].flags);
 	}
 	igt_stop_signal_helper();
+
+	igt_fixture
+		close(drm_fd);
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 23/76] kms_pipe_crc_basic: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (21 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 22/76] kms_flip: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 24/76] kms_psr: " Mauro Carvalho Chehab
                   ` (53 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_pipe_crc_basic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 2ff40f72e23e..2985de51c33c 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -362,5 +362,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 24/76] kms_psr: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (22 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 23/76] kms_pipe_crc_basic: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 25/76] kms_flip: " Mauro Carvalho Chehab
                   ` (52 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_psr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_psr.c b/tests/i915/kms_psr.c
index 480e2cc77a2b..59f38e20e55f 100644
--- a/tests/i915/kms_psr.c
+++ b/tests/i915/kms_psr.c
@@ -592,5 +592,6 @@ igt_main_args("", long_options, help_str, opt_handler, &data)
 		close(data.debugfs_fd);
 		buf_ops_destroy(data.bops);
 		display_fini(&data);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 25/76] kms_flip: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (23 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 24/76] kms_psr: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 26/76] kms_force_connector_basic: " Mauro Carvalho Chehab
                   ` (51 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_busy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_busy.c b/tests/i915/kms_busy.c
index 99a07c2aecbd..171ae4ecebff 100644
--- a/tests/i915/kms_busy.c
+++ b/tests/i915/kms_busy.c
@@ -436,5 +436,6 @@ igt_main_args("e", NULL, help_str, opt_handler, NULL)
 
 	igt_fixture {
 		igt_display_fini(&display);
+		close(display.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 26/76] kms_force_connector_basic: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (24 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 25/76] kms_flip: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 27/76] dumb_buffer: " Mauro Carvalho Chehab
                   ` (50 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_force_connector_basic.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/kms_force_connector_basic.c b/tests/kms_force_connector_basic.c
index 683d3672056d..6259cec538de 100644
--- a/tests/kms_force_connector_basic.c
+++ b/tests/kms_force_connector_basic.c
@@ -33,9 +33,9 @@ IGT_TEST_DESCRIPTION("Check the debugfs force connector/edid features work"
 
 static void reset_connectors(void)
 {
-	int drm_fd = 0;
 	drmModeRes *res;
 	drmModeConnector *connector = NULL;
+	int drm_fd;
 
 	drm_fd = drm_open_driver_master(DRIVER_ANY);
 	res = drmModeGetResources(drm_fd);
@@ -54,6 +54,8 @@ static void reset_connectors(void)
 	}
 
 	igt_set_module_param_int(drm_fd, "load_detect_test", 0);
+
+	close(drm_fd);
 }
 
 static int opt_handler(int opt, int opt_index, void *data)
@@ -224,6 +226,9 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
 
 			drmModeFreePlane(drm_plane);
 		}
+
+		igt_remove_fb(drm_fd, &xrgb_fb);
+		igt_remove_fb(drm_fd, &argb_fb);
 	}
 
 	igt_describe("Test to check the forced connector state.");
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 27/76] dumb_buffer: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (25 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 26/76] kms_force_connector_basic: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 28/76] kms_atomic: " Mauro Carvalho Chehab
                   ` (49 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/dumb_buffer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/dumb_buffer.c b/tests/dumb_buffer.c
index 2c6261bd7d75..ded6b809c262 100644
--- a/tests/dumb_buffer.c
+++ b/tests/dumb_buffer.c
@@ -392,4 +392,8 @@ igt_main
 
 	igt_subtest("create-clear")
 		always_clear(fd, 30);
+
+	igt_fixture {
+		close(fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 28/76] kms_atomic: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (26 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 27/76] dumb_buffer: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 29/76] kms_atomic_interruptible: " Mauro Carvalho Chehab
                   ` (48 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_atomic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 253829f2bd14..831ba2587292 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -1436,5 +1436,6 @@ igt_main
 		igt_remove_fb(display.drm_fd, &fb);
 
 		igt_display_fini(&display);
+		close(display.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 29/76] kms_atomic_interruptible: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (27 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 28/76] kms_atomic: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 30/76] kms_atomic_transition: " Mauro Carvalho Chehab
                   ` (47 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_atomic_interruptible.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_atomic_interruptible.c b/tests/kms_atomic_interruptible.c
index 038cb2867989..f461a15c9f4c 100644
--- a/tests/kms_atomic_interruptible.c
+++ b/tests/kms_atomic_interruptible.c
@@ -349,5 +349,6 @@ igt_main
 	/* TODO: legacy gamma_set/get, object set/getprop, getcrtc, getconnector */
 	igt_fixture {
 		igt_display_fini(&display);
+		close(display.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 30/76] kms_atomic_transition: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (28 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 29/76] kms_atomic_interruptible: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 31/76] i915/kms_big_fb: " Mauro Carvalho Chehab
                   ` (46 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_atomic_transition.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 4c62e9093c28..247b0be4654d 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -1132,5 +1132,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 31/76] i915/kms_big_fb: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (29 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 30/76] kms_atomic_transition: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 32/76] i915/kms_ccs: " Mauro Carvalho Chehab
                   ` (45 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_big_fb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_big_fb.c b/tests/i915/kms_big_fb.c
index 0c4cd95e7c96..8c7a38160f85 100644
--- a/tests/i915/kms_big_fb.c
+++ b/tests/i915/kms_big_fb.c
@@ -991,5 +991,6 @@ igt_main
 	igt_fixture {
 		igt_display_fini(&data.display);
 		buf_ops_destroy(data.bops);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 32/76] i915/kms_ccs: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (30 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 31/76] i915/kms_big_fb: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 33/76] kms_color: " Mauro Carvalho Chehab
                   ` (44 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_ccs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/i915/kms_ccs.c b/tests/i915/kms_ccs.c
index 4df611f77e0c..6721da493af5 100644
--- a/tests/i915/kms_ccs.c
+++ b/tests/i915/kms_ccs.c
@@ -699,6 +699,8 @@ igt_main_args("cs:", NULL, help_str, opt_handler, &data)
 		}
 	}
 
-	igt_fixture
+	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 33/76] kms_color: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (31 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 32/76] i915/kms_ccs: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 34/76] kms_cursor_crc: " Mauro Carvalho Chehab
                   ` (43 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_color.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index ab285af86501..61ec3b895b4c 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -1058,5 +1058,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 34/76] kms_cursor_crc: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (32 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 33/76] kms_color: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 35/76] i915/kms_big_joiner: " Mauro Carvalho Chehab
                   ` (42 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_cursor_crc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 7c1f74be568d..a0e363032439 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -910,5 +910,6 @@ igt_main
 		}
 
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 35/76] i915/kms_big_joiner: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (33 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 34/76] kms_cursor_crc: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 36/76] i915/kms_cdclk: " Mauro Carvalho Chehab
                   ` (41 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_big_joiner.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_big_joiner.c b/tests/i915/kms_big_joiner.c
index 7d400616f7b5..71b2526d683c 100644
--- a/tests/i915/kms_big_joiner.c
+++ b/tests/i915/kms_big_joiner.c
@@ -328,5 +328,6 @@ igt_main
 	igt_fixture {
 		igt_remove_fb(data.drm_fd, &data.fb);
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 36/76] i915/kms_cdclk: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (34 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 35/76] i915/kms_big_joiner: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 37/76] i915/kms_fence_pin_leak: " Mauro Carvalho Chehab
                   ` (40 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_cdclk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_cdclk.c b/tests/i915/kms_cdclk.c
index 002b631c4b7e..991a7c507a10 100644
--- a/tests/i915/kms_cdclk.c
+++ b/tests/i915/kms_cdclk.c
@@ -373,5 +373,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 37/76] i915/kms_fence_pin_leak: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (35 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 36/76] i915/kms_cdclk: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 38/76] i915/kms_flip_scaled_crc: " Mauro Carvalho Chehab
                   ` (39 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_fence_pin_leak.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_fence_pin_leak.c b/tests/i915/kms_fence_pin_leak.c
index 16eb595fd65d..f1eac1c600ad 100644
--- a/tests/i915/kms_fence_pin_leak.c
+++ b/tests/i915/kms_fence_pin_leak.c
@@ -229,4 +229,5 @@ igt_simple_main
 
 	buf_ops_destroy(data.bops);
 	igt_display_fini(&data.display);
+	close(data.drm_fd);
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 38/76] i915/kms_flip_scaled_crc: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (36 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 37/76] i915/kms_fence_pin_leak: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 39/76] i915/kms_flip_tiling: " Mauro Carvalho Chehab
                   ` (38 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_flip_scaled_crc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_flip_scaled_crc.c b/tests/i915/kms_flip_scaled_crc.c
index 764eb70fde31..364f622ba699 100644
--- a/tests/i915/kms_flip_scaled_crc.c
+++ b/tests/i915/kms_flip_scaled_crc.c
@@ -676,5 +676,6 @@ igt_main
 		}
 		kmstest_set_vt_text_mode();
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 39/76] i915/kms_flip_tiling: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (37 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 38/76] i915/kms_flip_scaled_crc: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 40/76] i915/kms_mmap_write_crc: " Mauro Carvalho Chehab
                   ` (37 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_flip_tiling.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_flip_tiling.c b/tests/i915/kms_flip_tiling.c
index ba9ff46ed150..0d8cc341c0b9 100644
--- a/tests/i915/kms_flip_tiling.c
+++ b/tests/i915/kms_flip_tiling.c
@@ -229,5 +229,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 40/76] i915/kms_mmap_write_crc: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (38 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 39/76] i915/kms_flip_tiling: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 41/76] i915/kms_pipe_b_c_ivb: " Mauro Carvalho Chehab
                   ` (36 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_mmap_write_crc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_mmap_write_crc.c b/tests/i915/kms_mmap_write_crc.c
index a57938b5b8ff..b693c276b2c3 100644
--- a/tests/i915/kms_mmap_write_crc.c
+++ b/tests/i915/kms_mmap_write_crc.c
@@ -299,5 +299,6 @@ igt_main_args("n", NULL, NULL, opt_handler, NULL)
 		close(data.drm_fd);
 
 		igt_stop_helper(&hog);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 41/76] i915/kms_pipe_b_c_ivb: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (39 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 40/76] i915/kms_mmap_write_crc: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 42/76] i915/kms_psr2_sf: " Mauro Carvalho Chehab
                   ` (35 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_pipe_b_c_ivb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_pipe_b_c_ivb.c b/tests/i915/kms_pipe_b_c_ivb.c
index 5823ae2a0885..05ac87702077 100644
--- a/tests/i915/kms_pipe_b_c_ivb.c
+++ b/tests/i915/kms_pipe_b_c_ivb.c
@@ -291,5 +291,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 42/76] i915/kms_psr2_sf: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (40 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 41/76] i915/kms_pipe_b_c_ivb: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 43/76] i915/kms_psr2_su: " Mauro Carvalho Chehab
                   ` (34 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_psr2_sf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_psr2_sf.c b/tests/i915/kms_psr2_sf.c
index 6612587c6b24..c9e6f2d0862b 100644
--- a/tests/i915/kms_psr2_sf.c
+++ b/tests/i915/kms_psr2_sf.c
@@ -1034,5 +1034,6 @@ igt_main
 	igt_fixture {
 		close(data.debugfs_fd);
 		display_fini(&data);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 43/76] i915/kms_psr2_su: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (41 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 42/76] i915/kms_psr2_sf: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 44/76] i915/kms_pwrite_crc: " Mauro Carvalho Chehab
                   ` (33 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_psr2_su.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_psr2_su.c b/tests/i915/kms_psr2_su.c
index caccf713d86e..6062f9d87186 100644
--- a/tests/i915/kms_psr2_su.c
+++ b/tests/i915/kms_psr2_su.c
@@ -335,5 +335,6 @@ igt_main
 	igt_fixture {
 		close(data.debugfs_fd);
 		display_fini(&data);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 44/76] i915/kms_pwrite_crc: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (42 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 43/76] i915/kms_psr2_su: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 45/76] kms_flip_event_leak: " Mauro Carvalho Chehab
                   ` (32 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/kms_pwrite_crc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/kms_pwrite_crc.c b/tests/i915/kms_pwrite_crc.c
index 584e6a19ce9d..7df4b36924fa 100644
--- a/tests/i915/kms_pwrite_crc.c
+++ b/tests/i915/kms_pwrite_crc.c
@@ -191,4 +191,5 @@ igt_simple_main
 	run_test(&data);
 
 	igt_display_fini(&data.display);
+	close(data.drm_fd);
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 45/76] kms_flip_event_leak: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (43 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 44/76] i915/kms_pwrite_crc: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 46/76] kms_hdr: " Mauro Carvalho Chehab
                   ` (31 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_flip_event_leak.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_flip_event_leak.c b/tests/kms_flip_event_leak.c
index 9815f1e2d08c..56ff2af2832b 100644
--- a/tests/kms_flip_event_leak.c
+++ b/tests/kms_flip_event_leak.c
@@ -115,5 +115,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 46/76] kms_hdr: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (44 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 45/76] kms_flip_event_leak: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 47/76] kms_invalid_mode: " Mauro Carvalho Chehab
                   ` (30 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_hdr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
index e2650f51331f..c18acb60f99e 100644
--- a/tests/kms_hdr.c
+++ b/tests/kms_hdr.c
@@ -615,5 +615,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 47/76] kms_invalid_mode: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (45 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 46/76] kms_hdr: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 48/76] kms_panel_fitting: " Mauro Carvalho Chehab
                   ` (29 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_invalid_mode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_invalid_mode.c b/tests/kms_invalid_mode.c
index 0ae98a31fcc2..f1c38669860d 100644
--- a/tests/kms_invalid_mode.c
+++ b/tests/kms_invalid_mode.c
@@ -306,5 +306,6 @@ igt_main
 	igt_fixture {
 		igt_display_fini(&data.display);
 		igt_reset_connectors();
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 48/76] kms_panel_fitting: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (46 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 47/76] kms_invalid_mode: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 49/76] kms_plane: " Mauro Carvalho Chehab
                   ` (28 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_panel_fitting.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index 478c16bd5f37..2d0590da2ec6 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -280,6 +280,8 @@ igt_main
 	igt_subtest_with_dynamic("atomic-fastset")
 		test_panel_fitting(&data, TEST_ATOMIC);
 
-	igt_fixture
+	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 49/76] kms_plane: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (47 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 48/76] kms_panel_fitting: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 50/76] kms_plane_alpha_blend: " Mauro Carvalho Chehab
                   ` (27 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_plane.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 3cf3cfd3a095..eb943e13f408 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -1213,5 +1213,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 50/76] kms_plane_alpha_blend: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (48 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 49/76] kms_plane: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 51/76] kms_plane_cursor: " Mauro Carvalho Chehab
                   ` (26 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_plane_alpha_blend.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_plane_alpha_blend.c b/tests/kms_plane_alpha_blend.c
index bd064d1e494b..f8660f14e94d 100644
--- a/tests/kms_plane_alpha_blend.c
+++ b/tests/kms_plane_alpha_blend.c
@@ -586,5 +586,6 @@ igt_main
 				    COMMIT_ATOMIC : COMMIT_LEGACY);
 
 		igt_display_fini(&data.display);
+		close(data.gfx_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 51/76] kms_plane_cursor: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (49 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 50/76] kms_plane_alpha_blend: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 52/76] kms_plane_multiple: " Mauro Carvalho Chehab
                   ` (25 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_plane_cursor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_plane_cursor.c b/tests/kms_plane_cursor.c
index 6b7e5cef5662..95925ea20db1 100644
--- a/tests/kms_plane_cursor.c
+++ b/tests/kms_plane_cursor.c
@@ -310,5 +310,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 52/76] kms_plane_multiple: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (50 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 51/76] kms_plane_cursor: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 53/76] kms_plane_scaling: " Mauro Carvalho Chehab
                   ` (24 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_plane_multiple.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index cbe8c18971b3..e958fc786f19 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -468,6 +468,8 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 			run_test(&data, subtests[i].modifier);
 	}
 
-	igt_fixture
+	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 53/76] kms_plane_scaling: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (51 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 52/76] kms_plane_multiple: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:17 ` [igt-dev] [PATCH 54/76] kms_properties: " Mauro Carvalho Chehab
                   ` (23 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_plane_scaling.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index fc8250b5053c..4c621cce8425 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -983,6 +983,8 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 	igt_subtest_f("2x-scaler-multi-pipe")
 		test_scaler_with_multi_pipe_plane(&data);
 
-	igt_fixture
+	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 54/76] kms_properties: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (52 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 53/76] kms_plane_scaling: " Mauro Carvalho Chehab
@ 2022-09-26  6:17 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 55/76] kms_rotation_crc: " Mauro Carvalho Chehab
                   ` (22 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:17 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_properties.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_properties.c b/tests/kms_properties.c
index dd5a93aa7a77..2958efaca7ab 100644
--- a/tests/kms_properties.c
+++ b/tests/kms_properties.c
@@ -792,5 +792,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&display);
+		close(display.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 55/76] kms_rotation_crc: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (53 preceding siblings ...)
  2022-09-26  6:17 ` [igt-dev] [PATCH 54/76] kms_properties: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 56/76] kms_sequence: " Mauro Carvalho Chehab
                   ` (21 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_rotation_crc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 50869a08a275..db53f5d144ea 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -1187,5 +1187,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.gfx_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 56/76] kms_sequence: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (54 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 55/76] kms_rotation_crc: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 57/76] kms_universal_plane: " Mauro Carvalho Chehab
                   ` (20 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_sequence.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/kms_sequence.c b/tests/kms_sequence.c
index 1655d7d1bc7d..c72857a394c7 100644
--- a/tests/kms_sequence.c
+++ b/tests/kms_sequence.c
@@ -295,4 +295,8 @@ igt_main
 			}
 		}
 	}
+
+	igt_fixture {
+		close(fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 57/76] kms_universal_plane: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (55 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 56/76] kms_sequence: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 58/76] kms_vblank: " Mauro Carvalho Chehab
                   ` (19 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_universal_plane.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index 432f56ba2442..64416afd3920 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -823,5 +823,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 58/76] kms_vblank: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (56 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 57/76] kms_universal_plane: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 59/76] syncobj_wait: " Mauro Carvalho Chehab
                   ` (18 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_vblank.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index e65e8522a861..5bd3fefe1440 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -550,4 +550,8 @@ igt_main
 	for_each_pipe_static(data.pipe)
 		igt_subtest_group
 			run_subtests_for_pipe(&data);
+
+	igt_fixture {
+		close(fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 59/76] syncobj_wait: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (57 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 58/76] kms_vblank: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 60/76] syncobj_basic: " Mauro Carvalho Chehab
                   ` (17 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/syncobj_wait.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/syncobj_wait.c b/tests/syncobj_wait.c
index 669d0adfc10d..427b6b1192ad 100644
--- a/tests/syncobj_wait.c
+++ b/tests/syncobj_wait.c
@@ -912,4 +912,8 @@ igt_main
 
 	igt_subtest("wait-all-interrupted")
 		test_wait_interrupted(fd, WAIT_ALL);
+
+	igt_fixture {
+		close(fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 60/76] syncobj_basic: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (58 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 59/76] syncobj_wait: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 61/76] syncobj_timeline: " Mauro Carvalho Chehab
                   ` (16 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/syncobj_basic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/syncobj_basic.c b/tests/syncobj_basic.c
index 1dce45c918ac..6e20c3411a87 100644
--- a/tests/syncobj_basic.c
+++ b/tests/syncobj_basic.c
@@ -231,4 +231,8 @@ igt_main
 	igt_subtest("test-valid-cycle")
 		test_valid_cycle(fd);
 
+	igt_fixture {
+		close(fd);
+	}
+
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 61/76] syncobj_timeline: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (59 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 60/76] syncobj_basic: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 62/76] drm_import_export: " Mauro Carvalho Chehab
                   ` (15 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/syncobj_timeline.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/syncobj_timeline.c b/tests/syncobj_timeline.c
index 20375cdd38dc..7f5ff6f6cad6 100644
--- a/tests/syncobj_timeline.c
+++ b/tests/syncobj_timeline.c
@@ -1536,4 +1536,8 @@ igt_main
 	igt_describe(test_32bits_limit_desc);
 	igt_subtest("32bits-limit")
 		test_32bits_limit(fd);
+
+	igt_fixture {
+		close(fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 62/76] drm_import_export: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (60 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 61/76] syncobj_timeline: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 63/76] kms_dp_aux_dev: " Mauro Carvalho Chehab
                   ` (14 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/drm_import_export.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/drm_import_export.c b/tests/drm_import_export.c
index 06245e8bac9f..2dd2f3cb9fff 100644
--- a/tests/drm_import_export.c
+++ b/tests/drm_import_export.c
@@ -296,4 +296,9 @@ igt_main {
 		pthread_join(test_thread_id3, NULL);
 		pthread_join(test_thread_id4, NULL);
 	}
+
+	igt_fixture {
+		close(fd);
+		close(fd1);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 63/76] kms_dp_aux_dev: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (61 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 62/76] drm_import_export: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 64/76] kms_hdmi_inject: " Mauro Carvalho Chehab
                   ` (13 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_dp_aux_dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_dp_aux_dev.c b/tests/kms_dp_aux_dev.c
index d3249fa3d68d..ed9dd510cea6 100644
--- a/tests/kms_dp_aux_dev.c
+++ b/tests/kms_dp_aux_dev.c
@@ -134,4 +134,5 @@ igt_simple_main
 	igt_require(valid_connectors);
 
 	drmModeFreeResources(res);
+	close(drm_fd);
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 64/76] kms_hdmi_inject: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (62 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 63/76] kms_dp_aux_dev: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 65/76] kms_3d: " Mauro Carvalho Chehab
                   ` (12 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_hdmi_inject.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_hdmi_inject.c b/tests/kms_hdmi_inject.c
index abae0ab44feb..b6418faf0eaf 100644
--- a/tests/kms_hdmi_inject.c
+++ b/tests/kms_hdmi_inject.c
@@ -219,5 +219,6 @@ igt_main
 
 	igt_fixture {
 		drmModeFreeConnector(connector);
+		close(drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 65/76] kms_3d: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (63 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 64/76] kms_hdmi_inject: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 66/76] kms_scaling_modes: " Mauro Carvalho Chehab
                   ` (11 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_3d.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_3d.c b/tests/kms_3d.c
index 1488cc146728..c6bef67c1c0f 100644
--- a/tests/kms_3d.c
+++ b/tests/kms_3d.c
@@ -111,4 +111,5 @@ igt_simple_main
 	kmstest_force_edid(drm_fd, connector, NULL);
 
 	drmModeFreeConnector(connector);
+	close(drm_fd);
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 66/76] kms_scaling_modes: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (64 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 65/76] kms_3d: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 67/76] kms_dither: " Mauro Carvalho Chehab
                   ` (10 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_scaling_modes.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_scaling_modes.c b/tests/kms_scaling_modes.c
index 8e80189ac6bb..039e4a8d9303 100644
--- a/tests/kms_scaling_modes.c
+++ b/tests/kms_scaling_modes.c
@@ -132,6 +132,8 @@ igt_main
 	igt_subtest_with_dynamic("scaling-mode-none")
 		test_scaling_mode(&data, DRM_MODE_SCALE_NONE);
 
-	igt_fixture
+	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 67/76] kms_dither: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (65 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 66/76] kms_scaling_modes: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 68/76] drm_read: " Mauro Carvalho Chehab
                   ` (9 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_dither.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_dither.c b/tests/kms_dither.c
index 43a25e203ef4..95be6e136c61 100644
--- a/tests/kms_dither.c
+++ b/tests/kms_dither.c
@@ -247,5 +247,6 @@ igt_main
 
 	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 68/76] drm_read: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (66 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 67/76] kms_dither: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 69/76] kms_cursor_edge_walk: " Mauro Carvalho Chehab
                   ` (8 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/drm_read.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/drm_read.c b/tests/drm_read.c
index 4a966a23b550..36dc623ede13 100644
--- a/tests/drm_read.c
+++ b/tests/drm_read.c
@@ -46,6 +46,8 @@
 #include <pthread.h>
 #include "drm.h"
 
+#include "igt_types.h"
+
 IGT_TEST_DESCRIPTION("Call read(drm) and see if it behaves.");
 
 static void sighandler(int sig, siginfo_t * info, void *context)
@@ -253,10 +255,10 @@ static void test_short_buffer_wakeup(int in, enum pipe pipe)
 
 igt_main
 {
-	int fd;
 	igt_display_t display;
 	struct igt_fb fb;
 	enum pipe pipe;
+	igt_fd_t(fd);
 
 	igt_fixture {
 		struct sigaction alarm_action = {};
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 69/76] kms_cursor_edge_walk: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (67 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 68/76] drm_read: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 70/76] kms_plane_lowres: " Mauro Carvalho Chehab
                   ` (7 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_cursor_edge_walk.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_cursor_edge_walk.c b/tests/kms_cursor_edge_walk.c
index b75fc216f9f2..74187613276e 100644
--- a/tests/kms_cursor_edge_walk.c
+++ b/tests/kms_cursor_edge_walk.c
@@ -362,6 +362,8 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
 		}
 	}
 
-	igt_fixture
+	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 70/76] kms_plane_lowres: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (68 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 69/76] kms_cursor_edge_walk: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 71/76] kms_content_protection: " Mauro Carvalho Chehab
                   ` (6 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_plane_lowres.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index f37dbd16ac03..bb6cffac0911 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -334,6 +334,8 @@ igt_main
 			run_test(&data, subtests[i].modifier);
 	}
 
-	igt_fixture
+	igt_fixture {
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
+	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 71/76] kms_content_protection: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (69 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 70/76] kms_plane_lowres: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 72/76] feature_discovery: " Mauro Carvalho Chehab
                   ` (5 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/kms_content_protection.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 3041f1cddf8b..095cc94b446b 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -839,5 +839,6 @@ igt_main
 	igt_fixture {
 		test_content_protection_cleanup();
 		igt_display_fini(&data.display);
+		close(data.drm_fd);
 	}
 }
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 72/76] feature_discovery: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (70 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 71/76] kms_content_protection: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 73/76] i915/i915_pm_dc: " Mauro Carvalho Chehab
                   ` (4 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/feature_discovery.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/feature_discovery.c b/tests/feature_discovery.c
index 1978ce890de2..d369812ae614 100644
--- a/tests/feature_discovery.c
+++ b/tests/feature_discovery.c
@@ -29,15 +29,16 @@
 #include "igt_kms.h"
 #include "igt_psr.h"
 #include "igt_sysfs.h"
+#include "igt_types.h"
 
-static int fd;
-static int debugfs_fd;
 static igt_display_t display;
 
 IGT_TEST_DESCRIPTION("A metatest that checks for \"features\" presence. "
 		     "The subtests here should only skip or pass, "
 		     "anything else means we have a serious problem.");
 igt_main {
+	igt_fd_t(debugfs_fd);
+	igt_fd_t(fd);
 
 	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_ANY);
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 73/76] i915/i915_pm_dc: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (71 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 72/76] feature_discovery: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 74/76] core_auth: Close(master) " Mauro Carvalho Chehab
                   ` (3 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/i915_pm_dc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index 73c85cd6d2d6..ba49d014a8c4 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -573,6 +573,7 @@ igt_main
 		close(data.debugfs_fd);
 		close(data.msr_fd);
 		display_fini(&data);
+		close(data.drm_fd);
 	}
 
 	igt_exit();
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 74/76] core_auth: Close(master) before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (72 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 73/76] i915/i915_pm_dc: " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 75/76] i915/gem_exec_balancer: Close device " Mauro Carvalho Chehab
                   ` (2 subsequent siblings)
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Add a missing close(master) to the subtest group fixture to prevent a
leak during later tests.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/core_auth.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/core_auth.c b/tests/core_auth.c
index c9ad3fb9c875..257f124820a4 100644
--- a/tests/core_auth.c
+++ b/tests/core_auth.c
@@ -25,7 +25,6 @@
  * Testcase: drmGetMagic() and drmAuthMagic()
  */
 
-#include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -48,6 +47,9 @@
 # include <pthread.h>
 #endif
 
+#include "igt.h"
+#include "igt_types.h"
+
 IGT_TEST_DESCRIPTION("Call drmGetMagic() and drmAuthMagic() and see if it behaves.");
 
 static bool
@@ -192,8 +194,6 @@ static void test_basic_auth(int master)
 
 igt_main
 {
-	int master;
-
 	/* root (which we run igt as) should always be authenticated */
 	igt_describe("Check drm client is always authenticated.");
 	igt_subtest("getclient-simple") {
@@ -220,6 +220,8 @@ igt_main
 
 	/* above tests require that no drm fd is open */
 	igt_subtest_group {
+		igt_fd_t(master);
+
 		igt_fixture
 			master = drm_open_driver_master(DRIVER_ANY);
 	
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 75/76] i915/gem_exec_balancer: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (73 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 74/76] core_auth: Close(master) " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
  2022-09-26  6:18 ` [igt-dev] [PATCH 76/76] i915/gem_ctx_isolation: " Mauro Carvalho Chehab
       [not found] ` <4844cbbf-7add-216d-38f8-4e8c903c06a5@linux.intel.com>
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_exec_balancer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_exec_balancer.c b/tests/i915/gem_exec_balancer.c
index 6e6bf47043d5..4300dbd12f37 100644
--- a/tests/i915/gem_exec_balancer.c
+++ b/tests/i915/gem_exec_balancer.c
@@ -35,6 +35,7 @@
 #include "igt_gt.h"
 #include "igt_perf.h"
 #include "igt_sysfs.h"
+#include "igt_types.h"
 #include "sw_sync.h"
 
 IGT_TEST_DESCRIPTION("Exercise in-kernel load-balancing");
@@ -3302,7 +3303,7 @@ static bool has_parallel_execbuf(int i915)
 
 igt_main
 {
-	int i915 = -1;
+	igt_fd_t(i915);
 
 	igt_fixture {
 		i915 = drm_open_driver(DRIVER_INTEL);
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [igt-dev] [PATCH 76/76] i915/gem_ctx_isolation: Close device before exit
  2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
                   ` (74 preceding siblings ...)
  2022-09-26  6:18 ` [igt-dev] [PATCH 75/76] i915/gem_exec_balancer: Close device " Mauro Carvalho Chehab
@ 2022-09-26  6:18 ` Mauro Carvalho Chehab
       [not found] ` <4844cbbf-7add-216d-38f8-4e8c903c06a5@linux.intel.com>
  76 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-09-26  6:18 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Close the device fd before we check for leaks during the atexit
handlers.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/

 tests/i915/gem_ctx_isolation.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_ctx_isolation.c b/tests/i915/gem_ctx_isolation.c
index 95d13969fa61..dc52a9a03130 100644
--- a/tests/i915/gem_ctx_isolation.c
+++ b/tests/i915/gem_ctx_isolation.c
@@ -25,6 +25,7 @@
 #include "i915/gem_create.h"
 #include "igt.h"
 #include "igt_dummyload.h"
+#include "igt_types.h"
 
 #define MAX_REG 0x200000
 #define NUM_REGS (MAX_REG / sizeof(uint32_t))
@@ -979,7 +980,7 @@ igt_main
 	unsigned int has_context_isolation = 0;
 	const struct intel_execution_engine2 *e;
 	intel_ctx_cfg_t cfg;
-	int i915 = -1;
+	igt_fd_t(i915);
 
 	igt_fixture {
 		int gen;
-- 
2.37.3

^ permalink raw reply related	[flat|nested] 82+ messages in thread

* Re: [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit
       [not found] ` <4844cbbf-7add-216d-38f8-4e8c903c06a5@linux.intel.com>
@ 2022-09-30 12:38   ` Das, Nirmoy
  0 siblings, 0 replies; 82+ messages in thread
From: Das, Nirmoy @ 2022-09-30 12:38 UTC (permalink / raw)
  To: igt-dev

[-- Attachment #1: Type: text/plain, Size: 9267 bytes --]


On 9/30/2022 2:34 PM, Das, Nirmoy wrote:
>
> Hi Mauro,
>
> Is there any reason we are avoid using |igt_fd_t for patches 27,26,22 ?|
>

|Ah never mind, just realized about igt_skip()|


|Nirmoy|

> |For i915 patches Reviewed-by:| Nirmoy Das<nirmoy.das@intel.com>
>
>
> Regards,
>
> Nirmoy
> ||
>
> On 9/26/2022 8:17 AM, Mauro Carvalho Chehab wrote:
>> From: Mauro Carvalho Chehab<mchehab@kernel.org>
>>
>> GCC is usually smart enough to close devices on exit, but that doesn't work
>> with the logic inside igt_skip(), as it uses longjmp, causing the code to
>> go out of scope. Such scoped variables must be tracked in an outer scope to
>> the skipping subtest.
>>
>> Change the logic on IGT tests in order to avoid keeping device opened at
>> the end of the test.
>>
>> Chris Wilson (76):
>>    lib: Introduce typed cleanups
>>    i915/gem_basic: Close device before exit
>>    i915/gem_flink_basic: Close device before exit
>>    i915/gem_linear_blits: Close device before exit
>>    i915/gem_blits: Close device before exit
>>    i915/gem_close: Close device before exit
>>    i915/gem_create: Close device before exit
>>    i915/gem_ctx_engines: Close device before exit
>>    i915/gem_ctx_shared: Close device before exit
>>    i915/gem_exec_alignment: Close device before exit
>>    i915/gem_render_copy: Close device before exit
>>    i915/gem_render_copy_redux: Close device before exit
>>    i915/gem_media_fill: Close device before exit
>>    i915/gem_userptr_blits: Close device before exit
>>    i915/gem_workarounds: Close device before exit
>>    i915/gem_unref_active_buffers: Close device before exit
>>    i915/gem_exec_endless: Close device before exit
>>    i915/gem_request_retire: Close device before exit
>>    i915/gem_unfence_active_buffers: Close device before exit
>>    i915/i915_pciid: Close device before exit
>>    kms_cursor_legacy: Close device before exit
>>    kms_flip: Close device before exit
>>    kms_pipe_crc_basic: Close device before exit
>>    kms_psr: Close device before exit
>>    kms_flip: Close device before exit
>>    kms_force_connector_basic: Close device before exit
>>    dumb_buffer: Close device before exit
>>    kms_atomic: Close device before exit
>>    kms_atomic_interruptible: Close device before exit
>>    kms_atomic_transition: Close device before exit
>>    i915/kms_big_fb: Close device before exit
>>    i915/kms_ccs: Close device before exit
>>    kms_color: Close device before exit
>>    kms_cursor_crc: Close device before exit
>>    i915/kms_big_joiner: Close device before exit
>>    i915/kms_cdclk: Close device before exit
>>    i915/kms_fence_pin_leak: Close device before exit
>>    i915/kms_flip_scaled_crc: Close device before exit
>>    i915/kms_flip_tiling: Close device before exit
>>    i915/kms_mmap_write_crc: Close device before exit
>>    i915/kms_pipe_b_c_ivb: Close device before exit
>>    i915/kms_psr2_sf: Close device before exit
>>    i915/kms_psr2_su: Close device before exit
>>    i915/kms_pwrite_crc: Close device before exit
>>    kms_flip_event_leak: Close device before exit
>>    kms_hdr: Close device before exit
>>    kms_invalid_mode: Close device before exit
>>    kms_panel_fitting: Close device before exit
>>    kms_plane: Close device before exit
>>    kms_plane_alpha_blend: Close device before exit
>>    kms_plane_cursor: Close device before exit
>>    kms_plane_multiple: Close device before exit
>>    kms_plane_scaling: Close device before exit
>>    kms_properties: Close device before exit
>>    kms_rotation_crc: Close device before exit
>>    kms_sequence: Close device before exit
>>    kms_universal_plane: Close device before exit
>>    kms_vblank: Close device before exit
>>    syncobj_wait: Close device before exit
>>    syncobj_basic: Close device before exit
>>    syncobj_timeline: Close device before exit
>>    drm_import_export: Close device before exit
>>    kms_dp_aux_dev: Close device before exit
>>    kms_hdmi_inject: Close device before exit
>>    kms_3d: Close device before exit
>>    kms_scaling_modes: Close device before exit
>>    kms_dither: Close device before exit
>>    drm_read: Close device before exit
>>    kms_cursor_edge_walk: Close device before exit
>>    kms_plane_lowres: Close device before exit
>>    kms_content_protection: Close device before exit
>>    feature_discovery: Close device before exit
>>    i915/i915_pm_dc: Close device before exit
>>    core_auth: Close(master) before exit
>>    i915/gem_exec_balancer: Close device before exit
>>    i915/gem_ctx_isolation: Close device before exit
>>
>>   lib/igt_core.c                          |   6 ++
>>   lib/igt_core.h                          |   2 +
>>   lib/igt_types.c                         |  17 +++
>>   lib/igt_types.h                         |  47 ++++++++
>>   lib/meson.build                         |   1 +
>>   lib/tests/bad_subtest_type.c            |  19 ++++
>>   lib/tests/igt_types.c                   | 136 ++++++++++++++++++++++++
>>   lib/tests/meson.build                   |   2 +
>>   tests/core_auth.c                       |   8 +-
>>   tests/drm_import_export.c               |   5 +
>>   tests/drm_read.c                        |   4 +-
>>   tests/dumb_buffer.c                     |   4 +
>>   tests/feature_discovery.c               |   5 +-
>>   tests/i915/gem_basic.c                  |   8 +-
>>   tests/i915/gem_blits.c                  |   1 +
>>   tests/i915/gem_close.c                  |   3 +-
>>   tests/i915/gem_create.c                 |   3 +-
>>   tests/i915/gem_ctx_engines.c            |   3 +-
>>   tests/i915/gem_ctx_isolation.c          |   3 +-
>>   tests/i915/gem_ctx_shared.c             |   3 +-
>>   tests/i915/gem_exec_alignment.c         |   3 +-
>>   tests/i915/gem_exec_balancer.c          |   3 +-
>>   tests/i915/gem_exec_endless.c           |   3 +-
>>   tests/i915/gem_flink_basic.c            |  11 +-
>>   tests/i915/gem_linear_blits.c           |   3 +-
>>   tests/i915/gem_media_fill.c             |   1 +
>>   tests/i915/gem_render_copy.c            |   1 +
>>   tests/i915/gem_render_copy_redux.c      |   4 +
>>   tests/i915/gem_request_retire.c         |   5 +-
>>   tests/i915/gem_unfence_active_buffers.c |   1 +
>>   tests/i915/gem_unref_active_buffers.c   |   1 +
>>   tests/i915/gem_userptr_blits.c          |   4 +-
>>   tests/i915/gem_workarounds.c            |   3 +-
>>   tests/i915/i915_pciid.c                 |   2 +
>>   tests/i915/i915_pm_dc.c                 |   1 +
>>   tests/i915/kms_big_fb.c                 |   1 +
>>   tests/i915/kms_big_joiner.c             |   1 +
>>   tests/i915/kms_busy.c                   |   1 +
>>   tests/i915/kms_ccs.c                    |   4 +-
>>   tests/i915/kms_cdclk.c                  |   1 +
>>   tests/i915/kms_fence_pin_leak.c         |   1 +
>>   tests/i915/kms_flip_scaled_crc.c        |   1 +
>>   tests/i915/kms_flip_tiling.c            |   1 +
>>   tests/i915/kms_mmap_write_crc.c         |   1 +
>>   tests/i915/kms_pipe_b_c_ivb.c           |   1 +
>>   tests/i915/kms_psr.c                    |   1 +
>>   tests/i915/kms_psr2_sf.c                |   1 +
>>   tests/i915/kms_psr2_su.c                |   1 +
>>   tests/i915/kms_pwrite_crc.c             |   1 +
>>   tests/kms_3d.c                          |   1 +
>>   tests/kms_atomic.c                      |   1 +
>>   tests/kms_atomic_interruptible.c        |   1 +
>>   tests/kms_atomic_transition.c           |   1 +
>>   tests/kms_color.c                       |   1 +
>>   tests/kms_content_protection.c          |   1 +
>>   tests/kms_cursor_crc.c                  |   1 +
>>   tests/kms_cursor_edge_walk.c            |   4 +-
>>   tests/kms_cursor_legacy.c               |   1 +
>>   tests/kms_dither.c                      |   1 +
>>   tests/kms_dp_aux_dev.c                  |   1 +
>>   tests/kms_flip.c                        |   3 +
>>   tests/kms_flip_event_leak.c             |   1 +
>>   tests/kms_force_connector_basic.c       |   7 +-
>>   tests/kms_hdmi_inject.c                 |   1 +
>>   tests/kms_hdr.c                         |   1 +
>>   tests/kms_invalid_mode.c                |   1 +
>>   tests/kms_panel_fitting.c               |   4 +-
>>   tests/kms_pipe_crc_basic.c              |   1 +
>>   tests/kms_plane.c                       |   1 +
>>   tests/kms_plane_alpha_blend.c           |   1 +
>>   tests/kms_plane_cursor.c                |   1 +
>>   tests/kms_plane_lowres.c                |   4 +-
>>   tests/kms_plane_multiple.c              |   4 +-
>>   tests/kms_plane_scaling.c               |   4 +-
>>   tests/kms_properties.c                  |   1 +
>>   tests/kms_rotation_crc.c                |   1 +
>>   tests/kms_scaling_modes.c               |   4 +-
>>   tests/kms_sequence.c                    |   4 +
>>   tests/kms_universal_plane.c             |   1 +
>>   tests/kms_vblank.c                      |   4 +
>>   tests/syncobj_basic.c                   |   4 +
>>   tests/syncobj_timeline.c                |   4 +
>>   tests/syncobj_wait.c                    |   4 +
>>   83 files changed, 385 insertions(+), 33 deletions(-)
>>   create mode 100644 lib/igt_types.c
>>   create mode 100644 lib/igt_types.h
>>   create mode 100644 lib/tests/bad_subtest_type.c
>>   create mode 100644 lib/tests/igt_types.c
>>

[-- Attachment #2: Type: text/html, Size: 10086 bytes --]

^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [igt-dev] [PATCH 17/76] i915/gem_exec_endless: Close device before exit
       [not found]   ` <YzbgHzTKxDBM9DjG@kamilkon-desk1>
@ 2022-10-05  6:23     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-10-05  6:23 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev

On Fri, 30 Sep 2022 14:25:03 +0200
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:

> Hi Mauro,
> 
> On 2022-09-26 at 08:17:22 +0200, Mauro Carvalho Chehab wrote:
> > From: Chris Wilson <chris.p.wilson@intel.com>
> > 
> > Close the device fd before we check for leaks during the atexit
> > handlers.  
> 
> This is somewhat misleading, it only changes type but missed
> actually closing i915 var.
> 
> Maybe some place for future improvement,

When igt_fd_t() is used, there's no need to explicitly close it, as
gcc/clang will use a typed cleanup to close it when the variable
lifetime expires.

> 
> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> 
> > 
> > Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> > ---
> > 
> > To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> > See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/
> > 
> >  tests/i915/gem_exec_endless.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/i915/gem_exec_endless.c b/tests/i915/gem_exec_endless.c
> > index b83d5a2c1480..2c56cc212036 100644
> > --- a/tests/i915/gem_exec_endless.c
> > +++ b/tests/i915/gem_exec_endless.c
> > @@ -28,6 +28,7 @@
> >  #include "igt.h"
> >  #include "igt_device.h"
> >  #include "igt_sysfs.h"
> > +#include "igt_types.h"
> >  #include "sw_sync.h"
> >  
> >  #define MAX_ENGINES 64
> > @@ -341,7 +342,7 @@ static void unpin_rps(int sysfs)
> >  igt_main
> >  {
> >  	const struct intel_execution_engine2 *e;
> > -	int i915 = -1;
> > +	igt_fd_t(i915);
> >  
> >  	igt_skip_on_simulation();
> >  
> > -- 
> > 2.37.3
> >   

^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [igt-dev] [PATCH 01/76] lib: Introduce typed cleanups
       [not found]   ` <YzcISxi01TrOL4aU@kamilkon-desk1>
@ 2022-10-05  6:44     ` Mauro Carvalho Chehab
       [not found]     ` <10813270.BaYr0rKQ5T@jkrzyszt-mobl1.ger.corp.intel.com>
  1 sibling, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-10-05  6:44 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: Petri Latvala, Chris Wilson, igt-dev, Chris Wilson

On Fri, 30 Sep 2022 17:16:27 +0200
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:

> Hi Mauro,
> 
> On 2022-09-26 at 08:17:06 +0200, Mauro Carvalho Chehab wrote:
> > From: Chris Wilson <chris@chris-wilson.co.uk>
> > 
> > Start introducing standard types with automatic cleanup courtesy of
> > gcc's __attribute__((cleanup)). As an example, we start with an fd
> > that will automatically call close() on going out of scope, and
> > crucially before atexit where we will want to check for resource leaks.  
> 
> This is "what is changing" part, please also put here "why part"
> from cover letter, so it will stay in git history.
> 
> > 
> > Suggested-by: Andrzej Hajda <andrzej.hajda@intel.com>
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> > Cc: Petri Latvala <petri.latvala@intel.com>
> > Acked-by: Nirmoy Das <nirmoy.das@linux.intel.com>
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>  
> 
> I will send cc also to Zbigniew.
> 
> > ---
> > 
> > To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> > See [PATCH 00/76] at: https://lore.kernel.org/all/cover.1664173031.git.mchehab@kernel.org/
> > 
> >  lib/igt_core.c               |   6 ++
> >  lib/igt_core.h               |   2 +
> >  lib/igt_types.c              |  17 +++++
> >  lib/igt_types.h              |  47 ++++++++++++
> >  lib/meson.build              |   1 +
> >  lib/tests/bad_subtest_type.c |  19 +++++
> >  lib/tests/igt_types.c        | 136 +++++++++++++++++++++++++++++++++++
> >  lib/tests/meson.build        |   2 +
> >  8 files changed, 230 insertions(+)
> >  create mode 100644 lib/igt_types.c
> >  create mode 100644 lib/igt_types.h
> >  create mode 100644 lib/tests/bad_subtest_type.c
> >  create mode 100644 lib/tests/igt_types.c
> > 
> > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > index e7425326b7f0..dc6486c841f0 100644
> > --- a/lib/igt_core.c
> > +++ b/lib/igt_core.c
> > @@ -624,6 +624,12 @@ uint64_t igt_nsec_elapsed(struct timespec *start)
> >  		(uint64_t)NSEC_PER_SEC*(now.tv_sec - start->tv_sec));
> >  }
> >  
> > +void __igt_assert_in_outer_scope(void)
> > +{
> > +	internal_assert(!in_subtest,
> > +			"must only be called outside of a subtest");
> > +}
> > +
> >  bool __igt_fixture(void)
> >  {
> >  	internal_assert(!in_fixture,
> > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > index aa98e8ed8deb..f21723dec4bc 100644
> > --- a/lib/igt_core.h
> > +++ b/lib/igt_core.h
> > @@ -135,6 +135,8 @@ struct _GKeyFile *igt_load_igtrc(void);
> >   */
> >  #define IGT_EXIT_ABORT 112
> >  
> > +void __igt_assert_in_outer_scope(void);
> > +
> >  bool __igt_fixture(void);
> >  void __igt_fixture_complete(void);
> >  __noreturn void __igt_fixture_end(void);
> > diff --git a/lib/igt_types.c b/lib/igt_types.c
> > new file mode 100644
> > index 000000000000..392f30fcab23
> > --- /dev/null
> > +++ b/lib/igt_types.c
> > @@ -0,0 +1,17 @@
> > +// SPDX-License-Identifier: MIT
> > +/*
> > +* Copyright © 2022 Intel Corporation
> > +*/
> > +
> > +#include <unistd.h>
> > +
> > +#include "igt_types.h"
> > +
> > +void igt_cleanup_fd(volatile int *fd)
> > +{
> > +	if (!fd || *fd < 0)  
> ---------------------- ^
> imho here should be != -1

In practice, it is identical, as open() returns only -1. On the other
hand, close(-2) - or any other negative value - will produce an error,
so, I prefer checking against < 0 here.

> Consider also (*fd >= -1 && *fd <= 2) as these are 
> stdout/in/error file descriptors.

In thesis, you're right, but the only case where 0, 1 or 2 would be
used would be if someone would force using the typed cleanups with
something like:

foo()
{
	igt_fd_t(close_stdout_fd);

	close_stdout_fd = STDOUT;
}

this would cause STDOUT to be closed at the end of foo() function.

I can't see any cases where something like that would be used. On the
other hand, if someone is doing some tricks with stdout, I can't see
why the library should care enough to not let things like the above
work ;-)

> 
> > +		return;
> > +
> > +	close(*fd);
> > +	*fd = -1;
> > +}
> > diff --git a/lib/igt_types.h b/lib/igt_types.h
> > new file mode 100644
> > index 000000000000..c4bc01ecdb3b
> > --- /dev/null
> > +++ b/lib/igt_types.h
> > @@ -0,0 +1,47 @@
> > +/* SPDX-License-Identifier: MIT */
> > +/*
> > + * Copyright © 2022 Intel Corporation
> > + */
> > +
> > +#ifndef IGT_TYPES_H
> > +#define IGT_TYPES_H
> > +
> > +/*
> > + * GCC can automatically cleanup variables that go out of scope, but only
> > + * through normal means. Breaking out of scope using longjmp (i.e. igt_skip)
> > + * is not handled automatically by GCC. Such scoped variables must be tracked
> > + * in an outer scope to the skipping subtest.
> > + *
> > + * BAD:
> > + * 	igt_subtest("bad") {
> > + * 		igt_fd_t(fd);
> > + *
> > + * 		fd = drm_open_driver();
> > + * 	}
> > + *
> > + * GOOD:
> > + * 	igt_subtest_group() {
> > + * 		igt_fd_t(fd);
> > + *
> > + * 		igt_fixture {
> > + * 			fd = drm_open_driver();
> > + * 		}
> > + *
> > + * 		igt_subtest("good")
> > + * 			;  
> 
> Should we close here fd ? This is example of good practice so
> imho here:
> 		igt_fixture
> 			close(fd);
> 
> even if this is redundant in case of assert or fail, or just
> close(fd) without fixture ?

Just close won't work when longjmp is used, as this is an undefined STD-C
behavior. See this comment at lib/igt_core.c:

 *
 * # Magic Control Blocks
 *
 * i-g-t makes heavy use of C macros which serve as magic control blocks. They
 * work fairly well and transparently but since C doesn't have full-blown
 * closures there are caveats:
...
 *
 * - Code blocks with magic control flow are implemented with setjmp()
 *   and longjmp(). This applies to #igt_fixture, #igt_subtest,
 *   #igt_subtest_with_dynamic and #igt_dynamic
 *   blocks and all the three variants to finish test: igt_success(),
 *   igt_skip() and igt_fail(). Mostly this is of no concern, except
 *   when such a control block changes stack variables defined in the
 *   same function as the control block resides.  Any store/load
 *   behaviour after a longjmp() is ill-defined for these
 *   variables. Avoid such code.
 *
 *   Quoting the man page for longjmp():
 *
 *   "The values of automatic variables are unspecified after a call to
 *   longjmp() if they meet all the following criteria:"
 *    - "they are local to the function that made the corresponding setjmp() call;
 *    - "their values are changed between the calls to setjmp() and longjmp(); and
 *    - "they are not declared as volatile."

The hole idea of this series is to teach gcc and clang how to deal when
igt_skip() & similar functions are used. Basically, when a fd variable is
declared with:

	igt_fd_t(fd);

gcc/clang will then free the variable even when longjmp is used.

Regards,
Mauro

^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [igt-dev] [PATCH 01/76] lib: Introduce typed cleanups
       [not found]     ` <10813270.BaYr0rKQ5T@jkrzyszt-mobl1.ger.corp.intel.com>
@ 2022-10-05  7:41       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-10-05  7:41 UTC (permalink / raw)
  To: Janusz Krzysztofik; +Cc: igt-dev, Petri Latvala, Chris Wilson, Chris Wilson

On Tue, 04 Oct 2022 12:17:20 +0200
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> wrote:

> > > +#include "igt_core.h"
> > > +#include "igt_types.h"  
> > 
> > Please put here description with IGT_TEST_DESCRIPTION() macro.
> >   
> > > +
> > > +igt_main
> > > +{  
> > 
> > Please put description before test with igt_describe().  
> 
> AFAICS none of lib/tests/*, except igt_describe that needs those clauses 
> because it exercises them, follows that convention.  If you found them 
> helpful then OK, that could be a field for improvement, but that should not 
> block adding new self IGT tests as needed, I believe.

True, but on the other hand, it doesn't hurt adding descriptions. As
such change is trivial enough, I'll add them.
> 
> > 
> > Also copy comment from main test that after running this
> > SIGABORT is intentional.  
> 
> Since this test is added to lib_fail_tests category (see below changes to lib/
> tests/meson.build) then I don't think we need further clarifications.

Same here.

> 
> Thanks,
> Janusz

^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [igt-dev] [PATCH 01/76] lib: Introduce typed cleanups
       [not found]   ` <Yz02HL4ue1N1O4hi@zkempczy-mobl2>
@ 2022-10-05  8:02     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 82+ messages in thread
From: Mauro Carvalho Chehab @ 2022-10-05  8:02 UTC (permalink / raw)
  To: Zbigniew Kempczyński; +Cc: igt-dev

On Wed, 5 Oct 2022 09:45:32 +0200
Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> wrote:

> > +void igt_cleanup_fd(volatile int *fd);
> > +#define igt_fd_t(x__) \
> > +	volatile int x__ cleanup_with(igt_cleanup_fd) = IGT_OUTER_SCOPE_INIT(-1)  
> 
> Why do we need volatile here? Variable after initalization (open) likely won't
> be touched (until exiting its scope) so what's the risk?

With current gcc versions, volatile is not needed, but this fails with
clang. The real problem is that C spec doesn't define what happens
with an automatic stack variable after doing a longjmp.

From Petri's feedback, the only solution that works is to declare
such variables as volatile.

Regards,
Mauro

^ permalink raw reply	[flat|nested] 82+ messages in thread

end of thread, other threads:[~2022-10-05  8:03 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-26  6:17 [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 01/76] lib: Introduce typed cleanups Mauro Carvalho Chehab
     [not found]   ` <YzcISxi01TrOL4aU@kamilkon-desk1>
2022-10-05  6:44     ` Mauro Carvalho Chehab
     [not found]     ` <10813270.BaYr0rKQ5T@jkrzyszt-mobl1.ger.corp.intel.com>
2022-10-05  7:41       ` Mauro Carvalho Chehab
     [not found]   ` <Yz02HL4ue1N1O4hi@zkempczy-mobl2>
2022-10-05  8:02     ` Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 02/76] i915/gem_basic: Close device before exit Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 03/76] i915/gem_flink_basic: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 04/76] i915/gem_linear_blits: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 05/76] i915/gem_blits: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 06/76] i915/gem_close: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 07/76] i915/gem_create: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 08/76] i915/gem_ctx_engines: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 09/76] i915/gem_ctx_shared: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 10/76] i915/gem_exec_alignment: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 11/76] i915/gem_render_copy: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 12/76] i915/gem_render_copy_redux: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 13/76] i915/gem_media_fill: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 14/76] i915/gem_userptr_blits: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 15/76] i915/gem_workarounds: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 16/76] i915/gem_unref_active_buffers: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 17/76] i915/gem_exec_endless: " Mauro Carvalho Chehab
     [not found]   ` <YzbgHzTKxDBM9DjG@kamilkon-desk1>
2022-10-05  6:23     ` Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 18/76] i915/gem_request_retire: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 19/76] i915/gem_unfence_active_buffers: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 20/76] i915/i915_pciid: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 21/76] kms_cursor_legacy: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 22/76] kms_flip: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 23/76] kms_pipe_crc_basic: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 24/76] kms_psr: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 25/76] kms_flip: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 26/76] kms_force_connector_basic: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 27/76] dumb_buffer: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 28/76] kms_atomic: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 29/76] kms_atomic_interruptible: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 30/76] kms_atomic_transition: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 31/76] i915/kms_big_fb: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 32/76] i915/kms_ccs: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 33/76] kms_color: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 34/76] kms_cursor_crc: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 35/76] i915/kms_big_joiner: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 36/76] i915/kms_cdclk: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 37/76] i915/kms_fence_pin_leak: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 38/76] i915/kms_flip_scaled_crc: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 39/76] i915/kms_flip_tiling: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 40/76] i915/kms_mmap_write_crc: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 41/76] i915/kms_pipe_b_c_ivb: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 42/76] i915/kms_psr2_sf: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 43/76] i915/kms_psr2_su: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 44/76] i915/kms_pwrite_crc: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 45/76] kms_flip_event_leak: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 46/76] kms_hdr: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 47/76] kms_invalid_mode: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 48/76] kms_panel_fitting: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 49/76] kms_plane: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 50/76] kms_plane_alpha_blend: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 51/76] kms_plane_cursor: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 52/76] kms_plane_multiple: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 53/76] kms_plane_scaling: " Mauro Carvalho Chehab
2022-09-26  6:17 ` [igt-dev] [PATCH 54/76] kms_properties: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 55/76] kms_rotation_crc: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 56/76] kms_sequence: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 57/76] kms_universal_plane: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 58/76] kms_vblank: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 59/76] syncobj_wait: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 60/76] syncobj_basic: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 61/76] syncobj_timeline: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 62/76] drm_import_export: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 63/76] kms_dp_aux_dev: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 64/76] kms_hdmi_inject: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 65/76] kms_3d: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 66/76] kms_scaling_modes: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 67/76] kms_dither: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 68/76] drm_read: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 69/76] kms_cursor_edge_walk: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 70/76] kms_plane_lowres: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 71/76] kms_content_protection: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 72/76] feature_discovery: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 73/76] i915/i915_pm_dc: " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 74/76] core_auth: Close(master) " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 75/76] i915/gem_exec_balancer: Close device " Mauro Carvalho Chehab
2022-09-26  6:18 ` [igt-dev] [PATCH 76/76] i915/gem_ctx_isolation: " Mauro Carvalho Chehab
     [not found] ` <4844cbbf-7add-216d-38f8-4e8c903c06a5@linux.intel.com>
2022-09-30 12:38   ` [igt-dev] [PATCH 00/76] Ensure that file descriptors will be closed on exit Das, Nirmoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox