From patchwork Thu Aug 20 14:52:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11726415 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E845739 for ; Thu, 20 Aug 2020 14:53:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27DA22078B for ; Thu, 20 Aug 2020 14:53:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27DA22078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 68BC56E94A; Thu, 20 Aug 2020 14:53:26 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id AEBDD6E94A; Thu, 20 Aug 2020 14:53:25 +0000 (UTC) IronPort-SDR: I9oHBlgmlrPAozFR89VQ+ZLOim42astkh2/81L0X7pCN/zVuFmiajNVBD4NFshhrBx9o3/Djfo TkMM18wbvtFQ== X-IronPort-AV: E=McAfee;i="6000,8403,9718"; a="240136340" X-IronPort-AV: E=Sophos;i="5.76,333,1592895600"; d="scan'208";a="240136340" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2020 07:53:24 -0700 IronPort-SDR: 7EMFrTdkI10Wl1M++seevX+ooDodKlAjTuDVvr25d8Eetuov8M2FQ41HUEMHF5WjDfMv5qsoTI sCZfRxzjcyeQ== X-IronPort-AV: E=Sophos;i="5.76,333,1592895600"; d="scan'208";a="472679842" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2020 07:53:22 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Thu, 20 Aug 2020 16:52:14 +0200 Message-Id: <20200820145215.13238-19-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200820145215.13238-1-janusz.krzysztofik@linux.intel.com> References: <20200820145215.13238-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 18/19] tests/core_hotunplug: Add 'lateclose before restore' variants X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Micha=C5=82_Winiarski?= , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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. Rename those variants to more adequate hotrebind/hotreplug-lateclose and add new variants under the old names focused on exercising the lateclose phase regardless of potential rediscover/rebind issues. Moreover, add two more variants which exercise driver rebind / device restore after late close specifically. 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. Signed-off-by: Janusz Krzysztofik Reviewed-by: MichaƂ Winiarski # v2 --- tests/core_hotunplug.c | 114 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 109 insertions(+), 5 deletions(-) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 277679ea1..42a13f8b5 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -360,8 +360,6 @@ static void hotunbind_lateclose(struct hotunplug *priv) driver_unbind(priv, "hot ", 0); - driver_bind(priv, 60); - igt_debug("late closing the unbound device instance\n"); priv->fd.drm = close_device(priv->fd.drm); igt_assert_eq(priv->fd.drm, -1); @@ -373,11 +371,69 @@ static void hotunplug_lateclose(struct hotunplug *priv) device_unplug(priv, "hot ", 0); - bus_rescan(priv, 60); + igt_debug("late closing the removed device instance\n"); + 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); + + igt_debug("late closing the unbound device instance\n"); + priv->fd.drm = close_device(priv->fd.drm); + igt_assert_eq(priv->fd.drm, -1); + + driver_bind(priv, 0); + + healthcheck(priv, false); +} + +static void hotunplug_rescan(struct hotunplug *priv) +{ + priv->fd.drm = local_drm_open_driver("", " for hotreplug"); + + device_unplug(priv, "hot ", 60); + + igt_debug("late closing the removed device instance\n"); + priv->fd.drm = close_device(priv->fd.drm); + igt_assert_eq(priv->fd.drm, -1); + + bus_rescan(priv, 0); + + healthcheck(priv, false); +} + +static void hotrebind_lateclose(struct hotunplug *priv) +{ + priv->fd.drm = local_drm_open_driver("", " for hotrebind"); + + driver_unbind(priv, "hot ", 60); + + driver_bind(priv, 0); + + igt_debug("late closing the unbound device instance\n"); + priv->fd.drm = close_device(priv->fd.drm); + igt_assert_eq(priv->fd.drm, -1); + + healthcheck(priv, false); +} + +static void hotreplug_lateclose(struct hotunplug *priv) +{ + priv->fd.drm = local_drm_open_driver("", " for hotreplug"); + + device_unplug(priv, "hot ", 60); + + bus_rescan(priv, 0); igt_debug("late closing the removed device instance\n"); priv->fd.drm = close_device(priv->fd.drm); igt_assert_eq(priv->fd.drm, -1); + + healthcheck(priv, false); } /* Main */ @@ -410,7 +466,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); @@ -422,7 +478,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); @@ -454,6 +510,54 @@ igt_main 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_subtest("hotunbind-rebind") + hotunbind_rebind(&priv); + + igt_fixture + recover(&priv); + } + + igt_fixture + post_healthcheck(&priv); + + igt_subtest_group { + igt_describe("Check if a device can be cleanly restored after hotunplug-lateclose"); + 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); + } + + igt_fixture + post_healthcheck(&priv); + + igt_subtest_group { + 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); + } + igt_fixture { post_healthcheck(&priv);