[PATCH i-g-t 1/1] lib/xe/xe_query: Wait for xe_supports_faults
Jonathan Cavitt
jonathan.cavitt at intel.com
Fri May 3 19:37:14 UTC 2024
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 at intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
---
lib/xe/xe_query.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 6df8f42649..5458c73417 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -314,8 +314,13 @@ bool xe_supports_faults(int fd)
.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);
+ struct timespec tv = {};
+ int result, timeout;
+ do {
+ result = igt_ioctl(fd, DRM_IOCTL_XE_VM_CREATE, &create);
+ supports_faults = !result;
+ timeout = igt_seconds_elapsed(&tv);
+ } while (result == -EBUSY && timeout < 10);
if (supports_faults)
xe_vm_destroy(fd, create.vm_id);
--
2.25.1
More information about the igt-dev
mailing list