All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, jani.nikula@intel.com,
	Jeevan B <jeevan.b@intel.com>
Subject: [PATCH i-g-t 3/4] tests/intel/i915_module_load: Add intel_display module subtests
Date: Tue, 24 Nov 2026 10:15:58 +0530	[thread overview]
Message-ID: <20261124044559.897167-4-jeevan.b@intel.com> (raw)
In-Reply-To: <20261124044559.897167-1-jeevan.b@intel.com>

Treat a leftover intel_display as an unwanted driver for the "load"
subtest and add subtests for the module orderings with the dedicated
display module; they skip when the module does not exist:

- load-i915-then-display: loading i915 pulls intel_display in.
- unload-display-with-i915: intel_display loads alone and unused, is
  held once i915 is loaded and cannot be removed then; after i915 is
  removed it stays loaded and unused and can be removed last.
- unload-i915-also-unloads-display: one i915 unload removes both.
- reload-display-only: reload intel_display alone, then i915 on top.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
 tests/intel/i915_module_load.c | 108 +++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)

diff --git a/tests/intel/i915_module_load.c b/tests/intel/i915_module_load.c
index 68e238646..c5835f195 100644
--- a/tests/intel/i915_module_load.c
+++ b/tests/intel/i915_module_load.c
@@ -48,6 +48,26 @@
  * Description: Verify that i915 driver can be successfully loaded with disabled display.
  * Feature: core, sriov-core
  *
+ * SUBTEST: load-i915-then-display
+ * Description: Load the i915 driver and check that the intel_display module it
+ *		depends on is loaded as well.
+ * Feature: core
+ *
+ * SUBTEST: unload-display-with-i915
+ * Description: Check that intel_display cannot be removed while i915 holds it,
+ *		then unload both and load i915 again.
+ * Feature: core
+ *
+ * SUBTEST: unload-i915-also-unloads-display
+ * Description: Check that unloading i915 also removes the intel_display module
+ *		once nothing else holds it.
+ * Feature: core
+ *
+ * SUBTEST: reload-display-only
+ * Description: Unload and reload the intel_display module and then bring i915
+ *		back up on top of it.
+ * Feature: core
+ *
  * SUBTEST: resize-bar
  * Description: Check whether lmem bar size can be resized to only supported sizes.
  */
@@ -600,12 +620,25 @@ static void test_fault_injection(void)
 	igt_i915_driver_load(NULL);
 }
 
+/* Start from a clean slate and skip if there is no dedicated display module */
+static void display_module_setup(void)
+{
+	int ret;
+
+	ret = igt_i915_driver_unload();
+	igt_require_f(!ret && !igt_kmod_is_loaded("i915"),
+		      "Could not unload i915 (%d)\n", ret);
+
+	igt_intel_display_prepare_alone();
+}
+
 int igt_main()
 {
 	igt_describe("Check if i915 and friends are not yet loaded, then load them.");
 	igt_subtest("load") {
 		const char * unwanted_drivers[] = {
 			"i915",
+			"intel_display",
 			"intel-gtt",
 			NULL
 		};
@@ -636,6 +669,81 @@ int igt_main()
 		igt_i915_driver_unload();
 	}
 
+	igt_describe("Load i915 and check that intel_display is pulled in as a dependency.");
+	igt_subtest("load-i915-then-display") {
+		display_module_setup();
+		igt_assert_eq(igt_intel_display_unload(), 0);
+		igt_assert_intel_driver_and_display_unloaded("i915");
+
+		load_and_check_i915();
+		igt_assert(igt_kmod_is_loaded("intel_display"));
+	}
+
+	igt_describe("Check intel_display is held by i915, then unload both and reload i915.");
+	igt_subtest("unload-display-with-i915") {
+		int ret;
+
+		/* modprobe intel_display: loads alone, nothing uses it yet */
+		display_module_setup();
+		igt_assert(igt_kmod_is_loaded("intel_display"));
+		igt_assert_f(!igt_kmod_is_loaded("i915"), "i915 loaded with display only\n");
+		igt_assert_f(!igt_intel_display_has_holders(),
+			     "intel_display held before i915 was loaded\n");
+
+		/* modprobe i915: display is now used by it */
+		load_and_check_i915();
+		igt_assert(igt_kmod_is_loaded("i915"));
+		igt_assert_f(igt_intel_display_has_holders(),
+			     "intel_display not held by i915\n");
+
+		/*
+		 * rmmod intel_display: refused, i915 calls into display. The
+		 * kernel reports -EWOULDBLOCK while other modules depend on the
+		 * target (libkmod removes non-blocking), -EBUSY otherwise.
+		 */
+		ret = igt_intel_display_try_unload();
+		igt_assert_f(ret == -EWOULDBLOCK || ret == -EBUSY,
+			     "intel_display removed or unexpected error while i915 holds it: %d\n", ret);
+		igt_assert(igt_kmod_is_loaded("i915"));
+		igt_assert(igt_kmod_is_loaded("intel_display"));
+
+		/* rmmod i915: goes first, intel_display stays behind, unused */
+		igt_assert_eq(igt_intel_driver_unload_keep_display("i915"), 0);
+		igt_assert_f(!igt_kmod_is_loaded("i915"), "i915 still loaded\n");
+		igt_assert_f(igt_kmod_is_loaded("intel_display"),
+			     "intel_display disappeared with i915\n");
+		igt_assert_f(!igt_intel_display_has_holders(),
+			     "intel_display still held after i915 was removed\n");
+
+		/* rmmod intel_display: now it works */
+		igt_assert_eq(igt_intel_display_unload(), 0);
+		igt_assert_intel_driver_and_display_unloaded("i915");
+
+		load_and_check_i915();
+	}
+
+	igt_describe("Check that unloading i915 also removes the intel_display it no longer uses.");
+	igt_subtest("unload-i915-also-unloads-display") {
+		display_module_setup();
+		load_and_check_i915();
+		igt_assert(igt_kmod_is_loaded("intel_display"));
+
+		igt_assert_eq(igt_i915_driver_unload(), 0);
+		igt_assert_intel_driver_and_display_unloaded("i915");
+
+		load_and_check_i915();
+	}
+
+	igt_describe("Reload only the display module, then reload i915 on top of it.");
+	igt_subtest("reload-display-only") {
+		display_module_setup();
+		igt_assert_eq(igt_intel_display_unload(), 0);
+		igt_assert_intel_driver_and_display_unloaded("i915");
+
+		igt_assert_eq(igt_intel_display_load(NULL), 0);
+		load_and_check_i915();
+	}
+
 	igt_describe("Test i915 fault injection");
 	igt_subtest_with_dynamic_f("fault-injection")
 		test_fault_injection();
-- 
2.43.0


  parent reply	other threads:[~2026-11-24  4:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  4:45 [PATCH i-g-t 0/4] RFC: Add intel_display module support to module load tests Jeevan B
2026-11-24  4:45 ` [PATCH i-g-t 1/4] lib/igt_params: Fall back to intel_display module parameters Jeevan B
2026-11-24  4:45 ` [PATCH i-g-t 2/4] lib/igt_kmod: Handle the dedicated intel_display module Jeevan B
2026-11-24  4:45 ` Jeevan B [this message]
2026-11-24  4:45 ` [PATCH i-g-t 4/4] tests/intel/xe_module_load: Add intel_display module subtests Jeevan B
2026-11-24  5:28 ` ✓ Xe.CI.BAT: success for RFC: Add intel_display module support to module load tests (rev2) Patchwork
2026-11-24  5:47 ` ✗ i915.CI.BAT: failure " Patchwork
2026-11-24  8:36 ` ✗ Xe.CI.FULL: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261124044559.897167-4-jeevan.b@intel.com \
    --to=jeevan.b@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=karthik.b.s@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.