[PATCH i-g-t 18/20] tests/core_hotunplug: Add 'lateclose before recover' variants

Janusz Krzysztofik janusz.krzysztofik at linux.intel.com
Fri Jul 24 10:44:01 UTC 2020


If a GPU gets wedged during driver rebind or device re-plug for some
reason, current hotunbind/hotunplug test variants may time out before
lateclose phase, resulting in incomplete CI reports.  Let's rename
those variants to more adequate hotrebind/hotreplug-lateclose and add
new variants focused on exercising the lateclose phase regardless of
potential rebind/re-plug issues under old names.

v2: rebase on upstream
v3: rebase on new enhancements

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

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index fdd67fe26..a995ee9da 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -321,6 +321,36 @@ static void hotunbind_lateclose(struct hotunplug *priv)
 
 	driver_unbind(priv, "hot ");
 
+	igt_debug("late closing the unbound device instance\n");
+	priv->fd.drm = local_close(priv->fd.drm);
+	igt_assert_f(priv->fd.drm == -1, "Device close failed\n");
+}
+
+static void hotunplug_lateclose(struct hotunplug *priv)
+{
+	igt_debug("opening device\n");
+	priv->fd.drm = __drm_open_driver(DRIVER_ANY);
+	igt_assert_fd(priv->fd.drm);
+
+	priv->failure = "subtest failure";
+
+	device_unplug(priv, "hot ");
+
+	igt_debug("late closing the removed device instance\n");
+	priv->fd.drm = local_close(priv->fd.drm);
+	igt_assert_f(priv->fd.drm == -1, "Device close failed\n");
+}
+
+static void hotrebind_lateclose(struct hotunplug *priv)
+{
+	igt_debug("opening device\n");
+	priv->fd.drm = __drm_open_driver(DRIVER_ANY);
+	igt_assert_fd(priv->fd.drm);
+
+	priv->failure = "subtest failure";
+
+	driver_unbind(priv, "hot ");
+
 	driver_bind(priv);
 
 	igt_debug("late closing the unbound device instance\n");
@@ -328,7 +358,7 @@ static void hotunbind_lateclose(struct hotunplug *priv)
 	igt_assert_f(priv->fd.drm == -1, "Device close failed\n");
 }
 
-static void hotunplug_lateclose(struct hotunplug *priv)
+static void hotreplug_lateclose(struct hotunplug *priv)
 {
 	igt_debug("opening device\n");
 	priv->fd.drm = __drm_open_driver(DRIVER_ANY);
@@ -451,6 +481,30 @@ igt_main
 			recover(&priv);
 	}
 
+	igt_fixture
+		post_healthcheck(&priv);
+
+	igt_subtest_group {
+		igt_describe("Check if the driver can be cleanly unbound from an open device and rebound back, then released");
+		igt_subtest("hotrebind-lateclose")
+			hotrebind_lateclose(&priv);
+
+		igt_fixture
+			recover(&priv);
+	}
+
+	igt_fixture
+		post_healthcheck(&priv);
+
+	igt_subtest_group {
+		igt_describe("Check if a still open device can be cleanly unplugged and recovered, then released");
+		igt_subtest("hotreplug-lateclose")
+			hotreplug_lateclose(&priv);
+
+		igt_fixture
+			recover(&priv);
+	}
+
 	igt_fixture {
 		post_healthcheck(&priv);
 
-- 
2.21.1



More information about the Intel-gfx-trybot mailing list