tests/i915/gem_ppgtt: verify GTT eviction with contended locks
PATCH v2 1/1 tests/i915/gem_ppgtt: verify GTT eviction with contended locks
We should still be able to GTT evict objects during execbuf (old bindings can linger around), even if there is object lock contention. In the worst case the execbuf should just wait on the contented locks. Returning -ENOSPC smells like a regression from past behaviour, and seems to break userspace.
v2:
- Add coverage for explicit softpin
- Add timeout for the spinner
References: https://gitlab.freedesktop.org/drm/intel/-/issues/7570
--- tests/i915/gem_ppgtt.c | 120 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+)
tests/i915/gem_ppgtt.c +120 -0
@@ -255,6 +255,118 @@ static void flink_and_close(void)close (fd2); } +#define PAGE_SIZE 4096 + +static uint32_t batch_create_size (int fd,uint64_t size) +{ +const uint32_t bbe =MI_BATCH_BUFFER_END ; +uint32_t handle; + + handle =gem_create (fd, size); +gem_write (fd, handle,0 , &bbe,sizeof (bbe)); + +return handle; +} + +#define IGT_USE_ANY 0x1 +#define IGT_USE_PINNED 0x2 +static void upload (int fd,uint32_t handle,uint32_t in_fence,uint32_t ctx_id, +unsigned int flags) +{ +struct drm_i915_gem_exec_object2 exec[2 ] = {}; +struct drm_i915_gem_execbuffer2 execbuf = { + .buffers_ptr =to_user_pointer (&exec), + .buffer_count =1 , + .rsvd1 = ctx_id, + }; + +if (in_fence) { + execbuf.rsvd2 = in_fence; + execbuf.flags =I915_EXEC_FENCE_IN ; + } + + exec[0 ].handle = handle; + exec[0 ].flags =EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; + +if (flags &IGT_USE_PINNED ) + exec[0 ].flags |=EXEC_OBJECT_PINNED ;/* offset = 0 */ + +if (flags &IGT_USE_ANY ) { + exec[0 ].flags |=EXEC_OBJECT_PAD_TO_SIZE ; + exec[0 ].pad_to_size =gem_aperture_size (fd); + } + +gem_execbuf (fd, &execbuf); +} + +static void shrink_vs_evict (unsigned int flags) +{ +const unsigned int nproc =sysconf (_SC_NPROCESSORS_ONLN) +1 ; +const uint64_t timeout_5s =5000000000LL ; +int fd =drm_open_driver (DRIVER_INTEL ); +uint64_t ahnd =get_reloc_ahnd (fd,0 ); +const intel_ctx_t *ctx_arr[nproc]; +igt_spin_t *spinner; +uint32_t handle1; +int i; + +igt_require (gem_uses_full_ppgtt (fd)); + +igt_drop_caches_set (fd,DROP_ALL ); + + handle1 =gem_create (fd,PAGE_SIZE ); + + spinner = igt_spin_new(fd, + .ahnd = ahnd, + .flags =IGT_SPIN_FENCE_OUT ); +igt_spin_set_timeout (spinner, timeout_5s); + +/* +* Create several VMs to ensure we don't block on the same vm lock. The +* goal of the test is to ensure that object lock contention doesn't +* somehow result in -ENOSPC from execbuf, if we need to trigger GTT +* eviction. +*/ +for (i =0 ; i < nproc; i++) { + ctx_arr[i] =intel_ctx_create (fd,NULL ); + +upload (fd, handle1, spinner->execbuf.rsvd2 >>32 , + ctx_arr[i]->id, flags); + } + + igt_fork(child, 1) +igt_drop_caches_set (fd,DROP_ALL ); + +sleep (2 );/* Give the shrinker time to find handle1 */ + + igt_fork(child, nproc) { +uint32_t handle2 =gem_create (fd,PAGE_SIZE ); + +/* +* One of these forks will be stuck on the vm mutex, since the +* shrinker is holding it (along with the object lock) while +* trying to unbind the chosen vma, but is blocked by the +* spinner. The rest should only block waiting to grab the +* object lock for handle1, before then trying to GTT evict it +* from their respective vm. In either case the contention of +* the vm->mutex or object lock should never result in -ENOSPC +* or some other error. +*/ + handle2 =batch_create_size (fd,PAGE_SIZE ); + +upload (fd, handle2,0 , ctx_arr[child]->id, flags); +gem_close (fd, handle2); + } + +igt_waitchildren (); +igt_spin_free (fd, spinner); + +for (i =0 ; i < nproc; i++) +intel_ctx_destroy (fd, ctx_arr[i]); + +gem_close (fd, handle1); +} +static bool has_contexts (void ) {bool result;
@@ -331,4 +443,12 @@ igt_main igt_subtest("flink-and-close-vma-leak")flink_and_close (); + +igt_describe ("Verify GTT eviction can't randomly fail due to object lock contention" ); + igt_subtest_group { + igt_subtest("shrink-vs-evict-any") +shrink_vs_evict (IGT_USE_ANY ); + igt_subtest("shrink-vs-evict-pinned") +shrink_vs_evict (IGT_USE_PINNED ); + } }
Signature · 1 line
2.38.1
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for tests/i915/gem_ppgtt: verify GTT eviction with contended locks
== Series Details ==
== Series Details ==
Series: tests/i915/gem_ppgtt: verify GTT eviction with contended locks
URL : https://patchwork.freedesktop.org/series/111267/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_12424 -> IGTPW_8146
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/index.html
Participating hosts (37 -> 38)
------------------------------
Additional (3): fi-icl-u2 fi-tgl-dsi bat-dg1-6
Missing (2): fi-ctg-p8600 fi-ilk-m540
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_8146:
### IGT changes ###
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@i915_selftest@live@hangcheck:
- {bat-dg2-11}: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/bat-dg2-11/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg2-11/igt@i915_selftest@[email protected]
Known issues
------------
Here are the changes found in IGTPW_8146 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@debugfs_test@basic-hwmon:
- fi-icl-u2: NOTRUN -> [SKIP][3] ([i915#7456])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-icl-u2/igt@[email protected]
* igt@gem_huc_copy@huc-copy:
- fi-icl-u2: NOTRUN -> [SKIP][4] ([i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-icl-u2/igt@[email protected]
* igt@gem_lmem_swapping@random-engines:
- fi-icl-u2: NOTRUN -> [SKIP][5] ([i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-icl-u2/igt@[email protected]
* igt@gem_mmap@basic:
- bat-dg1-6: NOTRUN -> [SKIP][6] ([i915#4083])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@gem_render_tiled_blits@basic:
- bat-dg1-6: NOTRUN -> [SKIP][7] ([i915#4079]) +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@gem_tiled_fence_blits@basic:
- bat-dg1-6: NOTRUN -> [SKIP][8] ([i915#4077]) +2 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@i915_pm_backlight@basic-brightness:
- bat-dg1-6: NOTRUN -> [SKIP][9] ([i915#7561])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@i915_pm_rps@basic-api:
- bat-dg1-6: NOTRUN -> [SKIP][10] ([i915#6621])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@i915_selftest@live@migrate:
- bat-adlp-4: [PASS][11] -> [INCOMPLETE][12] ([i915#7308] / [i915#7348])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/bat-adlp-4/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-adlp-4/igt@i915_selftest@[email protected]
* igt@i915_suspend@basic-s2idle-without-i915:
- fi-bdw-gvtdvm: NOTRUN -> [INCOMPLETE][13] ([i915#146])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-bdw-gvtdvm/igt@[email protected]
* igt@i915_suspend@basic-s3-without-i915:
- fi-rkl-11600: [PASS][14] -> [INCOMPLETE][15] ([i915#4817])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/fi-rkl-11600/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-rkl-11600/igt@[email protected]
* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg1-6: NOTRUN -> [SKIP][16] ([i915#4215])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@kms_addfb_basic@tile-pitch-mismatch:
- bat-dg1-6: NOTRUN -> [SKIP][17] ([i915#4212]) +7 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@kms_chamelium@common-hpd-after-suspend:
- bat-dg1-5: NOTRUN -> [SKIP][18] ([fdo#111827])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-5/igt@[email protected]
* igt@kms_chamelium@hdmi-crc-fast:
- bat-dg1-6: NOTRUN -> [SKIP][19] ([fdo#111827]) +8 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-icl-u2: NOTRUN -> [SKIP][20] ([fdo#111827]) +8 similar issues
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-icl-u2/igt@[email protected]
- fi-bdw-gvtdvm: NOTRUN -> [SKIP][21] ([fdo#109271] / [fdo#111827]) +7 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-bdw-gvtdvm/igt@[email protected]
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor:
- fi-icl-u2: NOTRUN -> [SKIP][22] ([i915#4103])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-icl-u2/igt@[email protected]
- bat-dg1-6: NOTRUN -> [SKIP][23] ([i915#4103] / [i915#4213])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size:
- fi-bsw-kefka: [PASS][24] -> [FAIL][25] ([i915#6298])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html
* igt@kms_flip@basic-plain-flip:
- fi-bdw-gvtdvm: NOTRUN -> [SKIP][26] ([fdo#109271]) +31 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-bdw-gvtdvm/igt@[email protected]
* igt@kms_force_connector_basic@force-load-detect:
- fi-icl-u2: NOTRUN -> [SKIP][27] ([fdo#109285])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-icl-u2/igt@[email protected]
- bat-dg1-6: NOTRUN -> [SKIP][28] ([fdo#109285])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@kms_psr@sprite_plane_onoff:
- bat-dg1-6: NOTRUN -> [SKIP][29] ([i915#1072] / [i915#4078]) +3 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@kms_psr@sprite_plane_onoff.html
* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg1-6: NOTRUN -> [SKIP][30] ([i915#3555])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][31] ([i915#3555])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-icl-u2/igt@[email protected]
* igt@prime_vgem@basic-gtt:
- bat-dg1-6: NOTRUN -> [SKIP][32] ([i915#3708] / [i915#4077]) +1 similar issue
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@prime_vgem@basic-read:
- bat-dg1-6: NOTRUN -> [SKIP][33] ([i915#3708]) +3 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@prime_vgem@basic-userptr:
- fi-icl-u2: NOTRUN -> [SKIP][34] ([fdo#109295] / [i915#3301])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-icl-u2/igt@[email protected]
- bat-dg1-6: NOTRUN -> [SKIP][35] ([i915#3708] / [i915#4873])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-6/igt@[email protected]
* igt@runner@aborted:
- bat-adlp-4: NOTRUN -> [FAIL][36] ([i915#4312])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-adlp-4/igt@[email protected]
- fi-pnv-d510: NOTRUN -> [FAIL][37] ([i915#4312])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-pnv-d510/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_parallel@engines@contexts:
- fi-bdw-gvtdvm: [INCOMPLETE][38] ([i915#7506]) -> [PASS][39]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/fi-bdw-gvtdvm/igt@gem_exec_parallel@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-bdw-gvtdvm/igt@gem_exec_parallel@[email protected]
* igt@gem_exec_suspend@basic-s3@smem:
- {bat-rplp-1}: [DMESG-WARN][40] ([i915#2867]) -> [PASS][41]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/bat-rplp-1/igt@gem_exec_suspend@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-rplp-1/igt@gem_exec_suspend@[email protected]
* igt@i915_selftest@live@gt_heartbeat:
- fi-apl-guc: [DMESG-FAIL][42] ([i915#5334]) -> [PASS][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
* igt@i915_selftest@live@gt_lrc:
- bat-dg1-5: [INCOMPLETE][44] -> [PASS][45]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/bat-dg1-5/igt@i915_selftest@live@gt_lrc.html
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-dg1-5/igt@i915_selftest@live@gt_lrc.html
- {bat-rpls-1}: [INCOMPLETE][46] ([i915#4983]) -> [PASS][47]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/bat-rpls-1/igt@i915_selftest@live@gt_lrc.html
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/bat-rpls-1/igt@i915_selftest@live@gt_lrc.html
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions:
- fi-bsw-kefka: [FAIL][48] ([i915#6298]) -> [PASS][49]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12424/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#146]: https://gitlab.freedesktop.org/drm/intel/issues/146
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2411]: https://gitlab.freedesktop.org/drm/intel/issues/2411
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4817]: https://gitlab.freedesktop.org/drm/intel/issues/4817
[i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6856]: https://gitlab.freedesktop.org/drm/intel/issues/6856
[i915#7125]: https://gitlab.freedesktop.org/drm/intel/issues/7125
[i915#7308]: https://gitlab.freedesktop.org/drm/intel/issues/7308
[i915#7348]: https://gitlab.freedesktop.org/drm/intel/issues/7348
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7506]: https://gitlab.freedesktop.org/drm/intel/issues/7506
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7072 -> IGTPW_8146
CI-20190529: 20190529
CI_DRM_12424: c8b2ce6e20662ef30130e65f473b1ff5362765e3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8146: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/index.html
IGT_7072: 69ba7163475925cdc69aebbdfa0e87453ae165c7 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Testlist changes
----------------
+igt@gem_ppgtt@shrink-vs-evict-any
+igt@gem_ppgtt@shrink-vs-evict-pinned
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8146/index.html