All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] gem_lmem_swapping: Check requirements before module unload
@ 2022-04-19 13:00 Petri Latvala
  2022-04-19 13:47 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Petri Latvala @ 2022-04-19 13:00 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala, Matthew Auld

To prevent a needless unload-load cycle, check for lmem before the
unload if i915 is already loaded.

Also check that the device is there at all so we get a better error
message than EBADFD from require_gem.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
---
 tests/i915/gem_lmem_swapping.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/i915/gem_lmem_swapping.c b/tests/i915/gem_lmem_swapping.c
index 2f9f3268..ec41dfc3 100644
--- a/tests/i915/gem_lmem_swapping.c
+++ b/tests/i915/gem_lmem_swapping.c
@@ -534,10 +534,25 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 		struct intel_execution_engine2 *e;
 		char *tmp;
 
+		/*
+		 * If the driver is already loaded, check that it has
+		 * lmem before unloading to prevent a needless
+		 * unload-load cycle on integrated platforms.
+		 */
+		if (igt_kmod_is_loaded("i915")) {
+			i915 = __drm_open_driver(DRIVER_INTEL);
+			igt_require_fd(i915);
+			igt_require_gem(i915);
+			igt_require(gem_has_lmem(i915));
+			close(i915);
+		}
+
 		igt_i915_driver_unload();
 		igt_assert_eq(igt_i915_driver_load("lmem_size=4096"), 0);
 
 		i915 = __drm_open_driver(DRIVER_INTEL);
+		igt_require_fd(i915);
+		/* Do the lmem check again in case the reload messed something up (as unlikely it is) */
 		igt_require_gem(i915);
 		igt_require(gem_has_lmem(i915));
 
-- 
2.30.2

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

end of thread, other threads:[~2022-04-20 10:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 13:00 [igt-dev] [PATCH i-g-t] gem_lmem_swapping: Check requirements before module unload Petri Latvala
2022-04-19 13:47 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2022-04-19 16:14 ` [igt-dev] ✓ Fi.CI.BAT: success for gem_lmem_swapping: Check requirements before module unload (rev2) Patchwork
2022-04-19 19:48 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-04-20  8:43 ` [igt-dev] [PATCH i-g-t] gem_lmem_swapping: Check requirements before module unload Matthew Auld
2022-04-20 10:32   ` Petri Latvala

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.