* [Intel-gfx] [PATCH i-g-t 1/2] lib: Immediately cancel a spinner for an expired timeout
@ 2021-01-05 21:26 Chris Wilson
2021-01-05 21:26 ` [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_spin_batch: Check for userptr before use Chris Wilson
0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2021-01-05 21:26 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev, Chris Wilson
If the relative timeout to igt_spin_set_timeout() is in the past,
immediately end the spinner.
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2903
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
lib/igt_dummyload.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 6ecaf8506..34ad92216 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -485,10 +485,14 @@ void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns)
pthread_attr_t attr;
int timerfd;
- igt_assert(ns > 0);
if (!spin)
return;
+ if (ns <= 0) {
+ igt_spin_end(spin);
+ return;
+ }
+
igt_assert(spin->timerfd == -1);
timerfd = timerfd_create(CLOCK_MONOTONIC, 0);
igt_assert(timerfd >= 0);
--
2.30.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_spin_batch: Check for userptr before use
2021-01-05 21:26 [Intel-gfx] [PATCH i-g-t 1/2] lib: Immediately cancel a spinner for an expired timeout Chris Wilson
@ 2021-01-05 21:26 ` Chris Wilson
0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2021-01-05 21:26 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev, Chris Wilson
If the device cannot handle coherent memory, it will disallow userptr.
Check before use.
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2904
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
tests/i915/gem_spin_batch.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/tests/i915/gem_spin_batch.c b/tests/i915/gem_spin_batch.c
index c2ce2373b..2ec278857 100644
--- a/tests/i915/gem_spin_batch.c
+++ b/tests/i915/gem_spin_batch.c
@@ -176,6 +176,25 @@ static void spin_all(int i915, unsigned int flags)
}
}
+static bool has_userptr(int fd)
+{
+ struct drm_i915_gem_userptr userptr;
+ int err;
+
+ memset(&userptr, 0, sizeof(userptr));
+ userptr.user_size = 8192;
+ userptr.user_ptr = -4096;
+
+ err = 0;
+ if (drmIoctl(fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr)) {
+ err = errno;
+ igt_assume(err);
+ }
+ errno = 0;
+
+ return err == EFAULT;
+}
+
igt_main
{
const struct intel_execution_engine2 *e2;
@@ -235,8 +254,10 @@ igt_main
igt_subtest("spin-each")
spin_on_all_engines(fd, 0, 3);
- igt_subtest("user-each")
+ igt_subtest("user-each") {
+ igt_require(has_userptr(fd));
spin_on_all_engines(fd, IGT_SPIN_USERPTR, 3);
+ }
igt_fixture {
igt_stop_hang_detector();
--
2.30.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-05 21:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 21:26 [Intel-gfx] [PATCH i-g-t 1/2] lib: Immediately cancel a spinner for an expired timeout Chris Wilson
2021-01-05 21:26 ` [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_spin_batch: Check for userptr before use Chris Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).