* [igt-dev] [PATCH i-g-t 1/2] i915_drm.h sync
@ 2019-10-10 7:32 Chris Wilson
2019-10-10 7:32 ` [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence Chris Wilson
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Chris Wilson @ 2019-10-10 7:32 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev
Update to commit fef476f3ab47527a00818ddaf4b46b8c09361111 (not upstream!)
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Mon Aug 5 22:55:44 2019 +0100
drm/i915: Cancel non-persistent contexts on close
for I915_CONTEXT_PARAM_PERSISTENCE
---
include/drm-uapi/i915_drm.h | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h
index 761517f15..7badfa0b1 100644
--- a/include/drm-uapi/i915_drm.h
+++ b/include/drm-uapi/i915_drm.h
@@ -521,6 +521,7 @@ typedef struct drm_i915_irq_wait {
#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)
#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)
#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)
+#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4)
#define I915_PARAM_HUC_STATUS 42
@@ -1564,6 +1565,21 @@ struct drm_i915_gem_context_param {
* i915_context_engines_bond (I915_CONTEXT_ENGINES_EXT_BOND)
*/
#define I915_CONTEXT_PARAM_ENGINES 0xa
+
+/*
+ * I915_CONTEXT_PARAM_PERSISTENCE:
+ *
+ * Allow the context and active rendering to survive the process until
+ * completion. Persistence allows fire-and-forget clients to queue up a
+ * bunch of work, hand the output over to a display server and the quit.
+ * If the context is not marked as persistent, upon closing (either via
+ * an explicit DRM_I915_GEM_CONTEXT_DESTROY or implicitly from file closure
+ * or process termination), the context and any outstanding requests will be
+ * cancelled (and exported fences for cancelled requests marked as -EIO).
+ *
+ * By default, new contexts allow persistence.
+ */
+#define I915_CONTEXT_PARAM_PERSISTENCE 0xb
/* Must be kept compact -- no holes and well documented */
__u64 value;
@@ -2032,8 +2048,10 @@ struct drm_i915_query {
* (data[X / 8] >> (X % 8)) & 1
*
* - the subslice mask for each slice with one bit per subslice telling
- * whether a subslice is available. The availability of subslice Y in slice
- * X can be queried with the following formula :
+ * whether a subslice is available. Gen12 has dual-subslices, which are
+ * similar to two gen11 subslices. For gen12, this array represents dual-
+ * subslices. The availability of subslice Y in slice X can be queried
+ * with the following formula :
*
* (data[subslice_offset +
* X * subslice_stride +
--
2.23.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 7+ messages in thread* [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence 2019-10-10 7:32 [igt-dev] [PATCH i-g-t 1/2] i915_drm.h sync Chris Wilson @ 2019-10-10 7:32 ` Chris Wilson 2019-10-15 13:05 ` Andi Shyti 2019-10-10 7:59 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] i915_drm.h sync Patchwork ` (2 subsequent siblings) 3 siblings, 1 reply; 7+ messages in thread From: Chris Wilson @ 2019-10-10 7:32 UTC (permalink / raw) To: intel-gfx; +Cc: Tvrtko Ursulin, igt-dev, Jon Bloomfield Sanity test existing persistence and new exciting non-persistent context behaviour. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Michał Winiarski <michal.winiarski@intel.com> Cc: Jon Bloomfield <jon.bloomfield@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Andi Shyti <andi.shyti@intel.com> --- lib/i915/gem_context.c | 37 +++ lib/i915/gem_context.h | 8 + lib/igt_dummyload.c | 3 +- lib/ioctl_wrappers.c | 1 + tests/Makefile.sources | 3 + tests/i915/gem_ctx_persistence.c | 407 +++++++++++++++++++++++++++++++ tests/meson.build | 1 + 7 files changed, 459 insertions(+), 1 deletion(-) create mode 100644 tests/i915/gem_ctx_persistence.c diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c index 83c5df961..1fae5191f 100644 --- a/lib/i915/gem_context.c +++ b/lib/i915/gem_context.c @@ -272,6 +272,43 @@ void gem_context_set_priority(int fd, uint32_t ctx_id, int prio) igt_assert_eq(__gem_context_set_priority(fd, ctx_id, prio), 0); } +/** + * __gem_context_set_persistence: + * @i915: open i915 drm file descriptor + * @ctx: i915 context id + * @state: desired persistence + * + * Declare whether this context is allowed to persist after closing until + * its requests are complete (persistent=true) or if it should be + * immediately reaped on closing and its requests cancelled + * (persistent=false). + * + * Returns: An integer equal to zero for success and negative for failure + */ +int __gem_context_set_persistence(int i915, uint32_t ctx, bool state) +{ + struct drm_i915_gem_context_param p = { + .ctx_id = ctx, + .param = I915_CONTEXT_PARAM_PERSISTENCE, + .value = state, + }; + + return __gem_context_set_param(i915, &p); +} + +/** + * __gem_context_set_persistence: + * @i915: open i915 drm file descriptor + * @ctx: i915 context id + * @state: desired persistence + * + * Like __gem_context_set_persistence(), except we assert on failure. + */ +void gem_context_set_persistence(int i915, uint32_t ctx, bool state) +{ + igt_assert_eq(__gem_context_set_persistence(i915, ctx, state), 0); +} + int __gem_context_clone(int i915, uint32_t src, unsigned int share, diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h index 8043c3401..c0d4c9615 100644 --- a/lib/i915/gem_context.h +++ b/lib/i915/gem_context.h @@ -24,6 +24,11 @@ #ifndef GEM_CONTEXT_H #define GEM_CONTEXT_H +#include <stdbool.h> +#include <stdint.h> + +struct drm_i915_gem_context_param; + uint32_t gem_context_create(int fd); int __gem_context_create(int fd, uint32_t *ctx_id); void gem_context_destroy(int fd, uint32_t ctx_id); @@ -58,6 +63,9 @@ int __gem_context_get_param(int fd, struct drm_i915_gem_context_param *p); int __gem_context_set_priority(int fd, uint32_t ctx, int prio); void gem_context_set_priority(int fd, uint32_t ctx, int prio); +int __gem_context_set_persistence(int i915, uint32_t ctx, bool state); +void gem_context_set_persistence(int i915, uint32_t ctx, bool state); + bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine); #endif /* GEM_CONTEXT_H */ diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c index 65b5cc927..6060878dd 100644 --- a/lib/igt_dummyload.c +++ b/lib/igt_dummyload.c @@ -450,7 +450,8 @@ void igt_spin_free(int fd, igt_spin_t *spin) gem_close(fd, spin->poll_handle); } - gem_close(fd, spin->handle); + if (spin->handle) + gem_close(fd, spin->handle); if (spin->out_fence >= 0) close(spin->out_fence); diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 280fdd624..628f8b830 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -445,6 +445,7 @@ int gem_wait(int fd, uint32_t handle, int64_t *timeout_ns) ret = 0; if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait)) ret = -errno; + errno = 0; if (timeout_ns) *timeout_ns = wait.timeout_ns; diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 343be0500..093eb57f3 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -154,6 +154,9 @@ gem_ctx_isolation_SOURCES = i915/gem_ctx_isolation.c TESTS_progs += gem_ctx_param gem_ctx_param_SOURCES = i915/gem_ctx_param.c +TESTS_progs += gem_ctx_persistence +gem_ctx_persistence_SOURCES = i915/gem_ctx_persistence.c + TESTS_progs += gem_ctx_shared gem_ctx_shared_SOURCES = i915/gem_ctx_shared.c diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c new file mode 100644 index 000000000..854c146ec --- /dev/null +++ b/tests/i915/gem_ctx_persistence.c @@ -0,0 +1,407 @@ +/* + * Copyright © 2019 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include <errno.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <unistd.h> + +#include "drmtest.h" /* gem_quiescent_gpu()! */ +#include "i915/gem_context.h" +#include "i915/gem_submission.h" +#include "igt_debugfs.h" +#include "igt_dummyload.h" +#include "igt_sysfs.h" +#include "ioctl_wrappers.h" /* gem_wait()! */ +#include "sw_sync.h" + +static bool has_persistence(int i915) +{ + struct drm_i915_gem_context_param p = { + .param = I915_CONTEXT_PARAM_PERSISTENCE, + }; + uint64_t saved; + + if (__gem_context_get_param(i915, &p)) + return false; + + saved = p.value; + p.value = 0; + if (__gem_context_set_param(i915, &p)) + return false; + + p.value = saved; + return __gem_context_set_param(i915, &p) == 0; +} + +static bool enable_hangcheck(int i915) +{ + int enabled = -1; + int dir; + + dir = igt_sysfs_open_parameters(i915); + if (dir < 0) /* no parameters, must be default! */ + return enabled; + + /* If i915.hangcheck is removed, assume the default is good */ + igt_sysfs_set(dir, "enable_hangcheck", "1"); + igt_sysfs_scanf(dir, "enable_hangcheck", "%d", &enabled); + + close(dir); + + return enabled; +} + +static void test_idempotent(int i915) +{ + struct drm_i915_gem_context_param p = { + .param = I915_CONTEXT_PARAM_PERSISTENCE, + }; + int expected; + + /* + * Simple test to verify that we are able to read back the same boolean + * value as we set. + * + * Each time we invert the current value so that at the end of the test, + * if successful, we leave the context in the original state. + */ + + gem_context_get_param(i915, &p); + expected = !!p.value; + + expected = !expected; + p.value = expected; + gem_context_set_param(i915, &p); + gem_context_get_param(i915, &p); + igt_assert_eq(p.value, expected); + + expected = !expected; /* and restores */ + p.value = expected; + gem_context_set_param(i915, &p); + gem_context_get_param(i915, &p); + igt_assert_eq(p.value, expected); +} + +static void test_persistence(int i915) +{ + igt_spin_t *spin; + int64_t timeout; + uint32_t ctx; + + /* + * Default behaviour are contexts remain alive until their last active + * request is retired -- no early termination. + */ + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, true); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_FENCE_OUT); + gem_context_destroy(i915, ctx); + + timeout = NSEC_PER_SEC / 5; + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), -ETIME); + + igt_spin_end(spin); + + timeout = NSEC_PER_SEC / 5; + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0); + igt_assert_eq(sync_fence_status(spin->out_fence), 1); + + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); +} + +static void test_nonpersistent_cleanup(int i915) +{ + int64_t timeout = NSEC_PER_SEC / 5; + igt_spin_t *spin; + uint32_t ctx; + + /* + * A nonpersistent context is terminated immediately upon closure, + * any inflight request is cancelled. + */ + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, false); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_FENCE_OUT); + gem_context_destroy(i915, ctx); + + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0); + igt_assert_eq(sync_fence_status(spin->out_fence), -EIO); + + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); +} + +static void test_nonpersistent_mixed(int i915) +{ + int fence[3]; + + /* + * Only a nonpersistent context is terminated immediately upon + * closure, any inflight request is cancelled. If there is also + * an active persistent context closed, it should be unafffected. + */ + + for (int i = 0; i < ARRAY_SIZE(fence); i++) { + igt_spin_t *spin; + uint32_t ctx; + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, i & 1); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_FENCE_OUT); + gem_context_destroy(i915, ctx); + + fence[i] = spin->out_fence; + } + + /* Outer pair of contexts were non-persistent and killed */ + igt_assert_eq(sync_fence_wait(fence[0], MSEC_PER_SEC / 5), 0); + igt_assert_eq(sync_fence_status(fence[0]), -EIO); + + igt_assert_eq(sync_fence_wait(fence[2], MSEC_PER_SEC / 5), 0); + igt_assert_eq(sync_fence_status(fence[2]), -EIO); + + /* But the middle context is still running */ + igt_assert_eq(sync_fence_wait(fence[1], 0), -ETIME); + + gem_quiescent_gpu(i915); +} + +static void test_nonpersistent_hostile(int i915) +{ + int64_t timeout = NSEC_PER_SEC / 2; + igt_spin_t *spin; + uint32_t ctx; + + /* + * If we cannot cleanly cancel the persistent context on closure, + * e.g. preemption fails, we are forced to reset the GPU to terminate + * the requests and cleanup the context. + */ + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, false); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_NO_PREEMPTION); + gem_context_destroy(i915, ctx); + + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0); + + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); +} + +static void test_nohangcheck_hostile(int i915) +{ + int64_t timeout = NSEC_PER_SEC / 2; + igt_spin_t *spin; + uint32_t ctx; + int dir; + + /* + * Even if the user disables hangcheck during their context, + * we forcibly terminate that context. + */ + + dir = igt_sysfs_open_parameters(i915); + igt_require(dir != -1); + + ctx = gem_context_create(i915); + + igt_require(igt_sysfs_set(dir, "enable_hangcheck", "0")); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_NO_PREEMPTION); + gem_context_destroy(i915, ctx); + + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0); + + igt_assert(igt_sysfs_set(dir, "enable_hangcheck", "1")); + + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); + close(dir); +} + +static void test_nonpersistent_file(int i915) +{ + igt_spin_t *spin; + uint32_t ctx; + + /* + * A context may live beyond its initial struct file, except if it + * has been made nonpersistent, in which case it must be terminated. + */ + + i915 = gem_reopen_driver(i915); + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, false); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_FENCE_OUT); + close(i915); + + igt_assert_eq(sync_fence_wait(spin->out_fence, MSEC_PER_SEC / 5), 0); + igt_assert_eq(sync_fence_status(spin->out_fence), -EIO); + + spin->handle = 0; + igt_spin_free(-1, spin); +} + +static void sendfd(int socket, int fd) +{ + char buf[CMSG_SPACE(sizeof(fd))]; + struct iovec io = { .iov_base = (char *)"ABC", .iov_len = 3 }; + struct msghdr msg = { + .msg_iov = &io, + .msg_iovlen = 1, + .msg_control = buf, + .msg_controllen = CMSG_LEN(sizeof(fd)), + }; + struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); + + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = msg.msg_controllen; + *(int *)CMSG_DATA(cmsg) = fd; + + igt_assert(sendmsg(socket, &msg, 0) != -1); +} + +static int recvfd(int socket) +{ + char m_buffer[256], c_buffer[256]; + struct iovec io = { + .iov_base = m_buffer, + .iov_len = sizeof(m_buffer), + }; + struct msghdr msg = { + .msg_iov = &io, + .msg_iovlen = 1, + .msg_control = c_buffer, + .msg_controllen = sizeof(c_buffer), + }; + + igt_assert(recvmsg(socket, &msg, 0) != -1); + return *(int *)CMSG_DATA(CMSG_FIRSTHDR(&msg)); +} + +static void test_nonpersistent_process(int i915) +{ + int fence[2], sv[2]; + + /* + * If a process dies early, any nonpersistent contexts it had + * open must be terminated too. But any persistent contexts, + * should survive until their requests are complete. + */ + + igt_require(socketpair(AF_UNIX, SOCK_DGRAM, 0, sv) == 0); + + igt_fork(child, 1) { + i915 = gem_reopen_driver(i915); + + for (int persists = 0; persists <= 1; persists++) { + igt_spin_t *spin; + uint32_t ctx; + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, persists); + + spin = igt_spin_new(i915, ctx, + .flags = IGT_SPIN_FENCE_OUT); + + sendfd(sv[0], spin->out_fence); + + igt_list_del(&spin->link); /* prevent autocleanup */ + } + } + close(sv[0]); + igt_waitchildren(); + + fence[0] = recvfd(sv[1]); + fence[1] = recvfd(sv[1]); + close(sv[1]); + + /* First fence is non-persistent, so should be reset */ + igt_assert_eq(sync_fence_wait(fence[0], MSEC_PER_SEC / 5), 0); + igt_assert_eq(sync_fence_status(fence[0]), -EIO); + close(fence[0]); + + /* Second fence is persistent, so should be still spinning */ + igt_assert_eq(sync_fence_wait(fence[1], 0), -ETIME); + close(fence[1]); + + /* We have to manually clean up the orphaned spinner */ + igt_drop_caches_set(i915, DROP_RESET_ACTIVE); + + gem_quiescent_gpu(i915); +} + +igt_main +{ + int i915; + + igt_fixture { + i915 = drm_open_driver(DRIVER_INTEL); + igt_require_gem(i915); + + igt_require(has_persistence(i915)); + igt_require(enable_hangcheck(i915)); + } + + igt_subtest_group { + igt_subtest("idempotent") + test_idempotent(i915); + + igt_subtest("persistence") + test_persistence(i915); + + igt_subtest("cleanup") + test_nonpersistent_cleanup(i915); + + igt_subtest("mixed") + test_nonpersistent_mixed(i915); + + igt_subtest("hostile") + test_nonpersistent_hostile(i915); + + igt_subtest("hangcheck") + test_nohangcheck_hostile(i915); + + igt_subtest("file") + test_nonpersistent_file(i915); + + igt_subtest("process") + test_nonpersistent_process(i915); + } + + igt_fixture { + close(i915); + } +} diff --git a/tests/meson.build b/tests/meson.build index 7e3f9e0a4..3f3eee277 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -121,6 +121,7 @@ i915_progs = [ 'gem_ctx_exec', 'gem_ctx_isolation', 'gem_ctx_param', + 'gem_ctx_persistence', 'gem_ctx_shared', 'gem_ctx_switch', 'gem_ctx_thrash', -- 2.23.0 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence 2019-10-10 7:32 ` [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence Chris Wilson @ 2019-10-15 13:05 ` Andi Shyti 0 siblings, 0 replies; 7+ messages in thread From: Andi Shyti @ 2019-10-15 13:05 UTC (permalink / raw) To: Chris Wilson; +Cc: Tvrtko Ursulin, intel-gfx, igt-dev, Jon Bloomfield Hi Chris, On Thu, Oct 10, 2019 at 08:32:58AM +0100, Chris Wilson wrote: > Sanity test existing persistence and new exciting non-persistent context > behaviour. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > Cc: Michał Winiarski <michal.winiarski@intel.com> > Cc: Jon Bloomfield <jon.bloomfield@intel.com> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > Cc: Andi Shyti <andi.shyti@intel.com> > --- > lib/i915/gem_context.c | 37 +++ > lib/i915/gem_context.h | 8 + > lib/igt_dummyload.c | 3 +- > lib/ioctl_wrappers.c | 1 + > tests/Makefile.sources | 3 + > tests/i915/gem_ctx_persistence.c | 407 +++++++++++++++++++++++++++++++ > tests/meson.build | 1 + > 7 files changed, 459 insertions(+), 1 deletion(-) > create mode 100644 tests/i915/gem_ctx_persistence.c I think this patch should be split as ioctl_wrappers, igt_dummyload have changes that are not related to "Sanity test existing persistence and new exciting non-persistent context behaviour" I think they don't affect the test itself. Without those changes: Reviewed-by: Andi Shyti <andi.shyti@intel.com> Still one question. > +static bool enable_hangcheck(int i915) how about adding here a boolean and use this function also for the test_nohangcheck_hostile() case? > +{ > + int enabled = -1; > + int dir; > + > + dir = igt_sysfs_open_parameters(i915); > + if (dir < 0) /* no parameters, must be default! */ > + return enabled; > + > + /* If i915.hangcheck is removed, assume the default is good */ > + igt_sysfs_set(dir, "enable_hangcheck", "1"); > + igt_sysfs_scanf(dir, "enable_hangcheck", "%d", &enabled); > + > + close(dir); > + > + return enabled; > +} > + > +static void test_idempotent(int i915) > +{ > + struct drm_i915_gem_context_param p = { > + .param = I915_CONTEXT_PARAM_PERSISTENCE, > + }; > + int expected; > + > + /* > + * Simple test to verify that we are able to read back the same boolean > + * value as we set. > + * > + * Each time we invert the current value so that at the end of the test, > + * if successful, we leave the context in the original state. > + */ > + > + gem_context_get_param(i915, &p); > + expected = !!p.value; > + > + expected = !expected; mmhhh... looks familiar :) Andi _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] i915_drm.h sync 2019-10-10 7:32 [igt-dev] [PATCH i-g-t 1/2] i915_drm.h sync Chris Wilson 2019-10-10 7:32 ` [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence Chris Wilson @ 2019-10-10 7:59 ` Patchwork 2019-10-10 8:23 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork 2019-10-10 15:30 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork 3 siblings, 0 replies; 7+ messages in thread From: Patchwork @ 2019-10-10 7:59 UTC (permalink / raw) To: Chris Wilson; +Cc: igt-dev == Series Details == Series: series starting with [i-g-t,1/2] i915_drm.h sync URL : https://patchwork.freedesktop.org/series/67829/ State : warning == Summary == ERROR! This series introduces new undocumented tests: gem_ctx_persistence gem_ctx_persistence@cleanup gem_ctx_persistence@file gem_ctx_persistence@hangcheck gem_ctx_persistence@hostile gem_ctx_persistence@idempotent gem_ctx_persistence@mixed gem_ctx_persistence@persistence gem_ctx_persistence@process Can you document them as per the requirement in the [CONTRIBUTING.md]? [Documentation] has more details on how to do this. Here are few examples: https://gitlab.freedesktop.org/drm/igt-gpu-tools/commit/0316695d03aa46108296b27f3982ec93200c7a6e https://gitlab.freedesktop.org/drm/igt-gpu-tools/commit/443cc658e1e6b492ee17bf4f4d891029eb7a205d Thanks in advance! [CONTRIBUTING.md]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/blob/master/CONTRIBUTING.md#L19 [Documentation]: https://drm.pages.freedesktop.org/igt-gpu-tools/igt-gpu-tools-Core.html#igt-describe Other than that, pipeline status: SUCCESS. see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/69573 for more details == Logs == For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/69573 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] i915_drm.h sync 2019-10-10 7:32 [igt-dev] [PATCH i-g-t 1/2] i915_drm.h sync Chris Wilson 2019-10-10 7:32 ` [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence Chris Wilson 2019-10-10 7:59 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] i915_drm.h sync Patchwork @ 2019-10-10 8:23 ` Patchwork 2019-10-10 15:30 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork 3 siblings, 0 replies; 7+ messages in thread From: Patchwork @ 2019-10-10 8:23 UTC (permalink / raw) To: Chris Wilson; +Cc: igt-dev == Series Details == Series: series starting with [i-g-t,1/2] i915_drm.h sync URL : https://patchwork.freedesktop.org/series/67829/ State : success == Summary == CI Bug Log - changes from CI_DRM_7047 -> IGTPW_3556 ==================================================== Summary ------- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/index.html Known issues ------------ Here are the changes found in IGTPW_3556 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@gem_flink_basic@bad-flink: - fi-icl-u3: [PASS][1] -> [DMESG-WARN][2] ([fdo#107724]) [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/fi-icl-u3/igt@gem_flink_basic@bad-flink.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/fi-icl-u3/igt@gem_flink_basic@bad-flink.html * igt@i915_module_load@reload: - fi-blb-e6850: [PASS][3] -> [INCOMPLETE][4] ([fdo#107718]) [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/fi-blb-e6850/igt@i915_module_load@reload.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/fi-blb-e6850/igt@i915_module_load@reload.html * igt@kms_chamelium@hdmi-hpd-fast: - fi-kbl-7500u: [PASS][5] -> [FAIL][6] ([fdo#111045] / [fdo#111096]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html #### Possible fixes #### * igt@gem_flink_basic@basic: - fi-icl-u3: [DMESG-WARN][7] ([fdo#107724]) -> [PASS][8] [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/fi-icl-u3/igt@gem_flink_basic@basic.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/fi-icl-u3/igt@gem_flink_basic@basic.html * igt@gem_sync@basic-many-each: - {fi-tgl-u}: [INCOMPLETE][9] ([fdo#111880]) -> [PASS][10] [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/fi-tgl-u/igt@gem_sync@basic-many-each.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/fi-tgl-u/igt@gem_sync@basic-many-each.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718 [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724 [fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045 [fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096 [fdo#111831]: https://bugs.freedesktop.org/show_bug.cgi?id=111831 [fdo#111880]: https://bugs.freedesktop.org/show_bug.cgi?id=111880 Participating hosts (51 -> 47) ------------------------------ Additional (3): fi-byt-j1900 fi-bsw-n3050 fi-pnv-d510 Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus Build changes ------------- * CI: CI-20190529 -> None * IGT: IGT_5220 -> IGTPW_3556 CI-20190529: 20190529 CI_DRM_7047: 23ba5b1f97d3d114d30eead1ca95d5a846a9027c @ git://anongit.freedesktop.org/gfx-ci/linux IGTPW_3556: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/index.html IGT_5220: 1e38e32d721210a780198c8293a6b8c8e881df68 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools == Testlist changes == +igt@gem_ctx_persistence@cleanup +igt@gem_ctx_persistence@file +igt@gem_ctx_persistence@hangcheck +igt@gem_ctx_persistence@hostile +igt@gem_ctx_persistence@idempotent +igt@gem_ctx_persistence@mixed +igt@gem_ctx_persistence@persistence +igt@gem_ctx_persistence@process == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/index.html _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/2] i915_drm.h sync 2019-10-10 7:32 [igt-dev] [PATCH i-g-t 1/2] i915_drm.h sync Chris Wilson ` (2 preceding siblings ...) 2019-10-10 8:23 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork @ 2019-10-10 15:30 ` Patchwork 3 siblings, 0 replies; 7+ messages in thread From: Patchwork @ 2019-10-10 15:30 UTC (permalink / raw) To: Chris Wilson; +Cc: igt-dev == Series Details == Series: series starting with [i-g-t,1/2] i915_drm.h sync URL : https://patchwork.freedesktop.org/series/67829/ State : success == Summary == CI Bug Log - changes from CI_DRM_7047_full -> IGTPW_3556_full ==================================================== Summary ------- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/index.html Possible new issues ------------------- Here are the unknown changes that may have been introduced in IGTPW_3556_full: ### IGT changes ### #### Possible regressions #### * {igt@gem_ctx_persistence@file} (NEW): - {shard-tglb}: NOTRUN -> [SKIP][1] +1 similar issue [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-tglb1/igt@gem_ctx_persistence@file.html * {igt@gem_ctx_persistence@hangcheck} (NEW): - shard-iclb: NOTRUN -> [SKIP][2] +6 similar issues [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb6/igt@gem_ctx_persistence@hangcheck.html #### Suppressed #### The following results come from untrusted machines, tests, or statuses. They do not affect the overall result. * igt@gem_ctx_switch@legacy-vebox: - {shard-tglb}: NOTRUN -> [INCOMPLETE][3] [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-tglb1/igt@gem_ctx_switch@legacy-vebox.html New tests --------- New tests have been introduced between CI_DRM_7047_full and IGTPW_3556_full: ### New IGT tests (8) ### * igt@gem_ctx_persistence@cleanup: - Statuses : 5 skip(s) - Exec time: [0.0] s * igt@gem_ctx_persistence@file: - Statuses : 7 skip(s) - Exec time: [0.0] s * igt@gem_ctx_persistence@hangcheck: - Statuses : 6 skip(s) - Exec time: [0.0] s * igt@gem_ctx_persistence@hostile: - Statuses : 7 skip(s) - Exec time: [0.0] s * igt@gem_ctx_persistence@idempotent: - Statuses : 6 skip(s) - Exec time: [0.0] s * igt@gem_ctx_persistence@mixed: - Statuses : 6 skip(s) - Exec time: [0.0] s * igt@gem_ctx_persistence@persistence: - Statuses : 6 skip(s) - Exec time: [0.0] s * igt@gem_ctx_persistence@process: - Statuses : 6 skip(s) - Exec time: [0.0] s Known issues ------------ Here are the changes found in IGTPW_3556_full that come from known issues: ### IGT changes ### #### Issues hit #### * igt@gem_exec_schedule@independent-bsd2: - shard-iclb: [PASS][4] -> [SKIP][5] ([fdo#109276]) +14 similar issues [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb4/igt@gem_exec_schedule@independent-bsd2.html [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb5/igt@gem_exec_schedule@independent-bsd2.html * igt@gem_exec_schedule@preemptive-hang-bsd: - shard-iclb: [PASS][6] -> [SKIP][7] ([fdo#111325]) +6 similar issues [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb7/igt@gem_exec_schedule@preemptive-hang-bsd.html [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb2/igt@gem_exec_schedule@preemptive-hang-bsd.html * igt@gem_userptr_blits@sync-unmap: - shard-hsw: [PASS][8] -> [DMESG-WARN][9] ([fdo#111870]) [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-hsw5/igt@gem_userptr_blits@sync-unmap.html [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-hsw6/igt@gem_userptr_blits@sync-unmap.html * igt@gem_userptr_blits@sync-unmap-cycles: - shard-snb: [PASS][10] -> [DMESG-WARN][11] ([fdo#111870]) +1 similar issue [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-snb7/igt@gem_userptr_blits@sync-unmap-cycles.html [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-snb7/igt@gem_userptr_blits@sync-unmap-cycles.html * igt@i915_selftest@live_hangcheck: - shard-iclb: [PASS][12] -> [DMESG-FAIL][13] ([fdo#111144] / [fdo#111678]) [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb2/igt@i915_selftest@live_hangcheck.html [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb8/igt@i915_selftest@live_hangcheck.html * igt@i915_suspend@sysfs-reader: - shard-apl: [PASS][14] -> [DMESG-WARN][15] ([fdo#108566]) +4 similar issues [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl8/igt@i915_suspend@sysfs-reader.html [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl6/igt@i915_suspend@sysfs-reader.html * igt@kms_cursor_crc@pipe-c-cursor-128x128-offscreen: - shard-apl: [PASS][16] -> [INCOMPLETE][17] ([fdo#103927]) [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl1/igt@kms_cursor_crc@pipe-c-cursor-128x128-offscreen.html [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl8/igt@kms_cursor_crc@pipe-c-cursor-128x128-offscreen.html * igt@kms_cursor_crc@pipe-c-cursor-256x256-sliding: - shard-apl: [PASS][18] -> [FAIL][19] ([fdo#103232]) [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl4/igt@kms_cursor_crc@pipe-c-cursor-256x256-sliding.html [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl7/igt@kms_cursor_crc@pipe-c-cursor-256x256-sliding.html - shard-kbl: [PASS][20] -> [FAIL][21] ([fdo#103232]) [20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-kbl3/igt@kms_cursor_crc@pipe-c-cursor-256x256-sliding.html [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-kbl4/igt@kms_cursor_crc@pipe-c-cursor-256x256-sliding.html * igt@kms_frontbuffer_tracking@basic: - shard-iclb: [PASS][22] -> [FAIL][23] ([fdo#103167]) +5 similar issues [22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb5/igt@kms_frontbuffer_tracking@basic.html [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb4/igt@kms_frontbuffer_tracking@basic.html * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-pwrite: - shard-glk: [PASS][24] -> [FAIL][25] ([fdo#103167]) [24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-glk2/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-pwrite.html [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-glk7/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-pwrite.html * igt@kms_psr@psr2_sprite_mmap_gtt: - shard-iclb: [PASS][26] -> [SKIP][27] ([fdo#109441]) +1 similar issue [26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_gtt.html [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb1/igt@kms_psr@psr2_sprite_mmap_gtt.html * igt@kms_setmode@basic: - shard-hsw: [PASS][28] -> [FAIL][29] ([fdo#99912]) [28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-hsw1/igt@kms_setmode@basic.html [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-hsw4/igt@kms_setmode@basic.html #### Possible fixes #### * igt@gem_ctx_shared@exec-single-timeline-bsd: - shard-iclb: [SKIP][30] ([fdo#110841]) -> [PASS][31] [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb2/igt@gem_ctx_shared@exec-single-timeline-bsd.html [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb6/igt@gem_ctx_shared@exec-single-timeline-bsd.html * igt@gem_eio@reset-stress: - shard-snb: [FAIL][32] ([fdo#109661]) -> [PASS][33] [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-snb1/igt@gem_eio@reset-stress.html [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-snb2/igt@gem_eio@reset-stress.html * igt@gem_exec_balancer@smoke: - shard-iclb: [SKIP][34] ([fdo#110854]) -> [PASS][35] [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb6/igt@gem_exec_balancer@smoke.html [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb4/igt@gem_exec_balancer@smoke.html * igt@gem_exec_schedule@preempt-other-chain-bsd: - shard-iclb: [SKIP][36] ([fdo#111325]) -> [PASS][37] +4 similar issues [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb2/igt@gem_exec_schedule@preempt-other-chain-bsd.html [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb8/igt@gem_exec_schedule@preempt-other-chain-bsd.html * igt@gem_exec_schedule@preempt-queue-bsd2: - shard-iclb: [SKIP][38] ([fdo#109276]) -> [PASS][39] +20 similar issues [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb3/igt@gem_exec_schedule@preempt-queue-bsd2.html [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb2/igt@gem_exec_schedule@preempt-queue-bsd2.html * igt@gem_tiled_swapping@non-threaded: - shard-glk: [INCOMPLETE][40] ([fdo#103359] / [fdo#108686] / [k.org#198133]) -> [PASS][41] [40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-glk1/igt@gem_tiled_swapping@non-threaded.html [41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-glk1/igt@gem_tiled_swapping@non-threaded.html - shard-snb: [INCOMPLETE][42] ([fdo#105411] / [fdo#108686]) -> [PASS][43] [42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-snb7/igt@gem_tiled_swapping@non-threaded.html [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-snb4/igt@gem_tiled_swapping@non-threaded.html * igt@gem_userptr_blits@map-fixed-invalidate-busy: - shard-snb: [DMESG-WARN][44] ([fdo#111870]) -> [PASS][45] +1 similar issue [44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-snb7/igt@gem_userptr_blits@map-fixed-invalidate-busy.html [45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-snb2/igt@gem_userptr_blits@map-fixed-invalidate-busy.html * igt@gem_userptr_blits@sync-unmap-after-close: - shard-hsw: [DMESG-WARN][46] ([fdo#111870]) -> [PASS][47] +4 similar issues [46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-hsw4/igt@gem_userptr_blits@sync-unmap-after-close.html [47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-hsw5/igt@gem_userptr_blits@sync-unmap-after-close.html * igt@i915_suspend@fence-restore-tiled2untiled: - shard-apl: [DMESG-WARN][48] ([fdo#108566]) -> [PASS][49] +3 similar issues [48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl4/igt@i915_suspend@fence-restore-tiled2untiled.html [49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl7/igt@i915_suspend@fence-restore-tiled2untiled.html * igt@kms_busy@extended-pageflip-hang-newfb-render-a: - shard-apl: [DMESG-WARN][50] ([fdo#103558] / [fdo#105602] / [fdo#110222]) -> [PASS][51] [50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl3/igt@kms_busy@extended-pageflip-hang-newfb-render-a.html [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl7/igt@kms_busy@extended-pageflip-hang-newfb-render-a.html * igt@kms_color@pipe-c-degamma: - shard-apl: [FAIL][52] ([fdo#104782]) -> [PASS][53] [52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl3/igt@kms_color@pipe-c-degamma.html [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl6/igt@kms_color@pipe-c-degamma.html - shard-glk: [FAIL][54] ([fdo#104782]) -> [PASS][55] [54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-glk2/igt@kms_color@pipe-c-degamma.html [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-glk4/igt@kms_color@pipe-c-degamma.html - shard-kbl: [FAIL][56] ([fdo#104782]) -> [PASS][57] [56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-kbl2/igt@kms_color@pipe-c-degamma.html [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-kbl7/igt@kms_color@pipe-c-degamma.html * igt@kms_concurrent@pipe-b: - shard-apl: [DMESG-WARN][58] ([fdo#103558] / [fdo#105602]) -> [PASS][59] +18 similar issues [58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl3/igt@kms_concurrent@pipe-b.html [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl1/igt@kms_concurrent@pipe-b.html * igt@kms_cursor_crc@pipe-c-cursor-dpms: - shard-kbl: [FAIL][60] ([fdo#103232]) -> [PASS][61] [60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-kbl2/igt@kms_cursor_crc@pipe-c-cursor-dpms.html [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-kbl1/igt@kms_cursor_crc@pipe-c-cursor-dpms.html * igt@kms_flip@absolute-wf_vblank: - shard-apl: [INCOMPLETE][62] ([fdo#103927]) -> [PASS][63] [62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl1/igt@kms_flip@absolute-wf_vblank.html [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl6/igt@kms_flip@absolute-wf_vblank.html * igt@kms_frontbuffer_tracking@fbc-1p-indfb-fliptrack: - {shard-tglb}: [FAIL][64] ([fdo#103167]) -> [PASS][65] [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-tglb3/igt@kms_frontbuffer_tracking@fbc-1p-indfb-fliptrack.html [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-tglb4/igt@kms_frontbuffer_tracking@fbc-1p-indfb-fliptrack.html * igt@kms_frontbuffer_tracking@fbc-1p-pri-indfb-multidraw: - shard-iclb: [FAIL][66] ([fdo#103167]) -> [PASS][67] +4 similar issues [66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb2/igt@kms_frontbuffer_tracking@fbc-1p-pri-indfb-multidraw.html [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb4/igt@kms_frontbuffer_tracking@fbc-1p-pri-indfb-multidraw.html * igt@kms_psr@psr2_cursor_mmap_cpu: - shard-iclb: [SKIP][68] ([fdo#109441]) -> [PASS][69] +2 similar issues [68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb8/igt@kms_psr@psr2_cursor_mmap_cpu.html [69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb2/igt@kms_psr@psr2_cursor_mmap_cpu.html * igt@kms_universal_plane@universal-plane-pipe-b-functional: - shard-glk: [FAIL][70] ([fdo#111134]) -> [PASS][71] [70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-glk7/igt@kms_universal_plane@universal-plane-pipe-b-functional.html [71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-glk9/igt@kms_universal_plane@universal-plane-pipe-b-functional.html - shard-apl: [FAIL][72] ([fdo#111134]) -> [PASS][73] [72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl3/igt@kms_universal_plane@universal-plane-pipe-b-functional.html [73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl3/igt@kms_universal_plane@universal-plane-pipe-b-functional.html - shard-kbl: [FAIL][74] ([fdo#111134]) -> [PASS][75] [74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-kbl2/igt@kms_universal_plane@universal-plane-pipe-b-functional.html [75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-kbl6/igt@kms_universal_plane@universal-plane-pipe-b-functional.html * igt@kms_vblank@pipe-c-wait-idle: - shard-hsw: [INCOMPLETE][76] ([fdo#103540]) -> [PASS][77] [76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-hsw2/igt@kms_vblank@pipe-c-wait-idle.html [77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-hsw1/igt@kms_vblank@pipe-c-wait-idle.html * igt@prime_busy@wait-hang-bsd: - {shard-tglb}: [INCOMPLETE][78] -> [PASS][79] [78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-tglb2/igt@prime_busy@wait-hang-bsd.html [79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-tglb2/igt@prime_busy@wait-hang-bsd.html #### Warnings #### * igt@gem_mocs_settings@mocs-reset-bsd2: - shard-iclb: [FAIL][80] ([fdo#111330]) -> [SKIP][81] ([fdo#109276]) +1 similar issue [80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-iclb4/igt@gem_mocs_settings@mocs-reset-bsd2.html [81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-iclb8/igt@gem_mocs_settings@mocs-reset-bsd2.html * igt@kms_content_protection@atomic: - shard-apl: [DMESG-FAIL][82] ([fdo#103558] / [fdo#105602] / [fdo#110321]) -> [FAIL][83] ([fdo#110321] / [fdo#110336]) [82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl3/igt@kms_content_protection@atomic.html [83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl1/igt@kms_content_protection@atomic.html * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-draw-mmap-wc: - shard-apl: [SKIP][84] ([fdo#105602] / [fdo#109271]) -> [SKIP][85] ([fdo#109271]) +19 similar issues [84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl3/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-draw-mmap-wc.html [85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl6/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-draw-mmap-wc.html * igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb: - shard-apl: [DMESG-FAIL][86] ([fdo#103558] / [fdo#105602] / [fdo#108145]) -> [FAIL][87] ([fdo#108145]) [86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7047/shard-apl3/igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb.html [87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/shard-apl3/igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167 [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232 [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359 [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540 [fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558 [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927 [fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782 [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411 [fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602 [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145 [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566 [fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686 [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271 [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276 [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441 [fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661 [fdo#110222]: https://bugs.freedesktop.org/show_bug.cgi?id=110222 [fdo#110321]: https://bugs.freedesktop.org/show_bug.cgi?id=110321 [fdo#110336]: https://bugs.freedesktop.org/show_bug.cgi?id=110336 [fdo#110841]: https://bugs.freedesktop.org/show_bug.cgi?id=110841 [fdo#110854]: https://bugs.freedesktop.org/show_bug.cgi?id=110854 [fdo#111134]: https://bugs.freedesktop.org/show_bug.cgi?id=111134 [fdo#111144]: https://bugs.freedesktop.org/show_bug.cgi?id=111144 [fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325 [fdo#111329]: https://bugs.freedesktop.org/show_bug.cgi?id=111329 [fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330 [fdo#111678]: https://bugs.freedesktop.org/show_bug.cgi?id=111678 [fdo#111736]: https://bugs.freedesktop.org/show_bug.cgi?id=111736 [fdo#111781]: https://bugs.freedesktop.org/show_bug.cgi?id=111781 [fdo#111870]: https://bugs.freedesktop.org/show_bug.cgi?id=111870 [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912 [k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133 Participating hosts (11 -> 7) ------------------------------ Missing (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005 Build changes ------------- * CI: CI-20190529 -> None * IGT: IGT_5220 -> IGTPW_3556 * Piglit: piglit_4509 -> None CI-20190529: 20190529 CI_DRM_7047: 23ba5b1f97d3d114d30eead1ca95d5a846a9027c @ git://anongit.freedesktop.org/gfx- == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3556/index.html _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* [igt-dev] [PATCH i-g-t 1/2] i915_drm.h sync
@ 2019-09-25 13:45 Chris Wilson
2019-09-25 13:45 ` [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence Chris Wilson
0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2019-09-25 13:45 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev, andi
Update to commit fef476f3ab47527a00818ddaf4b46b8c09361111 (not upstream!)
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Mon Aug 5 22:55:44 2019 +0100
drm/i915: Cancel non-persistent contexts on close
for I915_CONTEXT_PARAM_PERSISTENCE
---
include/drm-uapi/i915_drm.h | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h
index 761517f15..7badfa0b1 100644
--- a/include/drm-uapi/i915_drm.h
+++ b/include/drm-uapi/i915_drm.h
@@ -521,6 +521,7 @@ typedef struct drm_i915_irq_wait {
#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)
#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)
#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)
+#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4)
#define I915_PARAM_HUC_STATUS 42
@@ -1564,6 +1565,21 @@ struct drm_i915_gem_context_param {
* i915_context_engines_bond (I915_CONTEXT_ENGINES_EXT_BOND)
*/
#define I915_CONTEXT_PARAM_ENGINES 0xa
+
+/*
+ * I915_CONTEXT_PARAM_PERSISTENCE:
+ *
+ * Allow the context and active rendering to survive the process until
+ * completion. Persistence allows fire-and-forget clients to queue up a
+ * bunch of work, hand the output over to a display server and the quit.
+ * If the context is not marked as persistent, upon closing (either via
+ * an explicit DRM_I915_GEM_CONTEXT_DESTROY or implicitly from file closure
+ * or process termination), the context and any outstanding requests will be
+ * cancelled (and exported fences for cancelled requests marked as -EIO).
+ *
+ * By default, new contexts allow persistence.
+ */
+#define I915_CONTEXT_PARAM_PERSISTENCE 0xb
/* Must be kept compact -- no holes and well documented */
__u64 value;
@@ -2032,8 +2048,10 @@ struct drm_i915_query {
* (data[X / 8] >> (X % 8)) & 1
*
* - the subslice mask for each slice with one bit per subslice telling
- * whether a subslice is available. The availability of subslice Y in slice
- * X can be queried with the following formula :
+ * whether a subslice is available. Gen12 has dual-subslices, which are
+ * similar to two gen11 subslices. For gen12, this array represents dual-
+ * subslices. The availability of subslice Y in slice X can be queried
+ * with the following formula :
*
* (data[subslice_offset +
* X * subslice_stride +
--
2.23.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 7+ messages in thread* [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence 2019-09-25 13:45 [igt-dev] [PATCH i-g-t 1/2] " Chris Wilson @ 2019-09-25 13:45 ` Chris Wilson 0 siblings, 0 replies; 7+ messages in thread From: Chris Wilson @ 2019-09-25 13:45 UTC (permalink / raw) To: intel-gfx; +Cc: igt-dev, Jon Bloomfield, andi Sanity test existing persistence and new exciting non-persistent context behaviour. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Michał Winiarski <michal.winiarski@intel.com> Cc: Jon Bloomfield <jon.bloomfield@intel.com> --- lib/i915/gem_context.c | 37 ++++ lib/i915/gem_context.h | 8 + lib/igt_dummyload.c | 3 +- lib/ioctl_wrappers.c | 1 + tests/Makefile.sources | 3 + tests/i915/gem_ctx_persistence.c | 353 +++++++++++++++++++++++++++++++ tests/meson.build | 1 + 7 files changed, 405 insertions(+), 1 deletion(-) create mode 100644 tests/i915/gem_ctx_persistence.c diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c index 83c5df961..1fae5191f 100644 --- a/lib/i915/gem_context.c +++ b/lib/i915/gem_context.c @@ -272,6 +272,43 @@ void gem_context_set_priority(int fd, uint32_t ctx_id, int prio) igt_assert_eq(__gem_context_set_priority(fd, ctx_id, prio), 0); } +/** + * __gem_context_set_persistence: + * @i915: open i915 drm file descriptor + * @ctx: i915 context id + * @state: desired persistence + * + * Declare whether this context is allowed to persist after closing until + * its requests are complete (persistent=true) or if it should be + * immediately reaped on closing and its requests cancelled + * (persistent=false). + * + * Returns: An integer equal to zero for success and negative for failure + */ +int __gem_context_set_persistence(int i915, uint32_t ctx, bool state) +{ + struct drm_i915_gem_context_param p = { + .ctx_id = ctx, + .param = I915_CONTEXT_PARAM_PERSISTENCE, + .value = state, + }; + + return __gem_context_set_param(i915, &p); +} + +/** + * __gem_context_set_persistence: + * @i915: open i915 drm file descriptor + * @ctx: i915 context id + * @state: desired persistence + * + * Like __gem_context_set_persistence(), except we assert on failure. + */ +void gem_context_set_persistence(int i915, uint32_t ctx, bool state) +{ + igt_assert_eq(__gem_context_set_persistence(i915, ctx, state), 0); +} + int __gem_context_clone(int i915, uint32_t src, unsigned int share, diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h index 8043c3401..c0d4c9615 100644 --- a/lib/i915/gem_context.h +++ b/lib/i915/gem_context.h @@ -24,6 +24,11 @@ #ifndef GEM_CONTEXT_H #define GEM_CONTEXT_H +#include <stdbool.h> +#include <stdint.h> + +struct drm_i915_gem_context_param; + uint32_t gem_context_create(int fd); int __gem_context_create(int fd, uint32_t *ctx_id); void gem_context_destroy(int fd, uint32_t ctx_id); @@ -58,6 +63,9 @@ int __gem_context_get_param(int fd, struct drm_i915_gem_context_param *p); int __gem_context_set_priority(int fd, uint32_t ctx, int prio); void gem_context_set_priority(int fd, uint32_t ctx, int prio); +int __gem_context_set_persistence(int i915, uint32_t ctx, bool state); +void gem_context_set_persistence(int i915, uint32_t ctx, bool state); + bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine); #endif /* GEM_CONTEXT_H */ diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c index 65b5cc927..6060878dd 100644 --- a/lib/igt_dummyload.c +++ b/lib/igt_dummyload.c @@ -450,7 +450,8 @@ void igt_spin_free(int fd, igt_spin_t *spin) gem_close(fd, spin->poll_handle); } - gem_close(fd, spin->handle); + if (spin->handle) + gem_close(fd, spin->handle); if (spin->out_fence >= 0) close(spin->out_fence); diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 280fdd624..628f8b830 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -445,6 +445,7 @@ int gem_wait(int fd, uint32_t handle, int64_t *timeout_ns) ret = 0; if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait)) ret = -errno; + errno = 0; if (timeout_ns) *timeout_ns = wait.timeout_ns; diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 343be0500..093eb57f3 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -154,6 +154,9 @@ gem_ctx_isolation_SOURCES = i915/gem_ctx_isolation.c TESTS_progs += gem_ctx_param gem_ctx_param_SOURCES = i915/gem_ctx_param.c +TESTS_progs += gem_ctx_persistence +gem_ctx_persistence_SOURCES = i915/gem_ctx_persistence.c + TESTS_progs += gem_ctx_shared gem_ctx_shared_SOURCES = i915/gem_ctx_shared.c diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c new file mode 100644 index 000000000..d6ef6b900 --- /dev/null +++ b/tests/i915/gem_ctx_persistence.c @@ -0,0 +1,353 @@ +/* + * Copyright © 2019 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include <errno.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <unistd.h> + +#include "drmtest.h" /* gem_quiescent_gpu()! */ +#include "i915/gem_context.h" +#include "i915/gem_submission.h" +#include "igt_debugfs.h" +#include "igt_dummyload.h" +#include "ioctl_wrappers.h" /* gem_wait()! */ +#include "sw_sync.h" + +static bool has_persistence(int i915) +{ + struct drm_i915_gem_context_param p = { + .param = I915_CONTEXT_PARAM_PERSISTENCE, + }; + uint64_t saved; + + if (__gem_context_get_param(i915, &p)) + return false; + + saved = p.value; + p.value = 0; + if (__gem_context_set_param(i915, &p)) + return false; + + p.value = saved; + return __gem_context_set_param(i915, &p) == 0; +} + +static void test_idempotent(int i915) +{ + struct drm_i915_gem_context_param p = { + .param = I915_CONTEXT_PARAM_PERSISTENCE, + }; + int expected; + + /* + * Simple test to verify that we are able to read back the same boolean + * value as we set. + * + * Each time we invert the current value so that at the end of the test, + * if successful, we leave the context in the original state. + */ + + gem_context_get_param(i915, &p); + expected = !!p.value; + + expected = !expected; + p.value = expected; + gem_context_set_param(i915, &p); + gem_context_get_param(i915, &p); + igt_assert_eq(p.value, expected); + + expected = !expected; /* and restores */ + p.value = expected; + gem_context_set_param(i915, &p); + gem_context_get_param(i915, &p); + igt_assert_eq(p.value, expected); +} + +static void test_persistence(int i915) +{ + igt_spin_t *spin; + int64_t timeout; + uint32_t ctx; + + /* + * Default behaviour are contexts remain alive until their last active + * request is retired -- no early termination. + */ + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, true); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_FENCE_OUT); + gem_context_destroy(i915, ctx); + + timeout = NSEC_PER_SEC / 5; + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), -ETIME); + + igt_spin_end(spin); + + timeout = NSEC_PER_SEC / 5; + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0); + igt_assert_eq(sync_fence_status(spin->out_fence), 1); + + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); +} + +static void test_nonpersistent_cleanup(int i915) +{ + int64_t timeout = NSEC_PER_SEC / 5; + igt_spin_t *spin; + uint32_t ctx; + + /* + * A nonpersistent context is terminated immediately upon closure, + * any inflight request is cancelled. + */ + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, false); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_FENCE_OUT); + gem_context_destroy(i915, ctx); + + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0); + igt_assert_eq(sync_fence_status(spin->out_fence), -EIO); + + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); +} + +static void test_nonpersistent_mixed(int i915) +{ + int fence[3]; + + /* + * Only a nonpersistent context is terminated immediately upon + * closure, any inflight request is cancelled. If there is also + * an active persistent context closed, it should be unafffected. + */ + + for (int i = 0; i < ARRAY_SIZE(fence); i++) { + igt_spin_t *spin; + uint32_t ctx; + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, i & 1); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_FENCE_OUT); + gem_context_destroy(i915, ctx); + + fence[i] = spin->out_fence; + } + + /* Outer pair of contexts were non-persistent and killed */ + igt_assert_eq(sync_fence_wait(fence[0], MSEC_PER_SEC / 5), 0); + igt_assert_eq(sync_fence_status(fence[0]), -EIO); + + igt_assert_eq(sync_fence_wait(fence[2], MSEC_PER_SEC / 5), 0); + igt_assert_eq(sync_fence_status(fence[2]), -EIO); + + /* But the middle context is still running */ + igt_assert_eq(sync_fence_wait(fence[1], 0), -ETIME); + + gem_quiescent_gpu(i915); +} + +static void test_nonpersistent_hostile(int i915) +{ + int64_t timeout = NSEC_PER_SEC / 2; + igt_spin_t *spin; + uint32_t ctx; + + /* + * If we cannot cleanly cancel the persistent context on closure, + * e.g. preemption fails, we are forced to reset the GPU to terminate + * the requests and cleanup the context. + */ + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, false); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_NO_PREEMPTION); + gem_context_destroy(i915, ctx); + + igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0); + + igt_spin_free(i915, spin); + gem_quiescent_gpu(i915); +} + +static void test_nonpersistent_file(int i915) +{ + igt_spin_t *spin; + uint32_t ctx; + + /* + * A context may live beyond its initial struct file, except if it + * has been made nonpersistent, in which case it must be terminated. + */ + + i915 = gem_reopen_driver(i915); + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, false); + + spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_FENCE_OUT); + close(i915); + + igt_assert_eq(sync_fence_wait(spin->out_fence, MSEC_PER_SEC / 5), 0); + igt_assert_eq(sync_fence_status(spin->out_fence), -EIO); + + spin->handle = 0; + igt_spin_free(-1, spin); +} + +static void sendfd(int socket, int fd) +{ + char buf[CMSG_SPACE(sizeof(fd))]; + struct iovec io = { .iov_base = (char *)"ABC", .iov_len = 3 }; + struct msghdr msg = { + .msg_iov = &io, + .msg_iovlen = 1, + .msg_control = buf, + .msg_controllen = CMSG_LEN(sizeof(fd)), + }; + struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); + + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = msg.msg_controllen; + *(int *)CMSG_DATA(cmsg) = fd; + + igt_assert(sendmsg(socket, &msg, 0) != -1); +} + +static int recvfd(int socket) +{ + char m_buffer[256], c_buffer[256]; + struct iovec io = { + .iov_base = m_buffer, + .iov_len = sizeof(m_buffer), + }; + struct msghdr msg = { + .msg_iov = &io, + .msg_iovlen = 1, + .msg_control = c_buffer, + .msg_controllen = sizeof(c_buffer), + }; + + igt_assert(recvmsg(socket, &msg, 0) != -1); + return *(int *)CMSG_DATA(CMSG_FIRSTHDR(&msg)); +} + +static void test_nonpersistent_process(int i915) +{ + int fence[2], sv[2]; + + /* + * If a process dies early, any nonpersistent contexts it had + * open must be terminated too. But any persistent contexts, + * should survive until their requests are complete. + */ + + igt_require(socketpair(AF_UNIX, SOCK_DGRAM, 0, sv) == 0); + + igt_fork(child, 1) { + i915 = gem_reopen_driver(i915); + + for (int persists = 0; persists <= 1; persists++) { + igt_spin_t *spin; + uint32_t ctx; + + ctx = gem_context_create(i915); + gem_context_set_persistence(i915, ctx, persists); + + spin = igt_spin_new(i915, ctx, + .flags = IGT_SPIN_FENCE_OUT); + + sendfd(sv[0], spin->out_fence); + + igt_list_del(&spin->link); /* prevent autocleanup */ + } + } + close(sv[0]); + igt_waitchildren(); + + fence[0] = recvfd(sv[1]); + fence[1] = recvfd(sv[1]); + close(sv[1]); + + /* First fence is non-persistent, so should be reset */ + igt_assert_eq(sync_fence_wait(fence[0], MSEC_PER_SEC / 5), 0); + igt_assert_eq(sync_fence_status(fence[0]), -EIO); + close(fence[0]); + + /* Second fence is persistent, so should be still spinning */ + igt_assert_eq(sync_fence_wait(fence[1], 0), -ETIME); + close(fence[1]); + + /* We have to manually clean up the orphaned spinner */ + igt_drop_caches_set(i915, DROP_RESET_ACTIVE); + + gem_quiescent_gpu(i915); +} + +igt_main +{ + int i915; + + igt_fixture { + i915 = drm_open_driver(DRIVER_INTEL); + igt_require_gem(i915); + + igt_require(has_persistence(i915)); + } + + igt_subtest_group { + igt_subtest("idempotent") + test_idempotent(i915); + + igt_subtest("persistence") + test_persistence(i915); + + igt_subtest("cleanup") + test_nonpersistent_cleanup(i915); + + igt_subtest("mixed") + test_nonpersistent_mixed(i915); + + igt_subtest("hostile") + test_nonpersistent_hostile(i915); + + igt_subtest("file") + test_nonpersistent_file(i915); + + igt_subtest("process") + test_nonpersistent_process(i915); + } + + igt_fixture { + close(i915); + } +} diff --git a/tests/meson.build b/tests/meson.build index 7e3f9e0a4..3f3eee277 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -121,6 +121,7 @@ i915_progs = [ 'gem_ctx_exec', 'gem_ctx_isolation', 'gem_ctx_param', + 'gem_ctx_persistence', 'gem_ctx_shared', 'gem_ctx_switch', 'gem_ctx_thrash', -- 2.23.0 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-10-15 13:05 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-10-10 7:32 [igt-dev] [PATCH i-g-t 1/2] i915_drm.h sync Chris Wilson 2019-10-10 7:32 ` [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence Chris Wilson 2019-10-15 13:05 ` Andi Shyti 2019-10-10 7:59 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] i915_drm.h sync Patchwork 2019-10-10 8:23 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork 2019-10-10 15:30 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork -- strict thread matches above, loose matches on Subject: below -- 2019-09-25 13:45 [igt-dev] [PATCH i-g-t 1/2] " Chris Wilson 2019-09-25 13:45 ` [igt-dev] [PATCH i-g-t 2/2] Add i915/gem_ctx_persistence Chris Wilson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox