Skip to contentSkip to conversation

i915: Exercise preemption timeout controls in sysfs

PATCH New Chris Wilson 2 participants 4 messages Oct 19, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 i915: Exercise preemption timeout controls in sysfs

We [will] expose various per-engine scheduling controls. One of which, 'preempt_timeout_ms', defines how we wait for a preemption request to be honoured by the currently executing context. If it fails to relieve the GPU within the required timeout, the engine is reset and the miscreant forcibly evicted.

---
 lib/i915/gem_context.c                |  41 ++++
 lib/i915/gem_context.h                |   2 +
 tests/Makefile.sources                |   1 +
 tests/i915/sysfs_preemption_timeout.c | 336 ++++++++++++++++++++++++++
 tests/meson.build                     |   1 +
 5 files changed, 381 insertions(+)
 create mode 100644 tests/i915/sysfs_preemption_timeout.c
lib/i915/gem_context.c +41 -0
index 1fae5191f..aa083c2f0 100644
@@ -403,3 +403,44 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
 
 	return __gem_execbuf(fd, &execbuf) == -ENOENT;
 }
+
+static int create_ext_ioctl(int i915,
+			    struct drm_i915_gem_context_create_ext *arg)
+{
+	int err;
+
+	err = 0;
+	if (igt_ioctl(i915, DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT, arg)) {
+		err = -errno;
+		igt_assume(err);
+	}
+
+	errno = 0;
+	return err;
+}
+
+uint32_t gem_context_create_for_engine(int i915, unsigned int class, unsigned int inst)
+{
+	I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1) = {
+		.engines = { { .engine_class = class, .engine_instance = inst } }
+	};
+	struct drm_i915_gem_context_create_ext_setparam p_engines = {
+		.base = {
+			.name = I915_CONTEXT_CREATE_EXT_SETPARAM,
+			.next_extension = 0, /* end of chain */
+		},
+		.param = {
+			.param = I915_CONTEXT_PARAM_ENGINES,
+			.value = to_user_pointer(&engines),
+			.size = sizeof(engines),
+		},
+	};
+	struct drm_i915_gem_context_create_ext create = {
+		.flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS,
+		.extensions = to_user_pointer(&p_engines),
+	};
+
+	igt_assert_eq(create_ext_ioctl(i915, &create), 0);
+	igt_assert_neq(create.ctx_id, 0);
+	return create.ctx_id;
+}
lib/i915/gem_context.h +2 -0
index c0d4c9615..9e0a083f0 100644
@@ -34,6 +34,8 @@ int __gem_context_create(int fd, uint32_t *ctx_id);
 void gem_context_destroy(int fd, uint32_t ctx_id);
 int __gem_context_destroy(int fd, uint32_t ctx_id);
 
+uint32_t gem_context_create_for_engine(int fd, unsigned int class, unsigned int inst);
+
 int __gem_context_clone(int i915,
 			uint32_t src, unsigned int share,
 			unsigned int flags,
tests/Makefile.sources +1 -0
index 093eb57f3..dff7dac06 100644
@@ -98,6 +98,7 @@ TESTS_progs = \
 	tools_test \
 	vgem_basic \
 	vgem_slow \
+	i915/sysfs_preemption_timeout \
 	$(NULL)
 
 TESTS_progs += gem_bad_reloc
tests/i915/sysfs_preemption_timeout.c new file +336 -0

336 lines not on this page · raw message

tests/meson.build +1 -0
index 3f3eee277..a699377e3 100644
@@ -238,6 +238,7 @@ i915_progs = [
 	'i915_query',
 	'i915_selftest',
 	'i915_suspend',
+	'sysfs_preemption_timeout',
 ]
 
 test_deps = [ igt_deps ]
Signature · 6 lines
2.24.0.rc0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/3 i915: Exercise sysfs heartbeat controls

We [will] expose various per-engine scheduling controls. One of which, 'heartbeat_duration_ms', defines how often we send a heartbeat down the engine to check upon the health of the engine. If a heartbeat does not complete within the interval (or two), the engine is declared hung.

---
 tests/Makefile.sources                |   1 +
 tests/i915/sysfs_heartbeat_interval.c | 434 ++++++++++++++++++++++++++
 tests/meson.build                     |   1 +
 3 files changed, 436 insertions(+)
 create mode 100644 tests/i915/sysfs_heartbeat_interval.c
tests/Makefile.sources +1 -0
index dff7dac06..4494d2c05 100644
@@ -98,6 +98,7 @@ TESTS_progs = \
 	tools_test \
 	vgem_basic \
 	vgem_slow \
+	i915/sysfs_heartbeat_interval \
 	i915/sysfs_preemption_timeout \
 	$(NULL)
 
tests/i915/sysfs_heartbeat_interval.c new file +434 -0

434 lines not on this page · raw message

tests/meson.build +1 -0
index a699377e3..23f730c20 100644
@@ -238,6 +238,7 @@ i915_progs = [
 	'i915_query',
 	'i915_selftest',
 	'i915_suspend',
+	'sysfs_heartbeat_interval',
 	'sysfs_preemption_timeout',
 ]
 
Signature · 6 lines
2.24.0.rc0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 3/3 i915: Exercise timeslice sysfs property

In reply to Chris Wilson

We [will] expose various per-engine scheduling controls. One of which, 'timeslice_duration_ms', defines the scheduling quantum. If a context exhausts its timeslice, it will be preempted in favour of running one of its compatriots.

---
 tests/Makefile.sources                |   1 +
 tests/i915/sysfs_timeslice_duration.c | 310 ++++++++++++++++++++++++++
 tests/meson.build                     |   1 +
 3 files changed, 312 insertions(+)
 create mode 100644 tests/i915/sysfs_timeslice_duration.c
tests/Makefile.sources +1 -0
index 4494d2c05..9bfe214d7 100644
@@ -100,6 +100,7 @@ TESTS_progs = \
 	vgem_slow \
 	i915/sysfs_heartbeat_interval \
 	i915/sysfs_preemption_timeout \
+	i915/sysfs_timeslice_duration \
 	$(NULL)
 
 TESTS_progs += gem_bad_reloc
tests/i915/sysfs_timeslice_duration.c new file +310 -0

310 lines not on this page · raw message

tests/meson.build +1 -0
index 23f730c20..f603ab3e0 100644
@@ -240,6 +240,7 @@ i915_progs = [
 	'i915_suspend',
 	'sysfs_heartbeat_interval',
 	'sysfs_preemption_timeout',
+	'sysfs_timeslice_duration',
 ]
 
 test_deps = [ igt_deps ]
Signature · 6 lines
2.24.0.rc0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

✗ GitLab.Pipeline: warning for series starting with [1/3] i915: Exercise preemption timeout controls in sysfs

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: series starting with [1/3] i915: Exercise preemption timeout controls in sysfs
URL : https://patchwork.freedesktop.org/series/68251/
State : warning

== Summary ==

Did not get list of undocumented tests for this run, something is wrong!

Other than that, pipeline status: FAILED.

see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/71742 for more details

== Logs ==

For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/71742
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx