Skip to contentSkip to conversation

RFC: Add intel_display module support to module load tests

PATCH New Jeevan B 2 participants 7 messages Nov 24 Library code

lore
Share & tools
lore

Jeevan B

author
#0 lore raw

cover RFC: Add intel_display module support to module load tests

Display can now be built as a separate intel-display.ko (intel_display) instead of being part of i915/xe. This RFC makes IGT aware of it:

- Look up display module parameters in intel_display as a fallback.
- Unload intel_display together with the GPU driver and add helpers to control it explicitly.
- Add intel_display load/unload ordering subtests to i915_module_load and xe_module_load; they skip on kernels without the module.

Jeevan B (4):
lib/igt_params: Fall back to intel_display module parameters lib/igt_kmod: Handle the dedicated intel_display module tests/intel/i915_module_load: Add intel_display module subtests tests/intel/xe_module_load: Add intel_display module subtests

 lib/igt_kmod.c                 | 209 ++++++++++++++++++++++++++++++++-
 lib/igt_kmod.h                 |   7 ++
 lib/igt_params.c               |  83 ++++++++++++-
 lib/igt_params.h               |   1 +
 tests/intel/i915_module_load.c | 108 +++++++++++++++++
 tests/intel/xe_module_load.c   | 100 ++++++++++++++++
 6 files changed, 497 insertions(+), 11 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/4 lib/igt_params: Fall back to intel_display module parameters

With display split into a dedicated intel-display.ko, display module parameters move from /sys/module/<driver>/parameters to /sys/module/intel_display/parameters.

Add igt_display_params_open() to open the intel_display parameters directory, and make igt_params_get()/igt_params_set() search the GPU driver module first and then intel_display. Existing tests keep working unchanged on kernels both with and without the dedicated display module. igt_params_open() is unchanged.

---
 lib/igt_params.c | 83 +++++++++++++++++++++++++++++++++++++++++++++---
 lib/igt_params.h |  1 +
 2 files changed, 79 insertions(+), 5 deletions(-)
lib/igt_params.c +78 -5
index 3dad317a5..01494d17e 100644
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include <i915_drm.h>
 
@@ -123,7 +124,9 @@ static void igt_params_save(int dir, const char *name)
  * @device: fd of the device
  *
  * This opens the module parameters directory (under sysfs) corresponding
- * to the device for use with igt_sysfs_set() and igt_sysfs_get().
+ * to the device for use with igt_sysfs_set() and igt_sysfs_get(). Only the
+ * parameters of the GPU driver module are covered; for the dedicated
+ * intel_display module see igt_display_params_open().
  *
  * Returns:
  * The directory fd, or -1 on failure.
@@ -156,12 +159,77 @@ int igt_params_open(int device)
 	return params;
 }
 
+#define INTEL_DISPLAY_PARAMS_PATH "/sys/module/intel_display/parameters"
+
+/**
+ * igt_display_params_open:
+ *
+ * Opens the module parameters directory of the dedicated intel-display.ko
+ * module (/sys/module/intel_display/parameters, the kernel exposes the module
+ * name with an underscore). On kernels where display is still built into the
+ * GPU driver module this directory does not exist.
+ *
+ * Parameters changed at runtime through the driver's debugfs
+ * (<driver>_params) are per DRM device and are not affected by the split.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_display_params_open(void)
+{
+	return open(INTEL_DISPLAY_PARAMS_PATH, O_RDONLY);
+}
+
+/* Is @device driven by a driver whose display code can live in intel_display? */
+static bool device_uses_intel_display(int device)
+{
+	drm_version_t version;
+	char name[32] = "";
+
+	memset(&version, 0, sizeof(version));
+	version.name_len = sizeof(name) - 1;
+	version.name = name;
+	if (ioctl(device, DRM_IOCTL_VERSION, &version))
+		return false;
+
+	return !strcmp(name, "i915") || !strcmp(name, "xe");
+}
+
+/*
+ * Open the params directory that holds @parameter: the GPU driver module
+ * first, then, for i915 and xe devices only, the intel_display module. This
+ * keeps tests working on kernels with and without a dedicated display module
+ * without touching intel_display parameters on other vendors' devices.
+ */
+static int params_open_for(int device, const char *parameter)
+{
+	int dir;
+
+	dir = igt_params_open(device);
+	if (dir >= 0 && faccessat(dir, parameter, F_OK, 0) == 0)
+		return dir;
+	if (dir >= 0)
+		close(dir);
+
+	if (!device_uses_intel_display(device))
+		return -1;
+
+	dir = igt_display_params_open();
+	if (dir >= 0 && faccessat(dir, parameter, F_OK, 0) == 0)
+		return dir;
+	if (dir >= 0)
+		close(dir);
+
+	return -1;
+}
+
 /**
  * __igt_params_get:
  * @device: fd of the device
  * @parameter: the name of the parameter to get
  *
- * This reads the value of the modparam.
+ * This reads the value of the modparam. The GPU driver module is searched
+ * first and, for i915 and xe devices, the intel_display module second.
  *
  * Returns:
  * A nul-terminated string, must be freed by caller after use, or NULL
@@ -172,7 +240,7 @@ char *__igt_params_get(int device, const char *parameter)
 	char *str;
 	int dir;
 
-	dir = igt_params_open(device);
+	dir = params_open_for(device, parameter);
 	if (dir < 0)
 		return NULL;
 
@@ -189,7 +257,7 @@ static bool __igt_params_set(int device, const char *parameter,
 	int dir;
 	int ret;
 
-	dir = igt_params_open(device);
+	dir = params_open_for(device, parameter);
 	if (dir < 0)
 		return false;
 
@@ -208,6 +276,9 @@ static bool __igt_params_set(int device, const char *parameter,
  * @parameter: the name of the parameter to set
  * @fmt: printf-esque format string
  *
+ * The parameter is looked up in the GPU driver module first and, for i915
+ * and xe devices, in the intel_display module second.
+ *
  * Returns true on success
  */
 bool igt_params_set(int device, const char *parameter, const char *fmt, ...)
@@ -230,7 +301,9 @@ bool igt_params_set(int device, const char *parameter, const char *fmt, ...)
  *
  * Save original value to be restored by exit handler. Parameter is first
  * searched at debugfs/dri/N/<device>_params and if not found will look for
- * parameter at /sys/module/<device>/parameters.
+ * parameter at /sys/module/<device>/parameters. If the parameter is not found
+ * there either, the dedicated intel_display module is searched at
+ * /sys/module/intel_display/parameters.
  *
  * Giving -1 here for default device will search for matching device from
  * debugfs/dri/N where N go from 0 to 63. First device found from debugfs
lib/igt_params.h +1 -0
index 6494786f0..f2ec44d1f 100644
@@ -27,6 +27,7 @@
 #include <stdbool.h>
 
 int igt_params_open(int device);
+int igt_display_params_open(void);
 
 char *__igt_params_get(int device, const char *parameter);
 
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/4 lib/igt_kmod: Handle the dedicated intel_display module

In reply to Jeevan B

With display built as intel-display.ko, loading i915/xe pulls it in as a dependency but unloading the GPU driver leaves it loaded, which leaks state into following tests.

Unload intel_display after the GPU driver once nothing else holds it, both in __igt_intel_driver_unload() and igt_xe_driver_unload(); the GPU driver always goes first, as it calls into display.

Add helpers for tests that need to control the module explicitly:
igt_intel_display_load()/igt_intel_display_unload() to load it alone and to unload it together with its holders, igt_intel_display_try_unload() to attempt a direct removal, igt_intel_driver_unload_keep_display() to remove only the GPU driver, and igt_intel_display_has_holders().

The module file is intel-display.ko but the kernel registers it as intel_display; document that and the unload ordering.

The dedicated module needs a kernel that builds display as intel-display.ko; on older kernels the new helpers fail or are no-ops.

---
 lib/igt_kmod.c | 209 +++++++++++++++++++++++++++++++++++++++++++++++--
 lib/igt_kmod.h |   7 ++
 2 files changed, 210 insertions(+), 6 deletions(-)
lib/igt_kmod.c +203 -6
index 76680fca5..276ea0c89 100644
@@ -585,19 +585,129 @@ int igt_audio_driver_load(char **who)
 	return ret;
 }
 
-int __igt_intel_driver_unload(char **who, const char *driver)
+/*
+ * The module file is intel-display.ko, but the kernel registers module names
+ * with underscores (/sys/module, /proc/modules), which is what
+ * igt_kmod_is_loaded() matches against. modprobe/libkmod accept either form.
+ *
+ * Dependency order is always intel_display -> i915/xe: the core drivers call
+ * into display, so display can only be removed once every GPU driver holding
+ * it is gone. modprobe loads intel_display automatically as a dependency, but
+ * unloading a module does not remove its dependencies, hence the explicit
+ * unload below.
+ */
+#define INTEL_DISPLAY_MODULE "intel_display"
+
+/**
+ * igt_intel_display_has_holders:
+ *
+ * Returns: true if any module (i915, xe, ...) still depends on intel_display,
+ * as listed in /sys/module/intel_display/holders.
+ */
+bool igt_intel_display_has_holders(void)
+{
+	DIR *d = opendir("/sys/module/" INTEL_DISPLAY_MODULE "/holders");
+	struct dirent *de;
+	bool held = false;
+
+	if (!d)
+		return false;
+
+	while ((de = readdir(d))) {
+		if (de->d_name[0] != '.') {
+			held = true;
+			break;
+		}
+	}
+	closedir(d);
+
+	return held;
+}
+
+/**
+ * igt_intel_display_load:
+ * @opts: options to pass to the intel_display module, or NULL
+ *
+ * Loads the dedicated intel_display module. This is a no-op returning 0 if
+ * the module is already loaded. Returns a negative errno if the module
+ * does not exist, e.g. on kernels with display built into the GPU driver.
+ */
+int igt_intel_display_load(const char *opts)
+{
+	if (igt_kmod_is_loaded(INTEL_DISPLAY_MODULE))
+		return 0;
+
+	return igt_kmod_load(INTEL_DISPLAY_MODULE, opts);
+}
+
+/**
+ * igt_intel_display_unload:
+ *
+ * Unloads the dedicated intel_display module. Any GPU driver (i915 and/or xe)
+ * holding it is unloaded first. Returns 0 if the module is not loaded.
+ */
+int igt_intel_display_unload(void)
+{
+	if (!igt_kmod_is_loaded(INTEL_DISPLAY_MODULE))
+		return 0;
+
+	return igt_kmod_unload(INTEL_DISPLAY_MODULE);
+}
+
+/**
+ * igt_intel_display_try_unload:
+ *
+ * Attempts to remove the intel_display module directly, without first
+ * unloading the modules that hold it. This is expected to fail while i915 or
+ * xe is loaded, as the core drivers call into display: with -EWOULDBLOCK when
+ * other modules depend on it (libkmod removes modules non-blocking), or
+ * -EBUSY when the module is otherwise in use.
+ *
+ * Returns: 0 on success or a negative errno.
+ */
+int igt_intel_display_try_unload(void)
+{
+	struct kmod_module *kmod;
+	int err;
+
+	err = kmod_module_new_from_name(kmod_ctx(), INTEL_DISPLAY_MODULE, &kmod);
+	if (err < 0)
+		return err;
+
+	err = kmod_module_remove_module(kmod, 0);
+	kmod_module_unref(kmod);
+
+	return err;
+}
+
+/*
+ * Unload intel_display once the GPU driver using it is gone. Leave it alone
+ * while another GPU driver still holds it.
+ */
+static int intel_display_unload_if_unused(char **who)
 {
 	int ret;
 
+	if (!igt_kmod_is_loaded(INTEL_DISPLAY_MODULE) ||
+	    igt_intel_display_has_holders())
+		return 0;
+
+	ret = igt_kmod_unload(INTEL_DISPLAY_MODULE);
+	if (ret && who)
+		*who = strdup_realloc(*who, INTEL_DISPLAY_MODULE);
+
+	return ret;
+}
+
+/* Unload modules that only have a soft dependency on the GPU driver */
+static int unload_aux_modules(char **who)
+{
 	const char *aux[] = {
 		/* gen5: ips uses symbol_get() so only a soft module dependency */
 		"intel_ips",
 		NULL,
 	};
-
-	ret = igt_audio_driver_unload(who);
-	if (ret)
-		return ret;
+	int ret;
 
 	for (const char **m = aux; *m; m++) {
 		if (!igt_kmod_is_loaded(*m))
@@ -612,6 +722,90 @@ int __igt_intel_driver_unload(char **who, const char *driver)
 		}
 	}
 
+	return 0;
+}
+
+/**
+ * igt_intel_driver_unload_keep_display:
+ * @driver: GPU driver module to unload, e.g. "i915" or "xe"
+ *
+ * Unloads only the GPU driver, leaving intel_display loaded. Like
+ * igt_intel_driver_unload() it first unloads the audio driver and the
+ * auxiliary modules (e.g. intel_ips) and unbinds @driver from its devices.
+ * Tests use this to check the removal order i915/xe first, intel_display
+ * second, step by step. Regular tests should use igt_intel_driver_unload(),
+ * which also removes an unused intel_display.
+ *
+ * Returns: 0 on success or a negative errno.
+ */
+int igt_intel_driver_unload_keep_display(const char *driver)
+{
+	int ret;
+
+	ret = igt_audio_driver_unload(NULL);
+	if (ret)
+		return ret;
+
+	ret = unload_aux_modules(NULL);
+	if (ret)
+		return ret;
+
+	if (!igt_kmod_is_loaded(driver))
+		return 0;
+
+	igt_kmod_unbind(driver, NULL);
+	ret = igt_kmod_unload(driver);
+
+	return igt_kmod_is_loaded(driver) ? (ret ?: -EBUSY) : 0;
+}
+
+/**
+ * igt_intel_display_prepare_alone:
+ *
+ * Test helper: starts from a state with intel_display loaded on its own, i.e.
+ * without i915 or xe. Any GPU driver still holding the module is unloaded
+ * first, so callers should unload their driver beforehand with the matching
+ * helper. Skips the test if intel_display cannot be unloaded, or if there is
+ * no dedicated intel_display module (kernels with display built into the GPU
+ * driver).
+ */
+void igt_intel_display_prepare_alone(void)
+{
+	int ret;
+
+	igt_require_f(!igt_intel_display_unload(),
+		      "Could not unload intel_display\n");
+
+	ret = igt_intel_display_load(NULL);
+	igt_skip_on_f(ret, "No dedicated intel_display module (%d)\n", ret);
+	igt_assert(igt_kmod_is_loaded(INTEL_DISPLAY_MODULE));
+}
+
+/**
+ * igt_assert_intel_driver_and_display_unloaded:
+ * @driver: GPU driver module, e.g. "i915" or "xe"
+ *
+ * Asserts that neither @driver nor intel_display is loaded.
+ */
+void igt_assert_intel_driver_and_display_unloaded(const char *driver)
+{
+	igt_assert_f(!igt_kmod_is_loaded(driver), "%s still loaded\n", driver);
+	igt_assert_f(!igt_kmod_is_loaded(INTEL_DISPLAY_MODULE),
+		     "%s still loaded\n", INTEL_DISPLAY_MODULE);
+}
+
+int __igt_intel_driver_unload(char **who, const char *driver)
+{
+	int ret;
+
+	ret = igt_audio_driver_unload(who);
+	if (ret)
+		return ret;
+
+	ret = unload_aux_modules(who);
+	if (ret)
+		return ret;
+
 	if (igt_kmod_is_loaded(driver)) {
 		igt_kmod_unbind(driver, NULL);
 
@@ -624,7 +818,7 @@ int __igt_intel_driver_unload(char **who, const char *driver)
 		}
 	}
 
-	return 0;
+	return intel_display_unload_if_unused(who);
 }
 
 static char *kmod_pci_driver_from_module_alloc(const char *mod_name)
@@ -763,6 +957,9 @@ int igt_xe_driver_unload(void)
 	if (igt_kmod_is_loaded("xe"))
 		return IGT_EXIT_FAILURE;
 
+	if (intel_display_unload_if_unused(NULL))
+		return IGT_EXIT_FAILURE;
+
 	return IGT_EXIT_SUCCESS;
 }
 
lib/igt_kmod.h +7 -0
index f6c17ff73..141582f15 100644
@@ -55,6 +55,13 @@ int igt_audio_driver_load(char **whom);
 int igt_intel_driver_load(const char *opts, const char *driver);
 int igt_intel_driver_unload(const char *driver);
 int __igt_intel_driver_unload(char **who, const char *driver);
+int igt_intel_display_load(const char *opts);
+int igt_intel_display_unload(void);
+int igt_intel_display_try_unload(void);
+bool igt_intel_display_has_holders(void);
+int igt_intel_driver_unload_keep_display(const char *driver);
+void igt_intel_display_prepare_alone(void);
+void igt_assert_intel_driver_and_display_unloaded(const char *driver);
 
 static inline int igt_i915_driver_load(const char *opts)
 {
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH 3/4 tests/intel/i915_module_load: Add intel_display module subtests

In reply to Jeevan B

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.

---
 tests/intel/i915_module_load.c | 108 +++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)
tests/intel/i915_module_load.c +108 -0
index 68e238646..c5835f195 100644
@@ -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();
Signature · 1 line
2.43.0
author
#4 lore raw

PATCH 4/4 tests/intel/xe_module_load: Add intel_display module subtests

In reply to Jeevan B

Treat a leftover intel_display as an unwanted driver for the "load" subtest and add the same intel_display ordering subtests as for i915 (load-xe-then-display, unload-display-with-xe, unload-xe-also-unloads-display, reload-display-only). They skip when the module does not exist.

---
 tests/intel/xe_module_load.c | 100 +++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
tests/intel/xe_module_load.c +100 -0
index 0c75c4ebc..4cefba09d 100644
@@ -94,9 +94,18 @@ static void load_and_check_xe(const char *opts)
 static const char * const unwanted_drivers[] = {
 	"xe",
 	"i915",
+	"intel_display",
 	NULL
 };
 
+/* Start from a clean slate and skip if there is no dedicated display module */
+static void display_module_setup(void)
+{
+	igt_require_f(!igt_xe_driver_unload(), "Could not unload xe\n");
+
+	igt_intel_display_prepare_alone();
+}
+
 /**
  * SUBTEST: force-load
  * Description: Load the Xe driver passing ``force_probe=*`` parameter
@@ -115,6 +124,22 @@ static const char * const unwanted_drivers[] = {
  *
  * SUBTEST: many-reload
  * Description: Reload the Xe driver many times
+ *
+ * SUBTEST: load-xe-then-display
+ * Description: Load the Xe driver and check that the intel_display module it
+ *		depends on is loaded as well.
+ *
+ * SUBTEST: unload-display-with-xe
+ * Description: Check that intel_display cannot be removed while Xe holds it,
+ *		then unload both and load Xe again.
+ *
+ * SUBTEST: unload-xe-also-unloads-display
+ * Description: Check that unloading Xe also removes the intel_display module
+ *		once nothing else holds it.
+ *
+ * SUBTEST: reload-display-only
+ * Description: Unload and reload the intel_display module and then bring Xe
+ *		back up on top of it.
  */
 int igt_main()
 {
@@ -165,5 +190,80 @@ int igt_main()
 		/* only default modparams, can leave module loaded */
 	}
 
+	igt_describe("Load xe and check that intel_display is pulled in as a dependency.");
+	igt_subtest("load-xe-then-display") {
+		display_module_setup();
+		igt_assert_eq(igt_intel_display_unload(), 0);
+		igt_assert_intel_driver_and_display_unloaded("xe");
+
+		load_and_check_xe(NULL);
+		igt_assert(igt_kmod_is_loaded("intel_display"));
+	}
+
+	igt_describe("Check intel_display is held by xe, then unload both and reload xe.");
+	igt_subtest("unload-display-with-xe") {
+		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("xe"), "xe loaded with display only\n");
+		igt_assert_f(!igt_intel_display_has_holders(),
+			     "intel_display held before xe was loaded\n");
+
+		/* modprobe xe: display is now used by it */
+		load_and_check_xe(NULL);
+		igt_assert(igt_kmod_is_loaded("xe"));
+		igt_assert_f(igt_intel_display_has_holders(),
+			     "intel_display not held by xe\n");
+
+		/*
+		 * rmmod intel_display: refused, xe 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 xe holds it: %d\n", ret);
+		igt_assert(igt_kmod_is_loaded("xe"));
+		igt_assert(igt_kmod_is_loaded("intel_display"));
+
+		/* rmmod xe: goes first, intel_display stays behind, unused */
+		igt_assert_eq(igt_intel_driver_unload_keep_display("xe"), 0);
+		igt_assert_f(!igt_kmod_is_loaded("xe"), "xe still loaded\n");
+		igt_assert_f(igt_kmod_is_loaded("intel_display"),
+			     "intel_display disappeared with xe\n");
+		igt_assert_f(!igt_intel_display_has_holders(),
+			     "intel_display still held after xe was removed\n");
+
+		/* rmmod intel_display: now it works */
+		igt_assert_eq(igt_intel_display_unload(), 0);
+		igt_assert_intel_driver_and_display_unloaded("xe");
+
+		load_and_check_xe(NULL);
+	}
+
+	igt_describe("Check that unloading xe also removes the intel_display it no longer uses.");
+	igt_subtest("unload-xe-also-unloads-display") {
+		display_module_setup();
+		load_and_check_xe(NULL);
+		igt_assert(igt_kmod_is_loaded("intel_display"));
+
+		igt_assert_eq(igt_xe_driver_unload(), 0);
+		igt_assert_intel_driver_and_display_unloaded("xe");
+
+		load_and_check_xe(NULL);
+	}
+
+	igt_describe("Reload only the display module, then reload xe 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("xe");
+
+		igt_assert_eq(igt_intel_display_load(NULL), 0);
+		load_and_check_xe(NULL);
+	}
+
 	/* Subtests should unload the module themselves if they use modparams */
 }
Signature · 1 line
2.43.0
#5 lore raw

✓ Xe.CI.BAT: success for RFC: Add intel_display module support to module load tests (rev2)

In reply to Jeevan B
== Series Details ==

== Series Details ==

Series: RFC: Add intel_display module support to module load tests (rev2)
URL : https://patchwork.freedesktop.org/series/178948/
State : success

== Summary ==

CI Bug Log - changes from XEIGT_9202_BAT -> XEIGTPW_16205_BAT
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Participating hosts (12 -> 12)
------------------------------

Additional (1): bat-wcl-1
Missing (1): bat-ptl-1

Known issues
------------

Here are the changes found in XEIGTPW_16205_BAT that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- bat-wcl-1: NOTRUN -> [SKIP][1] ([Intel XE#7245])
[1]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@[email protected]

* igt@kms_dsc@dsc-basic:
- bat-wcl-1: NOTRUN -> [SKIP][2] ([Intel XE#8265])
[2]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@[email protected]

* igt@xe_evict@evict-small-multi-vm:
- bat-wcl-1: NOTRUN -> [SKIP][3] ([Intel XE#7238]) +11 other tests skip
[3]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@[email protected]

* igt@xe_exec_balancer@twice-virtual-rebind:
- bat-wcl-1: NOTRUN -> [SKIP][4] ([Intel XE#7482]) +17 other tests skip
[4]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@[email protected]

* igt@xe_exec_multi_queue@many-queues-priority:
- bat-wcl-1: NOTRUN -> [SKIP][5] ([Intel XE#8364]) +13 other tests skip
[5]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@[email protected]

* igt@xe_live_ktest@xe_migrate@xe_migrate_access_memory_kunit:
- bat-wcl-1: NOTRUN -> [SKIP][6] ([Intel XE#9657])
[6]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@xe_live_ktest@xe_migrate@xe_migrate_access_memory_kunit.html

* igt@xe_live_ktest@xe_migrate@xe_validate_ccs_kunit:
- bat-wcl-1: NOTRUN -> [SKIP][7] ([Intel XE#7239]) +2 other tests skip
[7]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@xe_live_ktest@xe_migrate@xe_validate_ccs_kunit.html

* igt@xe_mmap@vram:
- bat-wcl-1: NOTRUN -> [SKIP][8] ([Intel XE#7243])
[8]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@[email protected]

* igt@xe_pat@pat-index-xehpc:
- bat-wcl-1: NOTRUN -> [SKIP][9] ([Intel XE#7247] / [Intel XE#7590])
[9]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@[email protected]

* igt@xe_pat@pat-index-xelp:
- bat-wcl-1: NOTRUN -> [SKIP][10] ([Intel XE#7242] / [Intel XE#7590])
[10]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@[email protected]

* igt@xe_pat@pat-index-xelpg:
- bat-wcl-1: NOTRUN -> [SKIP][11] ([Intel XE#7248] / [Intel XE#7590])
[11]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/bat-wcl-1/igt@[email protected]

[Intel XE#7238]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7238
[Intel XE#7239]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7239
[Intel XE#7242]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7242
[Intel XE#7243]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7243
[Intel XE#7245]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7245
[Intel XE#7247]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7247
[Intel XE#7248]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7248
[Intel XE#7482]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7482
[Intel XE#7590]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/7590
[Intel XE#8265]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8265
[Intel XE#8364]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8364
[Intel XE#9657]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/9657

Build changes
-------------

* IGT: IGT_9202 -> IGTPW_16205

IGTPW_16205: 16205
IGT_9202: 9202
xe-6209-1bb2c850125a082e8c33037aa8cc6780cb90e2dd: 1bb2c850125a082e8c33037aa8cc6780cb90e2dd

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_16205/index.html

#6 lore raw

✗ i915.CI.BAT: failure for RFC: Add intel_display module support to module load tests (rev2)

In reply to Jeevan B
== Series Details ==

== Series Details ==

Series: RFC: Add intel_display module support to module load tests (rev2)
URL : https://patchwork.freedesktop.org/series/178948/
State : failure

== Summary ==

CI Bug Log - changes from IGT_9202 -> IGTPW_16205
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_16205 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in IGTPW_16205, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/index.html

Participating hosts (39 -> 39)
------------------------------

Additional (1): bat-adlp-6
Missing (1): bat-dg2-13

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_16205:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live:
- bat-adlp-9: [PASS][1] -> [INCOMPLETE][2] +1 other test incomplete
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_9202/bat-adlp-9/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-9/igt@[email protected]

New tests
---------

New tests have been introduced between IGT_9202 and IGTPW_16205:

### New IGT tests (23) ###

* igt@i915_selftest@addfb25-bad-modifier:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@addfb25-y-tiled-legacy:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@addfb25-yf-tiled-legacy:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@bad-pitch-0:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@bad-pitch-65536:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@basic-busy-flip-before-cursor-atomic:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@basic-busy-flip-before-cursor-legacy:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@basic-flip-before-cursor-atomic:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@basic-flip-before-cursor-legacy:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@basic-flip-before-cursor-varying-size:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@basic-flip-vs-dpms:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@basic-pci-d3-state:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@basic-with_fd_dup:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@basic-y-tiled-legacy:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@bo-too-small:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@bo-too-small-due-to-tiling:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@compare-crc-sanitycheck-nv12:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@force-load-detect:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@framebuffer-vs-set-tiling:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@hang-read-crc:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@invalid-get-prop-any:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@prune-stale-modes:
- Statuses :
- Exec time: [None] s

* igt@i915_selftest@read-crc:
- Statuses :
- Exec time: [None] s

Known issues
------------

Here are the changes found in IGTPW_16205 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_lmem_swapping@random-engines:
- bat-adlp-6: NOTRUN -> [SKIP][3] ([i915#4613]) +3 other tests skip
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-6/igt@[email protected]

* igt@gem_tiled_pread_basic@basic:
- bat-adlp-6: NOTRUN -> [SKIP][4] ([i915#15656])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-6/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- bat-adlp-6: NOTRUN -> [DMESG-WARN][5] ([i915#15673]) +78 other tests dmesg-warn
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-6/igt@[email protected]

* igt@i915_pm_rps@basic-api:
- bat-adlp-6: NOTRUN -> [SKIP][6] ([i915#6621])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-6/igt@[email protected]

* igt@intel_hwmon@hwmon-read:
- bat-adlp-6: NOTRUN -> [SKIP][7] ([i915#7707]) +1 other test skip
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-6/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-adlp-6: NOTRUN -> [SKIP][8] ([i915#4103]) +1 other test skip
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-6/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-adlp-6: NOTRUN -> [SKIP][9] ([i915#17452])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-6/igt@[email protected]

* igt@kms_setmode@basic-clone-single-crtc:
- bat-adlp-6: NOTRUN -> [SKIP][10] ([i915#3555])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-6/igt@[email protected]

* igt@prime_vgem@basic-write:
- bat-adlp-6: NOTRUN -> [SKIP][11] ([i915#17448] / [i915#3291] / [i915#3708]) +2 other tests skip
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/bat-adlp-6/igt@[email protected]

[i915#15656]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15656
[i915#15673]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15673
[i915#17448]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/17448
[i915#17452]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/17452
[i915#3291]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3291
[i915#3555]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3708
[i915#4103]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4103
[i915#4613]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4613
[i915#6621]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/6621
[i915#7707]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/7707

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_9202 -> IGTPW_16205

CI-20190529: 20190529
CI_DRM_19592: 6e071be9c703c9e81f5be2d2601dfa5754d446e2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_16205: 16205
IGT_9202: 9202

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_16205/index.html