Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/2] tests/core_hotunplug: Always check device health after late close
Date: Wed, 12 Oct 2022 13:02:03 +0200	[thread overview]
Message-ID: <20221012110203.644576-3-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20221012110203.644576-1-janusz.krzysztofik@linux.intel.com>

Subtests hotrebind and hotreplug perform post-operation device healthcheck
while keeping an old instance of the device still open.  If that
healthcheck succeeds, the subtest deliberately returns success, without
closing that old device instance first, so potential issues when closing
it don't contribute to those subtests' results (we have dedicated subtests
-- hotrebind-lateclose and hotreplug-lateclose -- focused on that step).
Next, recover() function called from a follow-up igt_fixture section only
closes the old device, without re-checking whether the new device is still
healthy thereafter.  As a consequence, next tasks may be executed in an
insane environment.

Teach recover() to perform additional healthckech right after device close
if preceding subtest succeeded but left the device open.  Since next
recovery steps can recognize potential failure of that healthcheck by
non-NULL error message passed back, safely ignore the healtheck return
value.

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

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index 68fd92238c..ebb646b50f 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -463,8 +463,13 @@ static void pre_check(struct hotunplug *priv)
 
 static void recover(struct hotunplug *priv)
 {
+	bool late_close = priv->fd.drm >= 0;
+
 	cleanup(priv);
 
+	if (!priv->failure && late_close)
+		igt_ignore_warn(healthcheck(priv, 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)
-- 
2.25.1

  parent reply	other threads:[~2022-10-12 11:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 11:02 [igt-dev] [PATCH i-g-t 0/2] tests/core_hotunplug: Health check fixes Janusz Krzysztofik
2022-10-12 11:02 ` [igt-dev] [PATCH i-g-t 1/2] tests/core_hotunplug: Select health checks for initially detected chipset Janusz Krzysztofik
2022-11-02 16:13   ` Mauro Carvalho Chehab
2022-10-12 11:02 ` Janusz Krzysztofik [this message]
2022-11-02 16:17   ` [igt-dev] [PATCH i-g-t 2/2] tests/core_hotunplug: Always check device health after late close Mauro Carvalho Chehab
2022-10-12 11:48 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/core_hotunplug: Health check fixes Patchwork
2022-10-12 15:59 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221012110203.644576-3-janusz.krzysztofik@linux.intel.com \
    --to=janusz.krzysztofik@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox