[PATCH i-g-t v5 22/22] tests/core_hotunplug: A few more fixes
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Wed Aug 26 06:39:23 UTC 2020
To be split and squashed with other patches of the series:
- detect inaccessible i915 debugfs,
- unbind the driver from unhealthy device before recovery,
- drop subtests with no health checks, adjust timeouts in successors,
- perform health checks of hot restored devices also before late close.
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
tests/core_hotunplug.c | 66 ++++++++++--------------------------------
1 file changed, 16 insertions(+), 50 deletions(-)
diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index 368aa2484..cd2873d26 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -296,6 +296,9 @@ static void healthcheck(struct hotunplug *priv, bool recover)
if (is_i915_device(fd_drm)) {
/* don't report library failed asserts as healthcheck failure */
priv->failure = "Unrecoverable test failure";
+
+ gem_quiescent_gpu(fd_drm);
+
if (local_i915_healthcheck(fd_drm, "") &&
(!recover || local_i915_recover(fd_drm)))
priv->failure = "Healthcheck failure!";
@@ -319,6 +322,11 @@ static void recover(struct hotunplug *priv)
{
cleanup(priv);
+ /* unbind the driver from a possibly hot rebound unhealthy device */
+ if (priv->failure &&
+ !faccessat(priv->fd.sysfs_drv, priv->dev_bus_addr, F_OK, 0))
+ driver_unbind(priv, "post ", 60);
+
if (faccessat(priv->fd.sysfs_bus, priv->dev_bus_addr, F_OK, 0))
bus_rescan(priv, 60);
@@ -372,33 +380,11 @@ static void unplug_rescan(struct hotunplug *priv)
healthcheck(priv, false);
}
-static void hotunbind_lateclose(struct hotunplug *priv)
-{
- priv->fd.drm = local_drm_open_driver("", " for hotunbind");
-
- driver_unbind(priv, "hot ", 0);
-
- local_debug("%s\n", "late closing the unbound device instance");
- priv->fd.drm = close_device(priv->fd.drm);
- igt_assert_eq(priv->fd.drm, -1);
-}
-
-static void hotunplug_lateclose(struct hotunplug *priv)
-{
- priv->fd.drm = local_drm_open_driver("", " for hotunplug");
-
- device_unplug(priv, "hot ", 0);
-
- local_debug("%s\n", "late closing the removed device instance");
- priv->fd.drm = close_device(priv->fd.drm);
- igt_assert_eq(priv->fd.drm, -1);
-}
-
static void hotunbind_rebind(struct hotunplug *priv)
{
priv->fd.drm = local_drm_open_driver("", " for hotrebind");
- driver_unbind(priv, "hot ", 60);
+ driver_unbind(priv, "hot ", 0);
local_debug("%s\n", "late closing the unbound device instance");
priv->fd.drm = close_device(priv->fd.drm);
@@ -413,7 +399,7 @@ static void hotunplug_rescan(struct hotunplug *priv)
{
priv->fd.drm = local_drm_open_driver("", " for hotreplug");
- device_unplug(priv, "hot ", 60);
+ device_unplug(priv, "hot ", 0);
local_debug("%s\n", "late closing the removed device instance");
priv->fd.drm = close_device(priv->fd.drm);
@@ -432,6 +418,8 @@ static void hotrebind_lateclose(struct hotunplug *priv)
driver_bind(priv, 0);
+ healthcheck(priv, false);
+
local_debug("%s\n", "late closing the unbound device instance");
priv->fd.drm = close_device(priv->fd.drm);
igt_assert_eq(priv->fd.drm, -1);
@@ -447,6 +435,8 @@ static void hotreplug_lateclose(struct hotunplug *priv)
bus_rescan(priv, 0);
+ healthcheck(priv, false);
+
local_debug("%s\n", "late closing the removed device instance");
priv->fd.drm = close_device(priv->fd.drm);
igt_assert_eq(priv->fd.drm, -1);
@@ -510,31 +500,7 @@ igt_main
post_healthcheck(&priv);
igt_subtest_group {
- igt_describe("Check if the driver can be cleanly unbound from a still open device, then released");
- igt_subtest("hotunbind-lateclose")
- hotunbind_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, then released");
- igt_subtest("hotunplug-lateclose")
- hotunplug_lateclose(&priv);
-
- igt_fixture
- recover(&priv);
- }
-
- igt_fixture
- post_healthcheck(&priv);
-
- igt_subtest_group {
- igt_describe("Check if the driver can be cleanly rebound to a device after hotunbind-lateclose");
+ igt_describe("Check if the driver can be cleanly unbound from an open device, then released and rebound");
igt_subtest("hotunbind-rebind")
hotunbind_rebind(&priv);
@@ -546,7 +512,7 @@ igt_main
post_healthcheck(&priv);
igt_subtest_group {
- igt_describe("Check if a device can be cleanly restored after hotunplug-lateclose");
+ igt_describe("Check if an open device can be cleanly unplugged, then released and restored");
igt_subtest("hotunplug-rescan")
hotunplug_rescan(&priv);
--
2.21.1
More information about the Intel-gfx-trybot
mailing list