* [Intel-gfx] [PATCH] drm/i915/gem: Limit struct_mutex to eb_reserve
@ 2020-03-04 21:29 Chris Wilson
2020-03-05 10:42 ` Jani Nikula
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Chris Wilson @ 2020-03-04 21:29 UTC (permalink / raw)
To: intel-gfx
We only need to serialise the multiple pinning during the eb_reserve
phase. Ideally this would be using the vm->mutex as an outer lock, or
using a composite global mutex (ww_mutex), but at the moment we are
using struct_mutex for the group.
Fixes: 003d8b9143a6 ("drm/i915/gem: Only call eb_lookup_vma once during execbuf ioctl")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
.../gpu/drm/i915/gem/i915_gem_execbuffer.c | 45 ++++++++-----------
drivers/gpu/drm/i915/i915_drv.h | 6 ---
2 files changed, 19 insertions(+), 32 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 7bb27f382af7..3b35bd2eb0fc 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -610,7 +610,7 @@ static int eb_reserve(struct i915_execbuffer *eb)
struct list_head last;
struct eb_vma *ev;
unsigned int i, pass;
- int err;
+ int err = 0;
/*
* Attempt to pin all of the buffers into the GTT.
@@ -626,8 +626,9 @@ static int eb_reserve(struct i915_execbuffer *eb)
* room for the earlier objects *unless* we need to defragment.
*/
+ mutex_lock(&eb->i915->drm.struct_mutex);
+
pass = 0;
- err = 0;
do {
list_for_each_entry(ev, &eb->unbound, bind_link) {
err = eb_reserve_vma(eb, ev, pin_flags);
@@ -635,7 +636,7 @@ static int eb_reserve(struct i915_execbuffer *eb)
break;
}
if (!(err == -ENOSPC || err == -EAGAIN))
- return err;
+ break;
/* Resort *all* the objects into priority order */
INIT_LIST_HEAD(&eb->unbound);
@@ -666,7 +667,9 @@ static int eb_reserve(struct i915_execbuffer *eb)
list_splice_tail(&last, &eb->unbound);
if (err == -EAGAIN) {
+ mutex_unlock(&eb->i915->drm.struct_mutex);
flush_workqueue(eb->i915->mm.userptr_wq);
+ mutex_lock(&eb->i915->drm.struct_mutex);
continue;
}
@@ -680,15 +683,20 @@ static int eb_reserve(struct i915_execbuffer *eb)
err = i915_gem_evict_vm(eb->context->vm);
mutex_unlock(&eb->context->vm->mutex);
if (err)
- return err;
+ goto unlock;
break;
default:
- return -ENOSPC;
+ err = -ENOSPC;
+ goto unlock;
}
pin_flags = PIN_USER;
} while (1);
+
+unlock:
+ mutex_unlock(&eb->i915->drm.struct_mutex);
+ return err;
}
static unsigned int eb_batch_index(const struct i915_execbuffer *eb)
@@ -1631,7 +1639,6 @@ static int eb_prefault_relocations(const struct i915_execbuffer *eb)
static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
{
- struct drm_device *dev = &eb->i915->drm;
bool have_copy = false;
struct eb_vma *ev;
int err = 0;
@@ -1642,8 +1649,6 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
goto out;
}
- mutex_unlock(&dev->struct_mutex);
-
/*
* We take 3 passes through the slowpatch.
*
@@ -1666,20 +1671,12 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
cond_resched();
err = 0;
}
- if (err) {
- mutex_lock(&dev->struct_mutex);
+ if (err)
goto out;
- }
/* A frequent cause for EAGAIN are currently unavailable client pages */
flush_workqueue(eb->i915->mm.userptr_wq);
- err = i915_mutex_lock_interruptible(dev);
- if (err) {
- mutex_lock(&dev->struct_mutex);
- goto out;
- }
-
GEM_BUG_ON(!eb->batch);
list_for_each_entry(ev, &eb->relocs, reloc_link) {
@@ -1738,9 +1735,11 @@ static int eb_relocate(struct i915_execbuffer *eb)
if (err)
return err;
- err = eb_reserve(eb);
- if (err)
- return err;
+ if (!list_empty(&eb->unbound)) {
+ err = eb_reserve(eb);
+ if (err)
+ return err;
+ }
/* The objects are in their final locations, apply the relocations. */
if (eb->args->flags & __EXEC_HAS_RELOC) {
@@ -2690,10 +2689,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
if (unlikely(err))
goto err_context;
- err = i915_mutex_lock_interruptible(dev);
- if (err)
- goto err_engine;
-
err = eb_relocate(&eb);
if (err) {
/*
@@ -2837,8 +2832,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
eb_release_vmas(&eb);
if (eb.trampoline)
i915_vma_unpin(eb.trampoline);
- mutex_unlock(&dev->struct_mutex);
-err_engine:
eb_unpin_engine(&eb);
err_context:
i915_gem_context_put(eb.gem_context);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 123d0fadfafc..c081f4ec87df 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1734,12 +1734,6 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
void i915_gem_runtime_suspend(struct drm_i915_private *dev_priv);
-static inline int __must_check
-i915_mutex_lock_interruptible(struct drm_device *dev)
-{
- return mutex_lock_interruptible(&dev->struct_mutex);
-}
-
int i915_gem_dumb_create(struct drm_file *file_priv,
struct drm_device *dev,
struct drm_mode_create_dumb *args);
--
2.25.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
* Re: [Intel-gfx] [PATCH] drm/i915/gem: Limit struct_mutex to eb_reserve
2020-03-04 21:29 [Intel-gfx] [PATCH] drm/i915/gem: Limit struct_mutex to eb_reserve Chris Wilson
@ 2020-03-05 10:42 ` Jani Nikula
2020-03-05 12:38 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for " Patchwork
2020-03-05 12:49 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2020-03-05 10:42 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On Wed, 04 Mar 2020, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> drivers/gpu/drm/i915/i915_drv.h | 6 ---
Immediately looks like a good patch!
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
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
* [Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915/gem: Limit struct_mutex to eb_reserve
2020-03-04 21:29 [Intel-gfx] [PATCH] drm/i915/gem: Limit struct_mutex to eb_reserve Chris Wilson
2020-03-05 10:42 ` Jani Nikula
@ 2020-03-05 12:38 ` Patchwork
2020-03-05 12:49 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2020-03-05 12:38 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/gem: Limit struct_mutex to eb_reserve
URL : https://patchwork.freedesktop.org/series/74291/
State : warning
== Summary ==
$ make htmldocs 2>&1 > /dev/null | grep i915
./drivers/gpu/drm/i915/display/intel_dpll_mgr.h:285: warning: Function parameter or member 'get_freq' not described in 'intel_shared_dpll_funcs'
_______________________________________________
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
* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gem: Limit struct_mutex to eb_reserve
2020-03-04 21:29 [Intel-gfx] [PATCH] drm/i915/gem: Limit struct_mutex to eb_reserve Chris Wilson
2020-03-05 10:42 ` Jani Nikula
2020-03-05 12:38 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for " Patchwork
@ 2020-03-05 12:49 ` Patchwork
2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2020-03-05 12:49 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/gem: Limit struct_mutex to eb_reserve
URL : https://patchwork.freedesktop.org/series/74291/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_8068 -> Patchwork_16828
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_16828 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_16828, 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_16828/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_16828:
### IGT changes ###
#### Possible regressions ####
* igt@gem_exec_parallel@basic:
- fi-skl-6700k2: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-skl-6700k2/igt@gem_exec_parallel@basic.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-skl-6700k2/igt@gem_exec_parallel@basic.html
* igt@gem_exec_parallel@contexts:
- fi-skl-guc: [PASS][3] -> [TIMEOUT][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-skl-guc/igt@gem_exec_parallel@contexts.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-skl-guc/igt@gem_exec_parallel@contexts.html
- fi-icl-dsi: [PASS][5] -> [TIMEOUT][6] +9 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-icl-dsi/igt@gem_exec_parallel@contexts.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-icl-dsi/igt@gem_exec_parallel@contexts.html
- fi-skl-6600u: [PASS][7] -> [TIMEOUT][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-skl-6600u/igt@gem_exec_parallel@contexts.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-skl-6600u/igt@gem_exec_parallel@contexts.html
- fi-skl-6770hq: [PASS][9] -> [INCOMPLETE][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-skl-6770hq/igt@gem_exec_parallel@contexts.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-skl-6770hq/igt@gem_exec_parallel@contexts.html
* igt@gem_exec_parallel@fds:
- fi-cml-s: [PASS][11] -> [TIMEOUT][12] +8 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-cml-s/igt@gem_exec_parallel@fds.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-cml-s/igt@gem_exec_parallel@fds.html
- fi-cfl-guc: [PASS][13] -> [TIMEOUT][14] +9 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-cfl-guc/igt@gem_exec_parallel@fds.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-cfl-guc/igt@gem_exec_parallel@fds.html
- fi-skl-lmem: [PASS][15] -> [TIMEOUT][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-skl-lmem/igt@gem_exec_parallel@fds.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-skl-lmem/igt@gem_exec_parallel@fds.html
* igt@gem_exec_store@basic-all:
- fi-cfl-8109u: [PASS][17] -> [TIMEOUT][18] +8 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-cfl-8109u/igt@gem_exec_store@basic-all.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-cfl-8109u/igt@gem_exec_store@basic-all.html
- fi-kbl-x1275: [PASS][19] -> [TIMEOUT][20] +8 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-kbl-x1275/igt@gem_exec_store@basic-all.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-kbl-x1275/igt@gem_exec_store@basic-all.html
- fi-icl-y: [PASS][21] -> [TIMEOUT][22] +8 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-icl-y/igt@gem_exec_store@basic-all.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-icl-y/igt@gem_exec_store@basic-all.html
* igt@gem_exec_suspend@basic:
- fi-icl-u2: [PASS][23] -> [TIMEOUT][24] +9 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-icl-u2/igt@gem_exec_suspend@basic.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-icl-u2/igt@gem_exec_suspend@basic.html
* igt@gem_exec_suspend@basic-s0:
- fi-cml-u2: [PASS][25] -> [TIMEOUT][26] +8 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-cml-u2/igt@gem_exec_suspend@basic-s0.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-cml-u2/igt@gem_exec_suspend@basic-s0.html
- fi-kbl-r: [PASS][27] -> [TIMEOUT][28] +9 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-kbl-r/igt@gem_exec_suspend@basic-s0.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-kbl-r/igt@gem_exec_suspend@basic-s0.html
* igt@gem_exec_suspend@basic-s3:
- fi-kbl-guc: [PASS][29] -> [TIMEOUT][30] +8 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-kbl-guc/igt@gem_exec_suspend@basic-s3.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-kbl-guc/igt@gem_exec_suspend@basic-s3.html
- fi-kbl-8809g: [PASS][31] -> [TIMEOUT][32] +8 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-kbl-8809g/igt@gem_exec_suspend@basic-s3.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-kbl-8809g/igt@gem_exec_suspend@basic-s3.html
- fi-bdw-5557u: [PASS][33] -> [TIMEOUT][34] +8 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-bdw-5557u/igt@gem_exec_suspend@basic-s3.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-bdw-5557u/igt@gem_exec_suspend@basic-s3.html
* igt@gem_exec_suspend@basic-s4-devices:
- fi-icl-guc: [PASS][35] -> [TIMEOUT][36] +9 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-icl-guc/igt@gem_exec_suspend@basic-s4-devices.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-icl-guc/igt@gem_exec_suspend@basic-s4-devices.html
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses.
They do not affect the overall result.
* igt@gem_exec_parallel@basic:
- {fi-tgl-u}: [PASS][37] -> [INCOMPLETE][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-tgl-u/igt@gem_exec_parallel@basic.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-tgl-u/igt@gem_exec_parallel@basic.html
* igt@gem_exec_parallel@fds:
- {fi-kbl-7560u}: [PASS][39] -> [TIMEOUT][40] +9 similar issues
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-kbl-7560u/igt@gem_exec_parallel@fds.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-kbl-7560u/igt@gem_exec_parallel@fds.html
Known issues
------------
Here are the changes found in Patchwork_16828 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@fbdev@mmap:
- fi-skl-6770hq: [PASS][41] -> [SKIP][42] ([fdo#109271])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-skl-6770hq/igt@fbdev@mmap.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-skl-6770hq/igt@fbdev@mmap.html
* igt@gem_exec_parallel@fds:
- fi-skl-guc: [PASS][43] -> [TIMEOUT][44] ([i915#1084]) +7 similar issues
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-skl-guc/igt@gem_exec_parallel@fds.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-skl-guc/igt@gem_exec_parallel@fds.html
* igt@gem_exec_store@basic-all:
- fi-skl-6600u: [PASS][45] -> [TIMEOUT][46] ([i915#1084]) +8 similar issues
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-skl-6600u/igt@gem_exec_store@basic-all.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-skl-6600u/igt@gem_exec_store@basic-all.html
* igt@gem_exec_suspend@basic-s0:
- fi-skl-lmem: [PASS][47] -> [TIMEOUT][48] ([i915#1084]) +8 similar issues
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-skl-lmem/igt@gem_exec_suspend@basic-s0.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-skl-lmem/igt@gem_exec_suspend@basic-s0.html
* igt@gem_exec_suspend@basic-s4-devices:
- fi-tgl-y: [PASS][49] -> [FAIL][50] ([CI#94])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-tgl-y/igt@gem_exec_suspend@basic-s4-devices.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-tgl-y/igt@gem_exec_suspend@basic-s4-devices.html
* igt@gem_mmap_gtt@basic:
- fi-tgl-y: [PASS][51] -> [DMESG-WARN][52] ([CI#94] / [i915#402]) +1 similar issue
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-tgl-y/igt@gem_mmap_gtt@basic.html
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-tgl-y/igt@gem_mmap_gtt@basic.html
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [PASS][53] -> [FAIL][54] ([fdo#111407])
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
#### Possible fixes ####
* igt@i915_getparams_basic@basic-eu-total:
- fi-tgl-y: [DMESG-WARN][55] ([CI#94] / [i915#402]) -> [PASS][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-tgl-y/igt@i915_getparams_basic@basic-eu-total.html
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-tgl-y/igt@i915_getparams_basic@basic-eu-total.html
* igt@i915_selftest@live@gem_contexts:
- fi-cfl-8700k: [INCOMPLETE][57] ([i915#424]) -> [PASS][58]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8068/fi-cfl-8700k/igt@i915_selftest@live@gem_contexts.html
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/fi-cfl-8700k/igt@i915_selftest@live@gem_contexts.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[CI#94]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/94
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
[i915#1084]: https://gitlab.freedesktop.org/drm/intel/issues/1084
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#424]: https://gitlab.freedesktop.org/drm/intel/issues/424
Participating hosts (52 -> 45)
------------------------------
Additional (1): fi-gdg-551
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-bsw-n3050 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_8068 -> Patchwork_16828
CI-20190529: 20190529
CI_DRM_8068: f8e69af5cca45947ebce78f677b75b0ecc4ba744 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5492: 2be153507cdd652843f6ab44cc2a52a7f30206d9 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16828: 116d07e2ebcb119bf64ca2f52acec5ab395d07ec @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
116d07e2ebcb drm/i915/gem: Limit struct_mutex to eb_reserve
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16828/index.html
_______________________________________________
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
* [Intel-gfx] [PATCH] drm/i915/gem: Limit struct_mutex to eb_reserve
@ 2020-03-05 14:02 Chris Wilson
2020-03-05 15:51 ` Mika Kuoppala
0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2020-03-05 14:02 UTC (permalink / raw)
To: intel-gfx
We only need to serialise the multiple pinning during the eb_reserve
phase. Ideally this would be using the vm->mutex as an outer lock, or
using a composite global mutex (ww_mutex), but at the moment we are
using struct_mutex for the group.
Fixes: 003d8b9143a6 ("drm/i915/gem: Only call eb_lookup_vma once during execbuf ioctl")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
.../gpu/drm/i915/gem/i915_gem_execbuffer.c | 51 ++++++++-----------
drivers/gpu/drm/i915/i915_drv.h | 6 ---
2 files changed, 20 insertions(+), 37 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 7bb27f382af7..faa5b5c99a9a 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -610,7 +610,7 @@ static int eb_reserve(struct i915_execbuffer *eb)
struct list_head last;
struct eb_vma *ev;
unsigned int i, pass;
- int err;
+ int err = 0;
/*
* Attempt to pin all of the buffers into the GTT.
@@ -626,8 +626,10 @@ static int eb_reserve(struct i915_execbuffer *eb)
* room for the earlier objects *unless* we need to defragment.
*/
+ if (mutex_lock_interruptible(&eb->i915->drm.struct_mutex))
+ return -EINTR;
+
pass = 0;
- err = 0;
do {
list_for_each_entry(ev, &eb->unbound, bind_link) {
err = eb_reserve_vma(eb, ev, pin_flags);
@@ -635,7 +637,7 @@ static int eb_reserve(struct i915_execbuffer *eb)
break;
}
if (!(err == -ENOSPC || err == -EAGAIN))
- return err;
+ break;
/* Resort *all* the objects into priority order */
INIT_LIST_HEAD(&eb->unbound);
@@ -666,7 +668,9 @@ static int eb_reserve(struct i915_execbuffer *eb)
list_splice_tail(&last, &eb->unbound);
if (err == -EAGAIN) {
+ mutex_unlock(&eb->i915->drm.struct_mutex);
flush_workqueue(eb->i915->mm.userptr_wq);
+ mutex_lock(&eb->i915->drm.struct_mutex);
continue;
}
@@ -680,15 +684,20 @@ static int eb_reserve(struct i915_execbuffer *eb)
err = i915_gem_evict_vm(eb->context->vm);
mutex_unlock(&eb->context->vm->mutex);
if (err)
- return err;
+ goto unlock;
break;
default:
- return -ENOSPC;
+ err = -ENOSPC;
+ goto unlock;
}
pin_flags = PIN_USER;
} while (1);
+
+unlock:
+ mutex_unlock(&eb->i915->drm.struct_mutex);
+ return err;
}
static unsigned int eb_batch_index(const struct i915_execbuffer *eb)
@@ -1631,7 +1640,6 @@ static int eb_prefault_relocations(const struct i915_execbuffer *eb)
static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
{
- struct drm_device *dev = &eb->i915->drm;
bool have_copy = false;
struct eb_vma *ev;
int err = 0;
@@ -1642,8 +1650,6 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
goto out;
}
- mutex_unlock(&dev->struct_mutex);
-
/*
* We take 3 passes through the slowpatch.
*
@@ -1666,21 +1672,8 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
cond_resched();
err = 0;
}
- if (err) {
- mutex_lock(&dev->struct_mutex);
- goto out;
- }
-
- /* A frequent cause for EAGAIN are currently unavailable client pages */
- flush_workqueue(eb->i915->mm.userptr_wq);
-
- err = i915_mutex_lock_interruptible(dev);
- if (err) {
- mutex_lock(&dev->struct_mutex);
+ if (err)
goto out;
- }
-
- GEM_BUG_ON(!eb->batch);
list_for_each_entry(ev, &eb->relocs, reloc_link) {
if (!have_copy) {
@@ -1738,9 +1731,11 @@ static int eb_relocate(struct i915_execbuffer *eb)
if (err)
return err;
- err = eb_reserve(eb);
- if (err)
- return err;
+ if (!list_empty(&eb->unbound)) {
+ err = eb_reserve(eb);
+ if (err)
+ return err;
+ }
/* The objects are in their final locations, apply the relocations. */
if (eb->args->flags & __EXEC_HAS_RELOC) {
@@ -2690,10 +2685,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
if (unlikely(err))
goto err_context;
- err = i915_mutex_lock_interruptible(dev);
- if (err)
- goto err_engine;
-
err = eb_relocate(&eb);
if (err) {
/*
@@ -2837,8 +2828,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
eb_release_vmas(&eb);
if (eb.trampoline)
i915_vma_unpin(eb.trampoline);
- mutex_unlock(&dev->struct_mutex);
-err_engine:
eb_unpin_engine(&eb);
err_context:
i915_gem_context_put(eb.gem_context);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 123d0fadfafc..c081f4ec87df 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1734,12 +1734,6 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
void i915_gem_runtime_suspend(struct drm_i915_private *dev_priv);
-static inline int __must_check
-i915_mutex_lock_interruptible(struct drm_device *dev)
-{
- return mutex_lock_interruptible(&dev->struct_mutex);
-}
-
int i915_gem_dumb_create(struct drm_file *file_priv,
struct drm_device *dev,
struct drm_mode_create_dumb *args);
--
2.25.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
* Re: [Intel-gfx] [PATCH] drm/i915/gem: Limit struct_mutex to eb_reserve
2020-03-05 14:02 [Intel-gfx] [PATCH] " Chris Wilson
@ 2020-03-05 15:51 ` Mika Kuoppala
0 siblings, 0 replies; 6+ messages in thread
From: Mika Kuoppala @ 2020-03-05 15:51 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
Chris Wilson <chris@chris-wilson.co.uk> writes:
> We only need to serialise the multiple pinning during the eb_reserve
> phase. Ideally this would be using the vm->mutex as an outer lock, or
> using a composite global mutex (ww_mutex), but at the moment we are
> using struct_mutex for the group.
>
> Fixes: 003d8b9143a6 ("drm/i915/gem: Only call eb_lookup_vma once during execbuf ioctl")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 51 ++++++++-----------
> drivers/gpu/drm/i915/i915_drv.h | 6 ---
> 2 files changed, 20 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 7bb27f382af7..faa5b5c99a9a 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -610,7 +610,7 @@ static int eb_reserve(struct i915_execbuffer *eb)
> struct list_head last;
> struct eb_vma *ev;
> unsigned int i, pass;
> - int err;
> + int err = 0;
>
> /*
> * Attempt to pin all of the buffers into the GTT.
> @@ -626,8 +626,10 @@ static int eb_reserve(struct i915_execbuffer *eb)
> * room for the earlier objects *unless* we need to defragment.
> */
>
> + if (mutex_lock_interruptible(&eb->i915->drm.struct_mutex))
> + return -EINTR;
> +
> pass = 0;
> - err = 0;
> do {
> list_for_each_entry(ev, &eb->unbound, bind_link) {
> err = eb_reserve_vma(eb, ev, pin_flags);
> @@ -635,7 +637,7 @@ static int eb_reserve(struct i915_execbuffer *eb)
> break;
> }
> if (!(err == -ENOSPC || err == -EAGAIN))
> - return err;
> + break;
>
> /* Resort *all* the objects into priority order */
> INIT_LIST_HEAD(&eb->unbound);
> @@ -666,7 +668,9 @@ static int eb_reserve(struct i915_execbuffer *eb)
> list_splice_tail(&last, &eb->unbound);
>
> if (err == -EAGAIN) {
> + mutex_unlock(&eb->i915->drm.struct_mutex);
> flush_workqueue(eb->i915->mm.userptr_wq);
> + mutex_lock(&eb->i915->drm.struct_mutex);
General curiousity of what mechanism prevents the possible jail of -EAGAIN
looping?
For the fix tho,
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> continue;
> }
>
> @@ -680,15 +684,20 @@ static int eb_reserve(struct i915_execbuffer *eb)
> err = i915_gem_evict_vm(eb->context->vm);
> mutex_unlock(&eb->context->vm->mutex);
> if (err)
> - return err;
> + goto unlock;
> break;
>
> default:
> - return -ENOSPC;
> + err = -ENOSPC;
> + goto unlock;
> }
>
> pin_flags = PIN_USER;
> } while (1);
> +
> +unlock:
> + mutex_unlock(&eb->i915->drm.struct_mutex);
> + return err;
> }
>
> static unsigned int eb_batch_index(const struct i915_execbuffer *eb)
> @@ -1631,7 +1640,6 @@ static int eb_prefault_relocations(const struct i915_execbuffer *eb)
>
> static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
> {
> - struct drm_device *dev = &eb->i915->drm;
> bool have_copy = false;
> struct eb_vma *ev;
> int err = 0;
> @@ -1642,8 +1650,6 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
> goto out;
> }
>
> - mutex_unlock(&dev->struct_mutex);
> -
> /*
> * We take 3 passes through the slowpatch.
> *
> @@ -1666,21 +1672,8 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)
> cond_resched();
> err = 0;
> }
> - if (err) {
> - mutex_lock(&dev->struct_mutex);
> - goto out;
> - }
> -
> - /* A frequent cause for EAGAIN are currently unavailable client pages */
> - flush_workqueue(eb->i915->mm.userptr_wq);
> -
> - err = i915_mutex_lock_interruptible(dev);
> - if (err) {
> - mutex_lock(&dev->struct_mutex);
> + if (err)
> goto out;
> - }
> -
> - GEM_BUG_ON(!eb->batch);
>
> list_for_each_entry(ev, &eb->relocs, reloc_link) {
> if (!have_copy) {
> @@ -1738,9 +1731,11 @@ static int eb_relocate(struct i915_execbuffer *eb)
> if (err)
> return err;
>
> - err = eb_reserve(eb);
> - if (err)
> - return err;
> + if (!list_empty(&eb->unbound)) {
> + err = eb_reserve(eb);
> + if (err)
> + return err;
> + }
>
> /* The objects are in their final locations, apply the relocations. */
> if (eb->args->flags & __EXEC_HAS_RELOC) {
> @@ -2690,10 +2685,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
> if (unlikely(err))
> goto err_context;
>
> - err = i915_mutex_lock_interruptible(dev);
> - if (err)
> - goto err_engine;
> -
> err = eb_relocate(&eb);
> if (err) {
> /*
> @@ -2837,8 +2828,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
> eb_release_vmas(&eb);
> if (eb.trampoline)
> i915_vma_unpin(eb.trampoline);
> - mutex_unlock(&dev->struct_mutex);
> -err_engine:
> eb_unpin_engine(&eb);
> err_context:
> i915_gem_context_put(eb.gem_context);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 123d0fadfafc..c081f4ec87df 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1734,12 +1734,6 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
>
> void i915_gem_runtime_suspend(struct drm_i915_private *dev_priv);
>
> -static inline int __must_check
> -i915_mutex_lock_interruptible(struct drm_device *dev)
> -{
> - return mutex_lock_interruptible(&dev->struct_mutex);
> -}
> -
> int i915_gem_dumb_create(struct drm_file *file_priv,
> struct drm_device *dev,
> struct drm_mode_create_dumb *args);
> --
> 2.25.1
_______________________________________________
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
end of thread, other threads:[~2020-03-05 16:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-04 21:29 [Intel-gfx] [PATCH] drm/i915/gem: Limit struct_mutex to eb_reserve Chris Wilson
2020-03-05 10:42 ` Jani Nikula
2020-03-05 12:38 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for " Patchwork
2020-03-05 12:49 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2020-03-05 14:02 [Intel-gfx] [PATCH] " Chris Wilson
2020-03-05 15:51 ` Mika Kuoppala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox