[PATCH i-g-t 2/2] lib/igt_kmod: Do not explicitly unload intel mei driver

Lucas De Marchi lucas.demarchi at intel.com
Fri Dec 20 19:17:38 UTC 2024


On Fri, Dec 20, 2024 at 11:09:39AM -0800, Daniele Ceraolo Spurio wrote:
>
>
>
>On 12/20/2024 10:10 AM, Kamil Konieczny wrote:
>>Hi Daniele,
>>On 2024-12-18 at 15:38:30 -0800, Daniele Ceraolo Spurio wrote:
>>>The mei driver is a child of i915 on discrete, but not on integrated.
>>>This means we want to unplug it before removing i915 in the former case
>>>but not in the latter. Therefore, instead of manually unloading the mei
>>>driver, we can unbind i915 and leave it to the kernel to unplug all the
>>>dependencies. This also means that we don't need to explicitly disable
>>>the vtcon anymore.
>>Will it work also in case of both iGPU + dGPU present?
>
>It should work, yes. The i915/xe unbind will not unload the mei 
>drivers, it will just unbind them if they're bound to a gfx child 
>device. So in the case of having both igpu and dgpu the mei driver 
>will keep being bound to the CPU mei device, which is what we want.
>
>>Should we provide a tool to unload an i915 driver?
>
>A subtest of i915_module_load that just unloads could be useful. We 
>have that for Xe.


unloading the driver should not be more than unbind + unload. For a CI
testing perspective there are some issues due to bugs in other drivers.
For a developer this shouldn't really matter. I've beeing unbinding i915
via sysfs since forever - and often I don't even unload it if I don't
need to.

In future (probably not the next release though) the kmod project will
have a `kmod unbind` command to unbind modules. Unloading a module
is accomplished with `modprobe -r`.


Lucas De Marchi

>
>Daniele
>
>>
>>Regards,
>>Kamil
>>
>>>The other 2 dependencies are left untouched:
>>>- intel_ips uses symbol_get, so the automatic dependency detection won't
>>>   unload it.
>>>- the hotunplug test mentions that the sound driver can throw errors on
>>>   i915 unbind, so we need to keep the explicit unload.
>>>
>>>Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
>>>Cc: Lucas De Marchi <lucas.demarchi at intel.com>
>>>---
>>>  lib/igt_kmod.c | 9 ++-------
>>>  1 file changed, 2 insertions(+), 7 deletions(-)
>>>
>>>diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
>>>index a8b0339b9..fa9541d72 100644
>>>--- a/lib/igt_kmod.c
>>>+++ b/lib/igt_kmod.c
>>>@@ -620,16 +620,9 @@ int __igt_intel_driver_unload(char **who, const char *driver)
>>>  	const char *aux[] = {
>>>  		/* gen5: ips uses symbol_get() so only a soft module dependency */
>>>  		"intel_ips",
>>>-		/* mei_gsc uses an i915 aux dev and the other mei mods depend on it */
>>>-		"mei_pxp",
>>>-		"mei_hdcp",
>>>-		"mei_gsc",
>>>  		NULL,
>>>  	};
>>>-	/* unbind vt */
>>>-	bind_fbcon(false);
>>>-
>>>  	ret = igt_audio_driver_unload(who);
>>>  	if (ret)
>>>  		return ret;
>>>@@ -648,6 +641,8 @@ int __igt_intel_driver_unload(char **who, const char *driver)
>>>  	}
>>>  	if (igt_kmod_is_loaded(driver)) {
>>>+		igt_kmod_unbind(driver);
>>>+
>>>  		ret = igt_kmod_unload(driver);
>>>  		if (ret) {
>>>  			if (who)
>>>-- 
>>>2.43.0
>>>
>


More information about the igt-dev mailing list