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. Add new test variants which close the device before restoring it. Also rename old variants to more adequate hotrebind/hotreplug-lateclose and perform health checks both before and after late close. v2: Rebase on upstream. v3: Refresh, - further rename hotunbind/hotunplug-lateclose to hotunbind-rebind and hotunplug-rescan respectively, then add two more variants under the old names which only exercise late close, leaving rebind / rescan to be cared of in the post-subtest recovery phase, - also update descriptions of unmodified subtests for consistency. v4: Refresh, - drop subtests with no health checks, adjust timeouts in successors, - perform health checks of hot restored devices also before late close, - in order to be able to safely run a health check while still keeping an unbound / unplugged device instance open, also preserve the open device fd, not only a close error, - adjust subtest descriptions. v5: Refresh, - split out pre-lateclose health checks and related changes, introduced in v4, to a separate patch. Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@xxxxxxxxxxxxxxx> Reviewed-by: Michał Winiarski <michal.winiarski@xxxxxxxxx> # v2 --- tests/core_hotunplug.c | 78 +++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index bc82ae3fb..436517ce5 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -394,28 +394,58 @@ static void unplug_rescan(struct hotunplug *priv) healthcheck(priv, false); } -static void hotunbind_lateclose(struct hotunplug *priv) +static void hotunbind_rebind(struct hotunplug *priv) { igt_assert_eq(priv->fd.drm, -1); priv->fd.drm = local_drm_open_driver(false, "", " for hot unbind"); driver_unbind(priv, "hot ", 0); - driver_bind(priv, 0); - priv->fd.drm = close_device(priv->fd.drm, "late ", "unbound "); igt_assert_eq(priv->fd.drm, -1); + driver_bind(priv, 0); + healthcheck(priv, false); } -static void hotunplug_lateclose(struct hotunplug *priv) +static void hotunplug_rescan(struct hotunplug *priv) { igt_assert_eq(priv->fd.drm, -1); priv->fd.drm = local_drm_open_driver(false, "", " for hot unplug"); device_unplug(priv, "hot ", 0); + priv->fd.drm = close_device(priv->fd.drm, "late ", "removed "); + igt_assert_eq(priv->fd.drm, -1); + + bus_rescan(priv, 0); + + healthcheck(priv, false); +} + +static void hotrebind_lateclose(struct hotunplug *priv) +{ + igt_assert_eq(priv->fd.drm, -1); + priv->fd.drm = local_drm_open_driver(false, "", " for hot rebind"); + + driver_unbind(priv, "hot ", 60); + + driver_bind(priv, 0); + + priv->fd.drm = close_device(priv->fd.drm, "late ", "unbound "); + igt_assert_eq(priv->fd.drm, -1); + + healthcheck(priv, false); +} + +static void hotreplug_lateclose(struct hotunplug *priv) +{ + igt_assert_eq(priv->fd.drm, -1); + priv->fd.drm = local_drm_open_driver(false, "", " for hot replug"); + + device_unplug(priv, "hot ", 60); + bus_rescan(priv, 0); priv->fd.drm = close_device(priv->fd.drm, "late ", "removed "); @@ -458,7 +488,7 @@ igt_main } igt_subtest_group { - igt_describe("Check if the driver can be cleanly unbound from a device believed to be closed"); + igt_describe("Check if the driver can be cleanly unbound from a device believed to be closed, then rebound"); igt_subtest("unbind-rebind") unbind_rebind(&priv); @@ -470,7 +500,7 @@ igt_main post_healthcheck(&priv); igt_subtest_group { - igt_describe("Check if a device believed to be closed can be cleanly unplugged"); + igt_describe("Check if a device believed to be closed can be cleanly unplugged, then restored"); igt_subtest("unplug-rescan") unplug_rescan(&priv); @@ -482,9 +512,33 @@ 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_describe("Check if the driver can be cleanly unbound from an open device, then released and rebound"); + igt_subtest("hotunbind-rebind") + hotunbind_rebind(&priv); + + igt_fixture + recover(&priv); + } + + igt_fixture + post_healthcheck(&priv); + + igt_subtest_group { + igt_describe("Check if an open device can be cleanly unplugged, then released and restored"); + igt_subtest("hotunplug-rescan") + hotunplug_rescan(&priv); + + igt_fixture + recover(&priv); + } + + igt_fixture + post_healthcheck(&priv); + + igt_subtest_group { + igt_describe("Check if the driver hot unbound from a still open device can be cleanly rebound, then the old instance released"); + igt_subtest("hotrebind-lateclose") + hotrebind_lateclose(&priv); igt_fixture recover(&priv); @@ -494,9 +548,9 @@ igt_main 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_describe("Check if a still open while hot unplugged device can be cleanly restored, then the old instance released"); + igt_subtest("hotreplug-lateclose") + hotreplug_lateclose(&priv); igt_fixture recover(&priv); -- 2.21.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx