* [PATCH i-g-t] i915/gem_exec_schedule: Verify that using HW semaphores doesn't block
@ 2019-03-29 9:54 ` Chris Wilson
0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2019-03-29 9:54 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev
We may use HW semaphores to schedule nearly-ready work such that they
are already spinning on the GPU waiting for the completion on another
engine. However, we don't want for that spinning task to actually block
any real work should it be scheduled.
v2: No typeof autos
v3: Don't cheat, check gen8 as well
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/i915/gem_exec_schedule.c | 87 ++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index 4f0577b4e..3df319bcc 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -48,6 +48,10 @@
#define MAX_CONTEXTS 1024
+#define LOCAL_I915_EXEC_BSD_SHIFT (13)
+#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT)
+#define ENGINE_MASK (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
+
IGT_TEST_DESCRIPTION("Check that we can control the order of execution");
static inline
@@ -320,6 +324,86 @@ static void smoketest(int fd, unsigned ring, unsigned timeout)
}
}
+static uint32_t __batch_create(int i915, uint32_t offset)
+{
+ const uint32_t bbe = MI_BATCH_BUFFER_END;
+ uint32_t handle;
+
+ handle = gem_create(i915, ALIGN(offset + 4, 4096));
+ gem_write(i915, handle, offset, &bbe, sizeof(bbe));
+
+ return handle;
+}
+
+static uint32_t batch_create(int i915)
+{
+ return __batch_create(i915, 0);
+}
+
+static void semaphore_userlock(int i915)
+{
+ struct drm_i915_gem_exec_object2 obj = {
+ .handle = batch_create(i915),
+ };
+ igt_spin_t *spin = NULL;
+ unsigned int engine;
+ uint32_t scratch;
+
+ igt_require(gem_scheduler_has_semaphores(i915));
+
+ /*
+ * Given the use of semaphores to govern parallel submission
+ * of nearly-ready work to HW, we still want to run actually
+ * ready work immediately. Without semaphores, the dependent
+ * work wouldn't be submitted so our ready work will run.
+ */
+
+ scratch = gem_create(i915, 4096);
+ for_each_physical_engine(i915, engine) {
+ if (!spin) {
+ spin = igt_spin_batch_new(i915,
+ .dependency = scratch,
+ .engine = engine);
+ } else {
+ uint64_t saved = spin->execbuf.flags;
+
+ spin->execbuf.flags &= ~ENGINE_MASK;
+ spin->execbuf.flags |= engine;
+
+ gem_execbuf(i915, &spin->execbuf);
+
+ spin->execbuf.flags = saved;
+ }
+ }
+ igt_require(spin);
+ gem_close(i915, scratch);
+
+ /*
+ * On all dependent engines, the request may be executing (busywaiting
+ * on a HW semaphore) but it should not prevent any real work from
+ * taking precedence.
+ */
+ scratch = gem_context_create(i915);
+ for_each_physical_engine(i915, engine) {
+ struct drm_i915_gem_execbuffer2 execbuf = {
+ .buffers_ptr = to_user_pointer(&obj),
+ .buffer_count = 1,
+ .flags = engine,
+ .rsvd1 = scratch,
+ };
+
+ if (engine == (spin->execbuf.flags & ENGINE_MASK))
+ continue;
+
+ gem_execbuf(i915, &execbuf);
+ }
+ gem_context_destroy(i915, scratch);
+ gem_sync(i915, obj.handle); /* to hang unless we can preempt */
+ gem_close(i915, obj.handle);
+
+ igt_spin_batch_free(i915, spin);
+}
+
static void reorder(int fd, unsigned ring, unsigned flags)
#define EQUAL 1
{
@@ -1307,6 +1391,9 @@ igt_main
igt_require(gem_scheduler_has_ctx_priority(fd));
}
+ igt_subtest("semaphore-user")
+ semaphore_userlock(fd);
+
igt_subtest("smoketest-all")
smoketest(fd, ALL_ENGINES, 30);
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] [PATCH i-g-t] i915/gem_exec_schedule: Verify that using HW semaphores doesn't block
@ 2019-03-29 9:54 ` Chris Wilson
0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2019-03-29 9:54 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev, Tvrtko Ursulin
We may use HW semaphores to schedule nearly-ready work such that they
are already spinning on the GPU waiting for the completion on another
engine. However, we don't want for that spinning task to actually block
any real work should it be scheduled.
v2: No typeof autos
v3: Don't cheat, check gen8 as well
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/i915/gem_exec_schedule.c | 87 ++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index 4f0577b4e..3df319bcc 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -48,6 +48,10 @@
#define MAX_CONTEXTS 1024
+#define LOCAL_I915_EXEC_BSD_SHIFT (13)
+#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT)
+#define ENGINE_MASK (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
+
IGT_TEST_DESCRIPTION("Check that we can control the order of execution");
static inline
@@ -320,6 +324,86 @@ static void smoketest(int fd, unsigned ring, unsigned timeout)
}
}
+static uint32_t __batch_create(int i915, uint32_t offset)
+{
+ const uint32_t bbe = MI_BATCH_BUFFER_END;
+ uint32_t handle;
+
+ handle = gem_create(i915, ALIGN(offset + 4, 4096));
+ gem_write(i915, handle, offset, &bbe, sizeof(bbe));
+
+ return handle;
+}
+
+static uint32_t batch_create(int i915)
+{
+ return __batch_create(i915, 0);
+}
+
+static void semaphore_userlock(int i915)
+{
+ struct drm_i915_gem_exec_object2 obj = {
+ .handle = batch_create(i915),
+ };
+ igt_spin_t *spin = NULL;
+ unsigned int engine;
+ uint32_t scratch;
+
+ igt_require(gem_scheduler_has_semaphores(i915));
+
+ /*
+ * Given the use of semaphores to govern parallel submission
+ * of nearly-ready work to HW, we still want to run actually
+ * ready work immediately. Without semaphores, the dependent
+ * work wouldn't be submitted so our ready work will run.
+ */
+
+ scratch = gem_create(i915, 4096);
+ for_each_physical_engine(i915, engine) {
+ if (!spin) {
+ spin = igt_spin_batch_new(i915,
+ .dependency = scratch,
+ .engine = engine);
+ } else {
+ uint64_t saved = spin->execbuf.flags;
+
+ spin->execbuf.flags &= ~ENGINE_MASK;
+ spin->execbuf.flags |= engine;
+
+ gem_execbuf(i915, &spin->execbuf);
+
+ spin->execbuf.flags = saved;
+ }
+ }
+ igt_require(spin);
+ gem_close(i915, scratch);
+
+ /*
+ * On all dependent engines, the request may be executing (busywaiting
+ * on a HW semaphore) but it should not prevent any real work from
+ * taking precedence.
+ */
+ scratch = gem_context_create(i915);
+ for_each_physical_engine(i915, engine) {
+ struct drm_i915_gem_execbuffer2 execbuf = {
+ .buffers_ptr = to_user_pointer(&obj),
+ .buffer_count = 1,
+ .flags = engine,
+ .rsvd1 = scratch,
+ };
+
+ if (engine == (spin->execbuf.flags & ENGINE_MASK))
+ continue;
+
+ gem_execbuf(i915, &execbuf);
+ }
+ gem_context_destroy(i915, scratch);
+ gem_sync(i915, obj.handle); /* to hang unless we can preempt */
+ gem_close(i915, obj.handle);
+
+ igt_spin_batch_free(i915, spin);
+}
+
static void reorder(int fd, unsigned ring, unsigned flags)
#define EQUAL 1
{
@@ -1307,6 +1391,9 @@ igt_main
igt_require(gem_scheduler_has_ctx_priority(fd));
}
+ igt_subtest("semaphore-user")
+ semaphore_userlock(fd);
+
igt_subtest("smoketest-all")
smoketest(fd, ALL_ENGINES, 30);
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_exec_schedule: Verify that using HW semaphores doesn't block (rev2)
2019-03-29 9:54 ` [igt-dev] " Chris Wilson
(?)
@ 2019-03-29 11:18 ` Patchwork
-1 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-03-29 11:18 UTC (permalink / raw)
To: Chris Wilson; +Cc: igt-dev
== Series Details ==
Series: i915/gem_exec_schedule: Verify that using HW semaphores doesn't block (rev2)
URL : https://patchwork.freedesktop.org/series/55596/
State : success
== Summary ==
CI Bug Log - changes from IGT_4912 -> IGTPW_2735
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/55596/revisions/2/mbox/
Known issues
------------
Here are the changes found in IGTPW_2735 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_basic@basic-vebox:
- fi-ivb-3770: NOTRUN -> SKIP [fdo#109271] +48
* igt@kms_busy@basic-flip-b:
- fi-gdg-551: PASS -> FAIL [fdo#103182]
* igt@kms_chamelium@vga-edid-read:
- fi-hsw-4770r: NOTRUN -> SKIP [fdo#109271] +45
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
- fi-byt-clapper: PASS -> FAIL [fdo#107362]
#### Possible fixes ####
* igt@i915_selftest@live_contexts:
- fi-bdw-gvtdvm: DMESG-FAIL [fdo#110235 ] -> PASS
* igt@i915_selftest@live_execlists:
- fi-apl-guc: INCOMPLETE [fdo#103927] / [fdo#109720] -> PASS
* igt@i915_selftest@live_hangcheck:
- fi-icl-u2: INCOMPLETE [fdo#108569] -> PASS
* igt@i915_selftest@live_uncore:
- fi-skl-gvtdvm: DMESG-FAIL [fdo#110210] -> PASS
* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u2: FAIL [fdo#103167] -> PASS
* igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720
[fdo#110210]: https://bugs.freedesktop.org/show_bug.cgi?id=110210
[fdo#110235 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110235
Participating hosts (45 -> 42)
------------------------------
Additional (2): fi-hsw-4770r fi-ivb-3770
Missing (5): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-bdw-samus
Build changes
-------------
* IGT: IGT_4912 -> IGTPW_2735
CI_DRM_5835: a87cb5da301d892d69d44b106a007caea8386935 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2735: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2735/
IGT_4912: 66deae8b6fa69540f069d6551cd22013f5343948 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Testlist changes ==
+igt@gem_exec_schedule@semaphore-user
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2735/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 6+ messages in thread
* [igt-dev] ✓ Fi.CI.IGT: success for i915/gem_exec_schedule: Verify that using HW semaphores doesn't block (rev2)
2019-03-29 9:54 ` [igt-dev] " Chris Wilson
(?)
(?)
@ 2019-03-29 13:59 ` Patchwork
-1 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-03-29 13:59 UTC (permalink / raw)
To: Chris Wilson; +Cc: igt-dev
== Series Details ==
Series: i915/gem_exec_schedule: Verify that using HW semaphores doesn't block (rev2)
URL : https://patchwork.freedesktop.org/series/55596/
State : success
== Summary ==
CI Bug Log - changes from IGT_4912_full -> IGTPW_2735_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/55596/revisions/2/mbox/
New tests
---------
New tests have been introduced between IGT_4912_full and IGTPW_2735_full:
### New IGT tests (1) ###
* igt@gem_exec_schedule@semaphore-user:
- Statuses : 3 pass(s) 1 skip(s)
- Exec time: [0.0, 0.01] s
Known issues
------------
Here are the changes found in IGTPW_2735_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_store@cachelines-bsd1:
- shard-snb: NOTRUN -> SKIP [fdo#109271] +102
* igt@gem_mocs_settings@mocs-rc6-dirty-render:
- shard-hsw: NOTRUN -> SKIP [fdo#109271] +38
* igt@gem_pwrite@huge-cpu-forwards:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] +23
* igt@gem_tiled_swapping@non-threaded:
- shard-hsw: PASS -> FAIL [fdo#108686]
* igt@kms_atomic_transition@4x-modeset-transitions:
- shard-snb: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +8
* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
- shard-kbl: PASS -> DMESG-WARN [fdo#110222]
* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-b:
- shard-snb: PASS -> DMESG-WARN [fdo#110222] +1
- shard-hsw: PASS -> DMESG-WARN [fdo#110222]
* igt@kms_busy@extended-modeset-hang-oldfb-render-e:
- shard-apl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +2
* igt@kms_busy@extended-pageflip-hang-newfb-render-c:
- shard-apl: NOTRUN -> DMESG-WARN [fdo#110222]
* igt@kms_busy@extended-pageflip-hang-newfb-render-e:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +3
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a:
- shard-hsw: NOTRUN -> DMESG-WARN [fdo#110222]
* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
- shard-hsw: PASS -> FAIL [fdo#105767]
* igt@kms_draw_crc@draw-method-xrgb8888-render-xtiled:
- shard-hsw: PASS -> INCOMPLETE [fdo#103540]
* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-indfb-plflip-blt:
- shard-glk: PASS -> FAIL [fdo#103167]
* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-blt:
- shard-apl: NOTRUN -> SKIP [fdo#109271] +42
* igt@kms_frontbuffer_tracking@psr-1p-primscrn-pri-indfb-draw-pwrite:
- shard-glk: NOTRUN -> SKIP [fdo#109271] +1
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-kbl: NOTRUN -> INCOMPLETE [fdo#103665]
* igt@kms_plane_alpha_blend@pipe-b-alpha-7efc:
- shard-kbl: NOTRUN -> FAIL [fdo#108145] / [fdo#108590]
* igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
- shard-apl: PASS -> FAIL [fdo#108145]
* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-glk: PASS -> FAIL [fdo#108145]
* igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
- shard-apl: NOTRUN -> FAIL [fdo#108145]
* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-hsw: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +3
* igt@kms_vblank@pipe-b-ts-continuation-dpms-rpm:
- shard-apl: PASS -> FAIL [fdo#104894] +1
#### Possible fixes ####
* igt@gem_create@create-clear:
- shard-hsw: INCOMPLETE [fdo#103540] -> PASS
* igt@gem_exec_whisper@normal:
- shard-apl: INCOMPLETE [fdo#103927] -> PASS
* igt@kms_busy@extended-modeset-hang-newfb-render-b:
- shard-hsw: DMESG-WARN [fdo#110222] -> PASS +1
- shard-kbl: DMESG-WARN [fdo#110222] -> PASS +1
- shard-snb: DMESG-WARN [fdo#110222] -> PASS
* igt@kms_cursor_crc@cursor-128x128-suspend:
- shard-kbl: INCOMPLETE [fdo#103665] -> PASS
* igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
- shard-snb: SKIP [fdo#109271] -> PASS
* igt@kms_plane_scaling@pipe-b-scaler-with-pixel-format:
- shard-glk: SKIP [fdo#109271] / [fdo#109278] -> PASS
* {igt@kms_universal_plane@universal-plane-pipe-c-functional}:
- shard-kbl: FAIL [fdo#110037] -> PASS
* igt@kms_vblank@pipe-a-ts-continuation-dpms-rpm:
- shard-apl: FAIL [fdo#104894] -> PASS +1
* igt@kms_vblank@pipe-b-ts-continuation-suspend:
- shard-kbl: FAIL [fdo#104894] -> PASS
#### Warnings ####
* igt@kms_rotation_crc@multiplane-rotation:
- shard-kbl: INCOMPLETE [fdo#103665] -> DMESG-FAIL [fdo#105763]
{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#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894
[fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108590]: https://bugs.freedesktop.org/show_bug.cgi?id=108590
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#110037]: https://bugs.freedesktop.org/show_bug.cgi?id=110037
[fdo#110222]: https://bugs.freedesktop.org/show_bug.cgi?id=110222
Participating hosts (7 -> 5)
------------------------------
Missing (2): shard-skl shard-iclb
Build changes
-------------
* IGT: IGT_4912 -> IGTPW_2735
CI_DRM_5835: a87cb5da301d892d69d44b106a007caea8386935 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2735: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2735/
IGT_4912: 66deae8b6fa69540f069d6551cd22013f5343948 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2735/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] i915/gem_exec_schedule: Verify that using HW semaphores doesn't block
2019-03-29 9:54 ` [igt-dev] " Chris Wilson
@ 2019-04-01 7:52 ` Tvrtko Ursulin
-1 siblings, 0 replies; 6+ messages in thread
From: Tvrtko Ursulin @ 2019-04-01 7:52 UTC (permalink / raw)
To: Chris Wilson, intel-gfx; +Cc: igt-dev
On 29/03/2019 09:54, Chris Wilson wrote:
> We may use HW semaphores to schedule nearly-ready work such that they
> are already spinning on the GPU waiting for the completion on another
> engine. However, we don't want for that spinning task to actually block
> any real work should it be scheduled.
>
> v2: No typeof autos
> v3: Don't cheat, check gen8 as well
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> tests/i915/gem_exec_schedule.c | 87 ++++++++++++++++++++++++++++++++++
> 1 file changed, 87 insertions(+)
>
> diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
> index 4f0577b4e..3df319bcc 100644
> --- a/tests/i915/gem_exec_schedule.c
> +++ b/tests/i915/gem_exec_schedule.c
> @@ -48,6 +48,10 @@
>
> #define MAX_CONTEXTS 1024
>
> +#define LOCAL_I915_EXEC_BSD_SHIFT (13)
> +#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT)
> +#define ENGINE_MASK (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
> +
> IGT_TEST_DESCRIPTION("Check that we can control the order of execution");
>
> static inline
> @@ -320,6 +324,86 @@ static void smoketest(int fd, unsigned ring, unsigned timeout)
> }
> }
>
> +static uint32_t __batch_create(int i915, uint32_t offset)
> +{
> + const uint32_t bbe = MI_BATCH_BUFFER_END;
> + uint32_t handle;
> +
> + handle = gem_create(i915, ALIGN(offset + 4, 4096));
> + gem_write(i915, handle, offset, &bbe, sizeof(bbe));
> +
> + return handle;
> +}
> +
> +static uint32_t batch_create(int i915)
> +{
> + return __batch_create(i915, 0);
> +}
> +
> +static void semaphore_userlock(int i915)
> +{
> + struct drm_i915_gem_exec_object2 obj = {
> + .handle = batch_create(i915),
> + };
> + igt_spin_t *spin = NULL;
> + unsigned int engine;
> + uint32_t scratch;
> +
> + igt_require(gem_scheduler_has_semaphores(i915));
> +
> + /*
> + * Given the use of semaphores to govern parallel submission
> + * of nearly-ready work to HW, we still want to run actually
> + * ready work immediately. Without semaphores, the dependent
> + * work wouldn't be submitted so our ready work will run.
> + */
> +
> + scratch = gem_create(i915, 4096);
> + for_each_physical_engine(i915, engine) {
> + if (!spin) {
> + spin = igt_spin_batch_new(i915,
> + .dependency = scratch,
> + .engine = engine);
> + } else {
> + uint64_t saved = spin->execbuf.flags;
> +
> + spin->execbuf.flags &= ~ENGINE_MASK;
> + spin->execbuf.flags |= engine;
> +
> + gem_execbuf(i915, &spin->execbuf);
> +
> + spin->execbuf.flags = saved;
> + }
> + }
> + igt_require(spin);
> + gem_close(i915, scratch);
> +
> + /*
> + * On all dependent engines, the request may be executing (busywaiting
> + * on a HW semaphore) but it should not prevent any real work from
> + * taking precedence.
> + */
> + scratch = gem_context_create(i915);
> + for_each_physical_engine(i915, engine) {
> + struct drm_i915_gem_execbuffer2 execbuf = {
> + .buffers_ptr = to_user_pointer(&obj),
> + .buffer_count = 1,
> + .flags = engine,
> + .rsvd1 = scratch,
> + };
> +
> + if (engine == (spin->execbuf.flags & ENGINE_MASK))
> + continue;
> +
> + gem_execbuf(i915, &execbuf);
> + }
> + gem_context_destroy(i915, scratch);
> + gem_sync(i915, obj.handle); /* to hang unless we can preempt */
> + gem_close(i915, obj.handle);
> +
> + igt_spin_batch_free(i915, spin);
> +}
> +
> static void reorder(int fd, unsigned ring, unsigned flags)
> #define EQUAL 1
> {
> @@ -1307,6 +1391,9 @@ igt_main
> igt_require(gem_scheduler_has_ctx_priority(fd));
> }
>
> + igt_subtest("semaphore-user")
> + semaphore_userlock(fd);
> +
> igt_subtest("smoketest-all")
> smoketest(fd, ALL_ENGINES, 30);
>
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] i915/gem_exec_schedule: Verify that using HW semaphores doesn't block
@ 2019-04-01 7:52 ` Tvrtko Ursulin
0 siblings, 0 replies; 6+ messages in thread
From: Tvrtko Ursulin @ 2019-04-01 7:52 UTC (permalink / raw)
To: Chris Wilson, intel-gfx; +Cc: igt-dev, Tvrtko Ursulin
On 29/03/2019 09:54, Chris Wilson wrote:
> We may use HW semaphores to schedule nearly-ready work such that they
> are already spinning on the GPU waiting for the completion on another
> engine. However, we don't want for that spinning task to actually block
> any real work should it be scheduled.
>
> v2: No typeof autos
> v3: Don't cheat, check gen8 as well
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> tests/i915/gem_exec_schedule.c | 87 ++++++++++++++++++++++++++++++++++
> 1 file changed, 87 insertions(+)
>
> diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
> index 4f0577b4e..3df319bcc 100644
> --- a/tests/i915/gem_exec_schedule.c
> +++ b/tests/i915/gem_exec_schedule.c
> @@ -48,6 +48,10 @@
>
> #define MAX_CONTEXTS 1024
>
> +#define LOCAL_I915_EXEC_BSD_SHIFT (13)
> +#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT)
> +#define ENGINE_MASK (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
> +
> IGT_TEST_DESCRIPTION("Check that we can control the order of execution");
>
> static inline
> @@ -320,6 +324,86 @@ static void smoketest(int fd, unsigned ring, unsigned timeout)
> }
> }
>
> +static uint32_t __batch_create(int i915, uint32_t offset)
> +{
> + const uint32_t bbe = MI_BATCH_BUFFER_END;
> + uint32_t handle;
> +
> + handle = gem_create(i915, ALIGN(offset + 4, 4096));
> + gem_write(i915, handle, offset, &bbe, sizeof(bbe));
> +
> + return handle;
> +}
> +
> +static uint32_t batch_create(int i915)
> +{
> + return __batch_create(i915, 0);
> +}
> +
> +static void semaphore_userlock(int i915)
> +{
> + struct drm_i915_gem_exec_object2 obj = {
> + .handle = batch_create(i915),
> + };
> + igt_spin_t *spin = NULL;
> + unsigned int engine;
> + uint32_t scratch;
> +
> + igt_require(gem_scheduler_has_semaphores(i915));
> +
> + /*
> + * Given the use of semaphores to govern parallel submission
> + * of nearly-ready work to HW, we still want to run actually
> + * ready work immediately. Without semaphores, the dependent
> + * work wouldn't be submitted so our ready work will run.
> + */
> +
> + scratch = gem_create(i915, 4096);
> + for_each_physical_engine(i915, engine) {
> + if (!spin) {
> + spin = igt_spin_batch_new(i915,
> + .dependency = scratch,
> + .engine = engine);
> + } else {
> + uint64_t saved = spin->execbuf.flags;
> +
> + spin->execbuf.flags &= ~ENGINE_MASK;
> + spin->execbuf.flags |= engine;
> +
> + gem_execbuf(i915, &spin->execbuf);
> +
> + spin->execbuf.flags = saved;
> + }
> + }
> + igt_require(spin);
> + gem_close(i915, scratch);
> +
> + /*
> + * On all dependent engines, the request may be executing (busywaiting
> + * on a HW semaphore) but it should not prevent any real work from
> + * taking precedence.
> + */
> + scratch = gem_context_create(i915);
> + for_each_physical_engine(i915, engine) {
> + struct drm_i915_gem_execbuffer2 execbuf = {
> + .buffers_ptr = to_user_pointer(&obj),
> + .buffer_count = 1,
> + .flags = engine,
> + .rsvd1 = scratch,
> + };
> +
> + if (engine == (spin->execbuf.flags & ENGINE_MASK))
> + continue;
> +
> + gem_execbuf(i915, &execbuf);
> + }
> + gem_context_destroy(i915, scratch);
> + gem_sync(i915, obj.handle); /* to hang unless we can preempt */
> + gem_close(i915, obj.handle);
> +
> + igt_spin_batch_free(i915, spin);
> +}
> +
> static void reorder(int fd, unsigned ring, unsigned flags)
> #define EQUAL 1
> {
> @@ -1307,6 +1391,9 @@ igt_main
> igt_require(gem_scheduler_has_ctx_priority(fd));
> }
>
> + igt_subtest("semaphore-user")
> + semaphore_userlock(fd);
> +
> igt_subtest("smoketest-all")
> smoketest(fd, ALL_ENGINES, 30);
>
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-04-01 7:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 9:54 [PATCH i-g-t] i915/gem_exec_schedule: Verify that using HW semaphores doesn't block Chris Wilson
2019-03-29 9:54 ` [igt-dev] " Chris Wilson
2019-03-29 11:18 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_exec_schedule: Verify that using HW semaphores doesn't block (rev2) Patchwork
2019-03-29 13:59 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-01 7:52 ` [igt-dev] [PATCH i-g-t] i915/gem_exec_schedule: Verify that using HW semaphores doesn't block Tvrtko Ursulin
2019-04-01 7:52 ` Tvrtko Ursulin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.