* [Intel-gfx] [PATCH] drm/i915/gem: Propagate error from cancelled submit due to context closure
@ 2020-12-03 10:34 Chris Wilson
2020-12-03 11:26 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chris Wilson @ 2020-12-03 10:34 UTC (permalink / raw)
To: intel-gfx; +Cc: stable, Chris Wilson
In the course of discovering and closing many races with context closure
and execbuf submission, since commit 61231f6bd056 ("drm/i915/gem: Check
that the context wasn't closed during setup") we started checking that
the context was not closed by another userspace thread during the execbuf
ioctl. In doing so we cancelled the inflight request (by telling it to be
skipped), but kept reporting success since we do submit a request, albeit
one that doesn't execute. As the error is known before we return from the
ioctl, we can report the error we detect immediately, rather than leave
it on the fence status. With the immediate propagation of the error, it
is easier for userspace to handle.
Fixes: 61231f6bd056 ("drm/i915/gem: Check that the context wasn't closed during setup")
Testcase: igt/gem_ctx_exec/basic-close-race
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: <stable@vger.kernel.org> # v5.7+
---
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 1904e6e5ea64..b07dc1156a0e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -3097,7 +3097,7 @@ static void retire_requests(struct intel_timeline *tl, struct i915_request *end)
break;
}
-static void eb_request_add(struct i915_execbuffer *eb)
+static int eb_request_add(struct i915_execbuffer *eb, int err)
{
struct i915_request *rq = eb->request;
struct intel_timeline * const tl = i915_request_timeline(rq);
@@ -3118,6 +3118,7 @@ static void eb_request_add(struct i915_execbuffer *eb)
/* Serialise with context_close via the add_to_timeline */
i915_request_set_error_once(rq, -ENOENT);
__i915_request_skip(rq);
+ err = -ENOENT; /* override any transient errors */
}
__i915_request_queue(rq, &attr);
@@ -3127,6 +3128,8 @@ static void eb_request_add(struct i915_execbuffer *eb)
retire_requests(tl, prev);
mutex_unlock(&tl->mutex);
+
+ return err;
}
static const i915_user_extension_fn execbuf_extensions[] = {
@@ -3332,7 +3335,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
err = eb_submit(&eb, batch);
err_request:
i915_request_get(eb.request);
- eb_request_add(&eb);
+ err = eb_request_add(&eb, err);
if (eb.fences)
signal_fence_array(&eb);
--
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] 4+ messages in thread* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gem: Propagate error from cancelled submit due to context closure
2020-12-03 10:34 [Intel-gfx] [PATCH] drm/i915/gem: Propagate error from cancelled submit due to context closure Chris Wilson
@ 2020-12-03 11:26 ` Patchwork
2020-12-03 11:58 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-12-04 11:09 ` [Intel-gfx] [PATCH] " Tvrtko Ursulin
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2020-12-03 11:26 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/gem: Propagate error from cancelled submit due to context closure
URL : https://patchwork.freedesktop.org/series/84531/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
a6642ebaca9a drm/i915/gem: Propagate error from cancelled submit due to context closure
-:21: WARNING:BAD_SIGN_OFF: email address '<stable@vger.kernel.org> # v5.7+' might be better as 'stable@vger.kernel.org# v5.7+'
#21:
Cc: <stable@vger.kernel.org> # v5.7+
total: 0 errors, 1 warnings, 0 checks, 31 lines checked
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gem: Propagate error from cancelled submit due to context closure
2020-12-03 10:34 [Intel-gfx] [PATCH] drm/i915/gem: Propagate error from cancelled submit due to context closure Chris Wilson
2020-12-03 11:26 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
@ 2020-12-03 11:58 ` Patchwork
2020-12-04 11:09 ` [Intel-gfx] [PATCH] " Tvrtko Ursulin
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2020-12-03 11:58 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 4999 bytes --]
== Series Details ==
Series: drm/i915/gem: Propagate error from cancelled submit due to context closure
URL : https://patchwork.freedesktop.org/series/84531/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_9432 -> Patchwork_19049
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_19049 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_19049, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_19049:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@gt_timelines:
- fi-apl-guc: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/fi-apl-guc/igt@i915_selftest@live@gt_timelines.html
* igt@i915_selftest@live@memory_region:
- fi-cfl-8109u: [PASS][2] -> [DMESG-WARN][3] +11 similar issues
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9432/fi-cfl-8109u/igt@i915_selftest@live@memory_region.html
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/fi-cfl-8109u/igt@i915_selftest@live@memory_region.html
New tests
---------
New tests have been introduced between CI_DRM_9432 and Patchwork_19049:
### New CI tests (1) ###
* boot:
- Statuses : 1 fail(s) 40 pass(s)
- Exec time: [0.0] s
Known issues
------------
Here are the changes found in Patchwork_19049 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_huc_copy@huc-copy:
- fi-tgl-y: [PASS][4] -> [DMESG-WARN][5] ([i915#402])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9432/fi-tgl-y/igt@gem_huc_copy@huc-copy.html
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/fi-tgl-y/igt@gem_huc_copy@huc-copy.html
* igt@i915_selftest@live@execlists:
- fi-cfl-8109u: [PASS][6] -> [DMESG-WARN][7] ([i915#1037])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9432/fi-cfl-8109u/igt@i915_selftest@live@execlists.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/fi-cfl-8109u/igt@i915_selftest@live@execlists.html
- fi-icl-y: [PASS][8] -> [INCOMPLETE][9] ([i915#1037] / [i915#2276])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9432/fi-icl-y/igt@i915_selftest@live@execlists.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/fi-icl-y/igt@i915_selftest@live@execlists.html
#### Possible fixes ####
* igt@core_hotunplug@unbind-rebind:
- fi-apl-guc: [INCOMPLETE][10] -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9432/fi-apl-guc/igt@core_hotunplug@unbind-rebind.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/fi-apl-guc/igt@core_hotunplug@unbind-rebind.html
* igt@debugfs_test@read_all_entries:
- {fi-kbl-7560u}: [INCOMPLETE][12] ([i915#2417]) -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9432/fi-kbl-7560u/igt@debugfs_test@read_all_entries.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/fi-kbl-7560u/igt@debugfs_test@read_all_entries.html
* igt@i915_hangman@error-state-basic:
- fi-tgl-y: [DMESG-WARN][14] ([i915#402]) -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9432/fi-tgl-y/igt@i915_hangman@error-state-basic.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/fi-tgl-y/igt@i915_hangman@error-state-basic.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[i915#1037]: https://gitlab.freedesktop.org/drm/intel/issues/1037
[i915#2276]: https://gitlab.freedesktop.org/drm/intel/issues/2276
[i915#2417]: https://gitlab.freedesktop.org/drm/intel/issues/2417
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
Participating hosts (45 -> 41)
------------------------------
Missing (4): fi-ilk-m540 fi-bsw-cyan fi-bdw-samus fi-hsw-4200u
Build changes
-------------
* Linux: CI_DRM_9432 -> Patchwork_19049
CI-20190529: 20190529
CI_DRM_9432: a7ed9b96ea3d9e89190a0cd08feb99e6b3e701a9 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5878: e96c0d8e6952d892bcbbcdf004999880a4dfb42e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19049: a6642ebaca9ac86e2e2af0aacb832bbc845e1cff @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
a6642ebaca9a drm/i915/gem: Propagate error from cancelled submit due to context closure
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19049/index.html
[-- Attachment #1.2: Type: text/html, Size: 5990 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Intel-gfx] [PATCH] drm/i915/gem: Propagate error from cancelled submit due to context closure
2020-12-03 10:34 [Intel-gfx] [PATCH] drm/i915/gem: Propagate error from cancelled submit due to context closure Chris Wilson
2020-12-03 11:26 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2020-12-03 11:58 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
@ 2020-12-04 11:09 ` Tvrtko Ursulin
2 siblings, 0 replies; 4+ messages in thread
From: Tvrtko Ursulin @ 2020-12-04 11:09 UTC (permalink / raw)
To: Chris Wilson, intel-gfx; +Cc: stable
On 03/12/2020 10:34, Chris Wilson wrote:
> In the course of discovering and closing many races with context closure
> and execbuf submission, since commit 61231f6bd056 ("drm/i915/gem: Check
> that the context wasn't closed during setup") we started checking that
> the context was not closed by another userspace thread during the execbuf
> ioctl. In doing so we cancelled the inflight request (by telling it to be
> skipped), but kept reporting success since we do submit a request, albeit
> one that doesn't execute. As the error is known before we return from the
> ioctl, we can report the error we detect immediately, rather than leave
> it on the fence status. With the immediate propagation of the error, it
> is easier for userspace to handle.
>
> Fixes: 61231f6bd056 ("drm/i915/gem: Check that the context wasn't closed during setup")
> Testcase: igt/gem_ctx_exec/basic-close-race
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: <stable@vger.kernel.org> # v5.7+
> ---
> drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 1904e6e5ea64..b07dc1156a0e 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -3097,7 +3097,7 @@ static void retire_requests(struct intel_timeline *tl, struct i915_request *end)
> break;
> }
>
> -static void eb_request_add(struct i915_execbuffer *eb)
> +static int eb_request_add(struct i915_execbuffer *eb, int err)
> {
> struct i915_request *rq = eb->request;
> struct intel_timeline * const tl = i915_request_timeline(rq);
> @@ -3118,6 +3118,7 @@ static void eb_request_add(struct i915_execbuffer *eb)
> /* Serialise with context_close via the add_to_timeline */
> i915_request_set_error_once(rq, -ENOENT);
> __i915_request_skip(rq);
> + err = -ENOENT; /* override any transient errors */
> }
>
> __i915_request_queue(rq, &attr);
> @@ -3127,6 +3128,8 @@ static void eb_request_add(struct i915_execbuffer *eb)
> retire_requests(tl, prev);
>
> mutex_unlock(&tl->mutex);
> +
> + return err;
> }
>
> static const i915_user_extension_fn execbuf_extensions[] = {
> @@ -3332,7 +3335,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
> err = eb_submit(&eb, batch);
> err_request:
> i915_request_get(eb.request);
> - eb_request_add(&eb);
> + err = eb_request_add(&eb, err);
>
> if (eb.fences)
> signal_fence_array(&eb);
>
Simple enough and it explains why gem_busy assert in the IGT can fail
after execbuf succeeded - skipped request executes before the check
since the payload was zapped. Fast timing but obviously possible.
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] 4+ messages in thread
end of thread, other threads:[~2020-12-04 11:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-03 10:34 [Intel-gfx] [PATCH] drm/i915/gem: Propagate error from cancelled submit due to context closure Chris Wilson
2020-12-03 11:26 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2020-12-03 11:58 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-12-04 11:09 ` [Intel-gfx] [PATCH] " Tvrtko Ursulin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox