* [igt-dev] [PATCH i-g-t] i915/gem_exec_schedule: Trick semaphores into a GPU hang
@ 2019-04-09 13:56 Chris Wilson
2019-04-09 15:08 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2019-04-09 15:39 ` [igt-dev] [Intel-gfx] [PATCH i-g-t] " Tvrtko Ursulin
0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2019-04-09 13:56 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev, Tvrtko Ursulin
If we have two tasks running on xcs0 and xcs1 independently, but who
queue subsequent work onto rcs, we may insert semaphores before the rcs
work and pick unwisely which task to run first. To maximise throughput,
we want to run on rcs whichever task is ready first. Conversely, if we
pick wrongly that can be used to trigger a GPU hang with unaware
userspace.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/i915/gem_exec_schedule.c | 61 ++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index 3df319bcc..d6f109540 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -404,6 +404,65 @@ static void semaphore_userlock(int i915)
igt_spin_batch_free(i915, spin);
}
+static void semaphore_codependency(int i915)
+{
+ struct {
+ igt_spin_t *xcs, *rcs;
+ } task[2];
+ unsigned int engine;
+ int i;
+
+ /*
+ * Consider two tasks, task A runs on (xcs0, rcs0) and task B
+ * on (xcs1, rcs0). That is they must both run a dependent
+ * batch on rcs0, after first running in parallel on separate
+ * engines. To maximise throughput, we want the shorter xcs task
+ * to start on rcs first. However, if we insert semaphores we may
+ * pick wrongly and end up running the requests in the least
+ * optimal order.
+ */
+
+ i = 0;
+ for_each_physical_engine(i915, engine) {
+ uint32_t ctx;
+
+ if (engine == I915_EXEC_RENDER)
+ continue;
+
+ ctx = gem_context_create(i915);
+
+ task[i].xcs =
+ __igt_spin_batch_new(i915,
+ .ctx = ctx,
+ .engine = engine,
+ .flags = IGT_SPIN_POLL_RUN);
+ igt_spin_busywait_until_running(task[i].xcs);
+
+ /* Common rcs tasks will be queued in FIFO */
+ task[i].rcs =
+ __igt_spin_batch_new(i915,
+ .ctx = ctx,
+ .engine = I915_EXEC_RENDER,
+ .dependency = task[i].xcs->handle);
+
+ gem_context_destroy(i915, ctx);
+
+ if (++i == ARRAY_SIZE(task))
+ break;
+ }
+ igt_require(i == ARRAY_SIZE(task));
+
+ /* Since task[0] was queued first, it will be first in queue for rcs */
+ igt_spin_batch_end(task[1].xcs);
+ igt_spin_batch_end(task[1].rcs);
+ gem_sync(i915, task[1].rcs->handle); /* to hang if task[0] hogs rcs */
+
+ for (i = 0; i < ARRAY_SIZE(task); i++) {
+ igt_spin_batch_free(i915, task[i].xcs);
+ igt_spin_batch_free(i915, task[i].rcs);
+ }
+}
+
static void reorder(int fd, unsigned ring, unsigned flags)
#define EQUAL 1
{
@@ -1393,6 +1452,8 @@ igt_main
igt_subtest("semaphore-user")
semaphore_userlock(fd);
+ igt_subtest("semaphore-codependency")
+ semaphore_codependency(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] 3+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for i915/gem_exec_schedule: Trick semaphores into a GPU hang
2019-04-09 13:56 [igt-dev] [PATCH i-g-t] i915/gem_exec_schedule: Trick semaphores into a GPU hang Chris Wilson
@ 2019-04-09 15:08 ` Patchwork
2019-04-09 15:39 ` [igt-dev] [Intel-gfx] [PATCH i-g-t] " Tvrtko Ursulin
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2019-04-09 15:08 UTC (permalink / raw)
To: Chris Wilson; +Cc: igt-dev
== Series Details ==
Series: i915/gem_exec_schedule: Trick semaphores into a GPU hang
URL : https://patchwork.freedesktop.org/series/59229/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_5897 -> IGTPW_2829
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_2829 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in IGTPW_2829, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/59229/revisions/1/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_2829:
### IGT changes ###
#### Possible regressions ####
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
- fi-bxt-dsi: PASS -> DMESG-WARN
* igt@runner@aborted:
- fi-bxt-dsi: NOTRUN -> FAIL
Known issues
------------
Here are the changes found in IGTPW_2829 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_cs_nop@sync-fork-compute0:
- fi-icl-u3: NOTRUN -> SKIP [fdo#109315] +17
* igt@gem_exec_basic@gtt-bsd1:
- fi-icl-u3: NOTRUN -> SKIP [fdo#109276] +7
* igt@gem_exec_parse@basic-rejected:
- fi-icl-u3: NOTRUN -> SKIP [fdo#109289] +1
* igt@gem_exec_store@basic-bsd1:
- fi-kbl-r: NOTRUN -> SKIP [fdo#109271] +41
* igt@i915_selftest@live_contexts:
- fi-icl-u3: NOTRUN -> DMESG-FAIL [fdo#108569]
* igt@i915_selftest@live_execlists:
- fi-apl-guc: PASS -> INCOMPLETE [fdo#103927] / [fdo#109720]
* igt@kms_busy@basic-flip-c:
- fi-blb-e6850: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
- fi-byt-j1900: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
* igt@kms_chamelium@hdmi-crc-fast:
- fi-byt-j1900: NOTRUN -> SKIP [fdo#109271] +52
* igt@kms_chamelium@hdmi-edid-read:
- fi-icl-u3: NOTRUN -> SKIP [fdo#109284] +8
* igt@kms_force_connector_basic@prune-stale-modes:
- fi-icl-u3: NOTRUN -> SKIP [fdo#109285] +3
* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u3: NOTRUN -> FAIL [fdo#103167]
* igt@kms_pipe_crc_basic@hang-read-crc-pipe-c:
- fi-blb-e6850: NOTRUN -> SKIP [fdo#109271] +48
* igt@runner@aborted:
- fi-glk-dsi: NOTRUN -> FAIL [k.org#202321]
- fi-icl-guc: NOTRUN -> FAIL [fdo#110191]
- fi-apl-guc: NOTRUN -> FAIL [fdo#108622] / [fdo#109720]
#### Possible fixes ####
* igt@gem_ctx_exec@basic:
- fi-icl-u3: INCOMPLETE [fdo#107713] -> PASS
* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: INCOMPLETE [fdo#107718] -> PASS
* igt@i915_selftest@live_contexts:
- fi-skl-gvtdvm: DMESG-FAIL [fdo#110235 ] -> PASS
#### Warnings ####
* igt@i915_pm_rpm@module-reload:
- fi-glk-dsi: INCOMPLETE [fdo#103359] / [k.org#198133] -> DMESG-FAIL [fdo#105538] / [fdo#107732] / [fdo#109513]
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105538]: https://bugs.freedesktop.org/show_bug.cgi?id=105538
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107732]: https://bugs.freedesktop.org/show_bug.cgi?id=107732
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109513]: https://bugs.freedesktop.org/show_bug.cgi?id=109513
[fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720
[fdo#110191]: https://bugs.freedesktop.org/show_bug.cgi?id=110191
[fdo#110235 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110235
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133
[k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321
Participating hosts (44 -> 44)
------------------------------
Additional (3): fi-byt-j1900 fi-icl-guc fi-kbl-r
Missing (3): fi-byt-squawks fi-bsw-cyan fi-bdw-samus
Build changes
-------------
* IGT: IGT_4934 -> IGTPW_2829
CI_DRM_5897: 7d07e025e78603d6270bc115fdb6c1efea6e66a5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2829: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2829/
IGT_4934: dc4f45eb6874331daec870dc1e4cfc3ac5c49311 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Testlist changes ==
+igt@gem_exec_schedule@semaphore-codependency
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2829/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] i915/gem_exec_schedule: Trick semaphores into a GPU hang
2019-04-09 13:56 [igt-dev] [PATCH i-g-t] i915/gem_exec_schedule: Trick semaphores into a GPU hang Chris Wilson
2019-04-09 15:08 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
@ 2019-04-09 15:39 ` Tvrtko Ursulin
1 sibling, 0 replies; 3+ messages in thread
From: Tvrtko Ursulin @ 2019-04-09 15:39 UTC (permalink / raw)
To: Chris Wilson, intel-gfx; +Cc: igt-dev
On 09/04/2019 14:56, Chris Wilson wrote:
> If we have two tasks running on xcs0 and xcs1 independently, but who
> queue subsequent work onto rcs, we may insert semaphores before the rcs
> work and pick unwisely which task to run first. To maximise throughput,
> we want to run on rcs whichever task is ready first. Conversely, if we
> pick wrongly that can be used to trigger a GPU hang with unaware
> userspace.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> tests/i915/gem_exec_schedule.c | 61 ++++++++++++++++++++++++++++++++++
> 1 file changed, 61 insertions(+)
>
> diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
> index 3df319bcc..d6f109540 100644
> --- a/tests/i915/gem_exec_schedule.c
> +++ b/tests/i915/gem_exec_schedule.c
> @@ -404,6 +404,65 @@ static void semaphore_userlock(int i915)
> igt_spin_batch_free(i915, spin);
> }
>
> +static void semaphore_codependency(int i915)
> +{
> + struct {
> + igt_spin_t *xcs, *rcs;
> + } task[2];
> + unsigned int engine;
> + int i;
> +
> + /*
> + * Consider two tasks, task A runs on (xcs0, rcs0) and task B
> + * on (xcs1, rcs0). That is they must both run a dependent
> + * batch on rcs0, after first running in parallel on separate
> + * engines. To maximise throughput, we want the shorter xcs task
> + * to start on rcs first. However, if we insert semaphores we may
> + * pick wrongly and end up running the requests in the least
> + * optimal order.
> + */
> +
> + i = 0;
> + for_each_physical_engine(i915, engine) {
> + uint32_t ctx;
> +
> + if (engine == I915_EXEC_RENDER)
> + continue;
> +
> + ctx = gem_context_create(i915);
> +
> + task[i].xcs =
> + __igt_spin_batch_new(i915,
> + .ctx = ctx,
> + .engine = engine,
> + .flags = IGT_SPIN_POLL_RUN);
> + igt_spin_busywait_until_running(task[i].xcs);
> +
> + /* Common rcs tasks will be queued in FIFO */
> + task[i].rcs =
> + __igt_spin_batch_new(i915,
> + .ctx = ctx,
> + .engine = I915_EXEC_RENDER,
> + .dependency = task[i].xcs->handle);
> +
> + gem_context_destroy(i915, ctx);
> +
> + if (++i == ARRAY_SIZE(task))
> + break;
> + }
> + igt_require(i == ARRAY_SIZE(task));
> +
> + /* Since task[0] was queued first, it will be first in queue for rcs */
> + igt_spin_batch_end(task[1].xcs);
> + igt_spin_batch_end(task[1].rcs);
> + gem_sync(i915, task[1].rcs->handle); /* to hang if task[0] hogs rcs */
> +
> + for (i = 0; i < ARRAY_SIZE(task); i++) {
> + igt_spin_batch_free(i915, task[i].xcs);
> + igt_spin_batch_free(i915, task[i].rcs);
> + }
> +}
> +
> static void reorder(int fd, unsigned ring, unsigned flags)
> #define EQUAL 1
> {
> @@ -1393,6 +1452,8 @@ igt_main
>
> igt_subtest("semaphore-user")
> semaphore_userlock(fd);
> + igt_subtest("semaphore-codependency")
> + semaphore_codependency(fd);
>
> igt_subtest("smoketest-all")
> smoketest(fd, ALL_ENGINES, 30);
>
Just need can_store_dword for code correctness before IGT_SPIN_POLL_RUN
and with that:
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] 3+ messages in thread
end of thread, other threads:[~2019-04-09 15:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-09 13:56 [igt-dev] [PATCH i-g-t] i915/gem_exec_schedule: Trick semaphores into a GPU hang Chris Wilson
2019-04-09 15:08 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2019-04-09 15:39 ` [igt-dev] [Intel-gfx] [PATCH i-g-t] " Tvrtko Ursulin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox