From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: jonathan.cavitt@intel.com, saurabhg.gupta@intel.com,
brian.welty@intel.com, tomasz.mistat@intel.com,
himanshu.girotra@intel.com, kamil.konieczny@linux.intel.com
Subject: [PATCH i-g-t 1/1] lib/xe/xe_query: Wait for xe_supports_faults
Date: Wed, 8 May 2024 12:35:45 -0700 [thread overview]
Message-ID: <20240508193545.2735209-2-jonathan.cavitt@intel.com> (raw)
In-Reply-To: <20240508193545.2735209-1-jonathan.cavitt@intel.com>
It's possible for xe_supports_faults to return false if the system is
busy with multiple running tests. This is because the check looks for
all active VMs and searches for VMs that do not have faults enabled,
returning false if any exist. Recently, this check has been changed to
return EBUSY when the check fails in this way, so wait for up to ten
seconds for all the active VMs to flush out before proceeding.
Suggested-by: Brian Welty <brian.welty@intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
lib/xe/xe_query.c | 15 ++++++++-------
lib/xe/xe_query.h | 2 +-
tests/intel/xe_exec_fault_mode.c | 9 ++++++++-
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 6df8f42649..145dee8142 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -300,27 +300,28 @@ void xe_device_put(int fd)
* xe_supports_faults:
* @fd: xe device fd
*
- * Returns true if xe device @fd allows creating vm in fault mode otherwise
- * false.
+ * Returns the return value of the ioctl. This can either be 0 if the
+ * xe device @fd allows creating a vm in fault mode, or an error value
+ * if it does not.
*
* NOTE: This function temporarily creates a VM in fault mode. Hence, while
* this function is executing, no non-fault mode VMs can be created.
*/
-bool xe_supports_faults(int fd)
+int xe_supports_faults(int fd)
{
- bool supports_faults;
+ int ret;
struct drm_xe_vm_create create = {
.flags = DRM_XE_VM_CREATE_FLAG_LR_MODE |
DRM_XE_VM_CREATE_FLAG_FAULT_MODE,
};
- supports_faults = !igt_ioctl(fd, DRM_IOCTL_XE_VM_CREATE, &create);
+ ret = igt_ioctl(fd, DRM_IOCTL_XE_VM_CREATE, &create);
- if (supports_faults)
+ if (!ret)
xe_vm_destroy(fd, create.vm_id);
- return supports_faults;
+ return ret;
}
static void xe_device_destroy_cache(void)
diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
index f91d16bdf5..54115f8f7c 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -94,7 +94,7 @@ uint64_t xe_visible_available_vram_size(int fd, int gt);
uint32_t xe_get_default_alignment(int fd);
uint32_t xe_va_bits(int fd);
uint16_t xe_dev_id(int fd);
-bool xe_supports_faults(int fd);
+int xe_supports_faults(int fd);
const char *xe_engine_class_string(uint32_t engine_class);
bool xe_has_engine_class(int fd, uint16_t engine_class);
bool xe_has_media_gt(int fd);
diff --git a/tests/intel/xe_exec_fault_mode.c b/tests/intel/xe_exec_fault_mode.c
index 0b3f4cb8de..c1402889d9 100644
--- a/tests/intel/xe_exec_fault_mode.c
+++ b/tests/intel/xe_exec_fault_mode.c
@@ -406,8 +406,15 @@ igt_main
int fd;
igt_fixture {
+ struct timespec tv = {};
+ bool supports_faults;
+ int ret;
fd = drm_open_driver(DRIVER_XE);
- igt_require(xe_supports_faults(fd));
+ do {
+ ret = xe_supports_faults(fd);
+ } while (ret == -EBUSY && igt_seconds_elapsed(&tv) < 10);
+ supports_faults = !ret;
+ igt_require(supports_faults);
}
for (const struct section *s = sections; s->name; s++) {
--
2.25.1
next prev parent reply other threads:[~2024-05-08 19:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 19:35 [PATCH i-g-t 0/1] lib/xe/xe_query: Wait for xe_supports_faults Jonathan Cavitt
2024-05-08 19:35 ` Jonathan Cavitt [this message]
2024-05-09 16:20 ` [PATCH i-g-t 1/1] " Kamil Konieczny
2024-05-09 16:30 ` Cavitt, Jonathan
2024-05-10 15:58 ` Kamil Konieczny
2024-05-08 21:35 ` ✓ Fi.CI.BAT: success for " Patchwork
2024-05-08 22:00 ` ✓ CI.xeBAT: " Patchwork
2024-05-09 9:43 ` ✗ CI.xeFULL: failure " Patchwork
2024-05-09 12:02 ` ✗ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-05-03 19:37 [PATCH i-g-t 0/1] " Jonathan Cavitt
2024-05-03 19:37 ` [PATCH i-g-t 1/1] " Jonathan Cavitt
2024-05-08 16:23 ` Kamil Konieczny
2024-05-08 16:43 ` Cavitt, Jonathan
2024-05-08 17:11 ` Kamil Konieczny
2024-05-09 1:27 ` Welty, Brian
2024-05-09 14:27 ` Cavitt, Jonathan
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=20240508193545.2735209-2-jonathan.cavitt@intel.com \
--to=jonathan.cavitt@intel.com \
--cc=brian.welty@intel.com \
--cc=himanshu.girotra@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=saurabhg.gupta@intel.com \
--cc=tomasz.mistat@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