From: Katarzyna Dec <katarzyna.dec@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t v2] lib: Check if device is not wedged while opening fd
Date: Tue, 18 Feb 2020 13:58:33 +0100 [thread overview]
Message-ID: <20200218125833.29629-1-katarzyna.dec@intel.com> (raw)
In-Reply-To: <20200218125333.29250-1-katarzyna.dec@intel.com>
In rare cases it is possible to use wedged device in testing,
what is causing to have false results. Let's abort any fd usage when
GPU is wedged. Use sysfs to check status to make any environment happy.
v2: removed unnecessary file
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Zbigniew Kempczynski <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala@intel.com>
---
lib/drmtest.c | 1 +
lib/igt_device.c | 18 ++++++++++++++++++
lib/igt_device.h | 2 ++
3 files changed, 21 insertions(+)
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 1fc39925..e770462e 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -476,6 +476,7 @@ int drm_open_driver(int chipset)
}
}
+ igt_fail_on_f(igt_device_is_wedged(fd), "Device is wedged.\n");
return fd;
}
diff --git a/lib/igt_device.c b/lib/igt_device.c
index 07bb0a0d..6284aff7 100644
--- a/lib/igt_device.c
+++ b/lib/igt_device.c
@@ -236,3 +236,21 @@ struct pci_device *igt_device_get_pci_device(int fd)
return pci_dev;
}
+
+/**
+ * igt_device_is_wedged:
+ * @fd: device fd
+ *
+ * Return true is device is wedged.
+ */
+bool igt_device_is_wedged(int fd)
+{
+ char buf[2];
+
+ igt_debugfs_read(fd, "i915_wedged", buf);
+
+ if (!strstr(buf, "0"))
+ return true;
+
+ return false;
+}
diff --git a/lib/igt_device.h b/lib/igt_device.h
index 278ba7a9..cb3f9b94 100644
--- a/lib/igt_device.h
+++ b/lib/igt_device.h
@@ -34,4 +34,6 @@ void igt_device_drop_master(int fd);
int igt_device_get_card_index(int fd);
struct pci_device *igt_device_get_pci_device(int fd);
+bool igt_device_is_wedged(int fd);
+
#endif /* __IGT_DEVICE_H__ */
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-02-18 12:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-18 12:53 [igt-dev] [PATCH i-g-t] lib: Check if device is not wedged while opening fd Katarzyna Dec
2020-02-18 12:56 ` Chris Wilson
2020-02-18 13:35 ` Katarzyna Dec
2020-02-18 12:58 ` Katarzyna Dec [this message]
2020-02-18 20:11 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib: Check if device is not wedged while opening fd (rev2) 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=20200218125833.29629-1-katarzyna.dec@intel.com \
--to=katarzyna.dec@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@intel.com \
/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