[PATCH i-g-t v2 5/6] tests/core_hotunplug: Always check device health after late close

Janusz Krzysztofik janusz.krzysztofik at linux.intel.com
Mon Sep 19 09:21:42 UTC 2022


Subtests hotrebind and hotreplug perform post-operation device healthcheck
while keeping an old instance of the device still open, then, if the
healthcheck succeeds, return without closing that old device instance.
Next, recover() function called from a follow-up igt_fixture section only
closes the old device, without re-checking the device health thereafter.
As a consequence, next tasks may be executed in an insane environment.

Mark the device as requiring a healthcheck before return from those
subtests, and teach recover() to perform additional healthckech after
device close if that mark is set.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
 tests/core_hotunplug.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index 7c7ed09e63..205287f57f 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -467,6 +467,11 @@ static void recover(struct hotunplug *priv)
 {
 	cleanup(priv);
 
+	if (priv->need_healthcheck) {
+		igt_ignore_warn(healthcheck(priv, true));
+		priv->need_healthcheck = false;
+	}
+
 	/* unbind the driver from a possibly hot rebound unhealthy device */
 	if (!faccessat(priv->fd.sysfs_drv, priv->dev_bus_addr, F_OK, 0) &&
 	    priv->fd.drm == -1 && priv->fd.drm_hc == -1 && priv->failure)
@@ -571,6 +576,8 @@ static void hotrebind(struct hotunplug *priv)
 	driver_bind(priv, 0);
 
 	igt_assert_f(healthcheck(priv, false), "%s\n", priv->failure);
+
+	priv->need_healthcheck = true;
 }
 
 static void hotreplug(struct hotunplug *priv)
@@ -584,6 +591,8 @@ static void hotreplug(struct hotunplug *priv)
 	bus_rescan(priv, 0);
 
 	igt_assert_f(healthcheck(priv, false), "%s\n", priv->failure);
+
+	priv->need_healthcheck = true;
 }
 
 static void hotrebind_lateclose(struct hotunplug *priv)
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list