Skip to contentSkip to conversation

lib/igt_kmod: Allow some leeway in igt_kmod_unload_r

PATCH In review Jonathan Cavitt 3 participants 3 messages Jan 17, 2023 – Jan 18, 2023 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_kmod: Allow some leeway in igt_kmod_unload_r

kmod_module_remove_module occasionally returns EAGAIN for mei_gsc in the setup of some gem_lmem_swapping subtests. Just because EAGAIN is returned doesn't mean the module is lost and unable to be unloaded. Try again some number of times (currently 10) before giving up.

Retries will occur for -EBUSY and -EAGAIN, as these imply the system is waiting for the target module can simply be waited for. All other errors exit immediately, but as the context for each error informs their relative severity, no warnings will be issued.

CC Stuart Summers <[email protected]>
CC Sandeep Kumar Parupalli <[email protected]>
CC Chris Wilson <[email protected]>
---
 lib/igt_kmod.c | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)
lib/igt_kmod.c +29 -3
index 17090110c..10c79b740 100644
@@ -253,8 +253,11 @@ out:
 
 static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags)
 {
+#define MAX_TRIES	20
+#define SLEEP_DURATION	500000
 	struct kmod_list *holders, *pos;
-	int err = 0;
+	int err, tries;
+	const char *mod_name = kmod_module_get_name(kmod);
 
 	holders = kmod_module_get_holders(kmod);
 	kmod_list_foreach(pos, holders) {
@@ -269,7 +272,6 @@ static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags)
 		return err;
 
 	if (igt_kmod_is_loading(kmod)) {
-		const char *mod_name = kmod_module_get_name(kmod);
 		igt_debug("%s still initializing\n", mod_name);
 		err = igt_wait(!igt_kmod_is_loading(kmod), 10000, 100);
 		if (err < 0) {
@@ -279,7 +281,31 @@ static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags)
 		}
 	}
 
-	return kmod_module_remove_module(kmod, flags);
+	for (tries = 0; tries < MAX_TRIES; tries++) {
+		bool loop = false;
+
+		err = kmod_module_remove_module(kmod, flags);
+
+		/* Only loop in the following cases */
+		loop = err == -EBUSY || err == -EAGAIN;
+
+		if (!loop)
+			break;
+
+		igt_debug("Module %s failed to unload with err: %d on attempt: %i\n",
+			  mod_name, err, tries + 1);
+
+		usleep(SLEEP_DURATION);
+	}
+
+	if (err && err != -ENOENT)
+		igt_info("Module %s failed to unload with err: %d after ~%.1fms\n",
+			 mod_name, err, SLEEP_DURATION*tries/1000.);
+	else if (tries)
+		igt_info("Module %s unload took ~%.1fms over %i attempts\n",
+			 mod_name, SLEEP_DURATION*tries/1000., tries + 1);
+
+	return err;
 }
 
 /**
Signature · 1 line
2.25.1
#1 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_kmod: Allow some leeway in igt_kmod_unload_r (rev2)

== Series Details ==

== Series Details ==

Series: lib/igt_kmod: Allow some leeway in igt_kmod_unload_r (rev2)
URL : https://patchwork.freedesktop.org/series/112566/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12594 -> IGTPW_8354
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes introduced in IGTPW_8354, please notify your bug team 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_8354/index.html

Participating hosts (42 -> 41)
------------------------------

Additional (1): fi-skl-6700k2
Missing (2): fi-bsw-kefka fi-snb-2520m

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

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

### IGT changes ###

#### Possible regressions ####

* igt@i915_module_load@load:
- fi-ctg-p8600: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12594/fi-ctg-p8600/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/fi-ctg-p8600/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_huc_copy@huc-copy:
- fi-skl-6700k2: NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#2190])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/fi-skl-6700k2/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- fi-skl-6700k2: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#4613]) +3 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/fi-skl-6700k2/igt@[email protected]

* igt@i915_selftest@live@execlists:
- fi-bsw-nick: [PASS][5] -> [INCOMPLETE][6] ([i915#6972])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12594/fi-bsw-nick/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/fi-bsw-nick/igt@i915_selftest@[email protected]

* igt@prime_vgem@basic-userptr:
- fi-skl-6700k2: NOTRUN -> [SKIP][7] ([fdo#109271]) +14 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/fi-skl-6700k2/igt@[email protected]

* igt@runner@aborted:
- fi-bsw-nick: NOTRUN -> [FAIL][8] ([fdo#109271] / [i915#4312])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/fi-bsw-nick/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_gttfill@basic:
- fi-pnv-d510: [FAIL][9] ([i915#7229]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12594/fi-pnv-d510/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/fi-pnv-d510/igt@[email protected]

* igt@gem_exec_suspend@basic-s3@smem:
- {bat-rplp-1}: [DMESG-WARN][11] ([i915#2867]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12594/bat-rplp-1/igt@gem_exec_suspend@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/bat-rplp-1/igt@gem_exec_suspend@[email protected]

* igt@i915_selftest@live@reset:
- {bat-rpls-1}: [DMESG-FAIL][13] ([i915#4983]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12594/bat-rpls-1/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/bat-rpls-1/igt@i915_selftest@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions:
- fi-bsw-n3050: [FAIL][15] ([i915#6298]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12594/fi-bsw-n3050/igt@kms_cursor_legacy@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/fi-bsw-n3050/igt@kms_cursor_legacy@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc@pipe-b-lvds-1:
- fi-ctg-p8600: [FAIL][17] ([fdo#103375]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12594/fi-ctg-p8600/igt@kms_pipe_crc_basic@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/fi-ctg-p8600/igt@kms_pipe_crc_basic@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6972]: https://gitlab.freedesktop.org/drm/intel/issues/6972
[i915#7229]: https://gitlab.freedesktop.org/drm/intel/issues/7229
[i915#7359]: https://gitlab.freedesktop.org/drm/intel/issues/7359
[i915#7625]: https://gitlab.freedesktop.org/drm/intel/issues/7625

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

* CI: CI-20190529 -> None
* IGT: IGT_7121 -> IGTPW_8354

CI-20190529: 20190529
CI_DRM_12594: 5cec9cff5436577179bab7b52de0465ba169691a @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8354: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8354/index.html
IGT_7121: aa16e81259f59734230d441905b9d0f605e4a4b5 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

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

#2 lore raw
In reply to Jonathan Cavitt

Hi Jonathan,

few more nits, see below.

Quoted 46 lines · Jonathan Cavitt

kmod_module_remove_module occasionally returns EAGAIN for mei_gsc in the setup of some gem_lmem_swapping subtests. Just because EAGAIN is returned doesn't mean the module is lost and unable to be unloaded. Try again some number of times (currently 10) before giving up.

Retries will occur for -EBUSY and -EAGAIN, as these imply the system is waiting for the target module can simply be waited for. All other errors exit immediately, but as the context for each error informs their relative severity, no warnings will be issued.

CC Stuart Summers <[email protected]>
CC Sandeep Kumar Parupalli <[email protected]>
CC Chris Wilson <[email protected]>
---
 lib/igt_kmod.c | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)
lib/igt_kmod.c +4 -2
index 17090110c..10c79b740 100644
@@ -253,8 +253,11 @@ out:
 
 static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags)
 {
+#define MAX_TRIES	20
+#define SLEEP_DURATION	500000
 	struct kmod_list *holders, *pos;
-	int err = 0;
+	int err, tries;
+	const char *mod_name = kmod_module_get_name(kmod);
 
 	holders = kmod_module_get_holders(kmod);
 	kmod_list_foreach(pos, holders) {
@@ -269,7 +272,6 @@ static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags)
 		return err;
 
 	if (igt_kmod_is_loading(kmod)) {
-		const char *mod_name = kmod_module_get_name(kmod);
 		igt_debug("%s still initializing\n", mod_name);
 		err = igt_wait(!igt_kmod_is_loading(kmod), 10000, 100);
 		if (err < 0) {

lib/igt_kmod.c static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags) · line 285

Quoted 6 lines
lib/igt_kmod.c +2 -1
@@ -279,7 +281,31 @@ static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags)
 		}
 	}
 
-	return kmod_module_remove_module(kmod, flags);
+	for (tries = 0; tries < MAX_TRIES; tries++) {
+		bool loop = false;

Remove this var, see below.

lib/igt_kmod.c static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags) · line 293

Quoted 8 lines
lib/igt_kmod.c +8 -0
+
+		err = kmod_module_remove_module(kmod, flags);
+
+		/* Only loop in the following cases */
+		loop = err == -EBUSY || err == -EAGAIN;
+
+		if (!loop)
+			break;

Instead of using loop var just test and break,

		if (err != -EBUSY && err != -EAGAIN)
			break;

lib/igt_kmod.c static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags) · line 297

Quoted 4 lines
lib/igt_kmod.c +4 -0
+
+		igt_debug("Module %s failed to unload with err: %d on attempt: %i\n",
+			  mod_name, err, tries + 1);
+

Avoid sleep before break, so
if (tries < MAX_TRIES - 1)

lib/igt_kmod.c static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags) · line 306

Quoted 9 lines
lib/igt_kmod.c +9 -0
+		usleep(SLEEP_DURATION);
+	}
+
+	if (err && err != -ENOENT)
+		igt_info("Module %s failed to unload with err: %d after ~%.1fms\n",
+			 mod_name, err, SLEEP_DURATION*tries/1000.);
+	else if (tries)
+		igt_info("Module %s unload took ~%.1fms over %i attempts\n",
+			 mod_name, SLEEP_DURATION*tries/1000., tries + 1);

imho it should also print reasonable info about -ENOENT and -ENOTSUP

Regards,
Kamil

Quoted 8 lines
lib/igt_kmod.c +2 -0
+
+	return err;
 }
 
 /**
Signature · 1 line
2.25.1