Skip to contentSkip to conversation

drm/i915: Document locking guidelines

PATCH In review Joonas Lahtinen 4 participants 7 messages Aug 30, 2019 – May 14, 2020

Subsystems (4)
lore
Share & tools
lore

Joonas Lahtinen

author maintainer
#0 lore raw

PATCH 1/1 drm/i915: Document locking guidelines

To ensure cross-driver locking compatibility, document the expected guidelines for implementing the GEM locking in i915. Note that this is a description of how things should end up after being reworked, and does not reflect the current state of things.

---
 Documentation/gpu/i915.rst | 45 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
Documentation/gpu/i915.rst +45 -0
index e249ea7b0ec7..63a72d10f2c7 100644
@@ -320,6 +320,51 @@ for execution also include a list of all locations within buffers that
 refer to GPU-addresses so that the kernel can edit the buffer correctly.
 This process is dubbed relocation.
 
+Locking Guidelines
+------------------
+
+**NOTE:** This is a description of how the locking should be after
+refactoring is done. Does not necessarily reflect what the locking
+looks like while WIP.
+
+#. All locking rules and interface contracts with cross-driver interfaces
+   (dma-buf, dma_fence) need to be followed.
+
+#. No struct_mutex anywhere in the code
+
+#. dma_resv will be the outermost lock (when needed) and ww_acquire_ctx
+   is to be hoisted at highest level and passed down within i915_gem_ctx
+   in the call chain
+
+#. While holding lru/memory manager (buddy, drm_mm, whatever) locks
+   system memory allocations are not allowed
+
+	* Enforce this by priming lockdep (with fs_reclaim). If we
+	  allocate memory while holding these looks we get a rehash
+	  of the shrinker vs. struct_mutex saga, and that would be
+	  real bad.
+
+#. Do not nest different lru/memory manager locks within each other.
+   Take them in turn to update memory allocations, relying on the object’s
+   dma_resv ww_mutex to serialize against other operations.
+
+#. The suggestion for lru/memory managers locks is that they are small
+   enough to be spinlocks.
+
+#. All features need to come with exhaustive kernel selftests and/or
+   IGT tests when appropriate
+
+#. All LMEM uAPI paths need to be fully restartable (_interruptible()
+   for all locks/waits/sleeps)
+
+	* Error handling validation through signal injection.
+	  Still the best strategy we have for validating GEM uAPI
+          corner cases.
+	  Must be excessively used in the IGT, and we need to check
+	  that we really have full path coverage of all error cases.
+
+	* -EDEADLK handling with ww_mutex
+
 GEM BO Management Implementation Details
 ----------------------------------------
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915: Document locking guidelines

== Series Details ==

== Series Details ==

Series: drm/i915: Document locking guidelines
URL : https://patchwork.freedesktop.org/series/66052/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6807 -> Patchwork_14236
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/

Known issues
------------

Here are the changes found in Patchwork_14236 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s4-devices:
- fi-kbl-8809g: [PASS][1] -> [INCOMPLETE][2] ([fdo#103665] / [fdo#107139] / [fdo#108126])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/fi-kbl-8809g/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/fi-kbl-8809g/igt@[email protected]

* igt@i915_selftest@live_gtt:
- fi-glk-dsi: [PASS][3] -> [DMESG-WARN][4] ([fdo#110788])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/fi-glk-dsi/igt@i915_selftest@live_gtt.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/fi-glk-dsi/igt@i915_selftest@live_gtt.html

* igt@i915_selftest@live_reset:
- fi-bsw-n3050: [PASS][5] -> [DMESG-WARN][6] ([fdo#107709])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/fi-bsw-n3050/igt@i915_selftest@live_reset.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/fi-bsw-n3050/igt@i915_selftest@live_reset.html

#### Possible fixes ####

* igt@i915_selftest@live_execlists:
- fi-skl-gvtdvm: [DMESG-FAIL][7] ([fdo#111108]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/fi-skl-gvtdvm/igt@i915_selftest@live_execlists.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/fi-skl-gvtdvm/igt@i915_selftest@live_execlists.html

* igt@i915_selftest@live_workarounds:
- fi-bsw-kefka: [DMESG-WARN][9] ([fdo#111373]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/fi-bsw-kefka/igt@i915_selftest@live_workarounds.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/fi-bsw-kefka/igt@i915_selftest@live_workarounds.html

* igt@kms_flip@basic-flip-vs-wf_vblank:
- {fi-kbl-soraka}: [FAIL][11] ([fdo#100368]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/fi-kbl-soraka/igt@kms_flip@basic-flip-vs-wf_vblank.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/fi-kbl-soraka/igt@kms_flip@basic-flip-vs-wf_vblank.html

* igt@kms_frontbuffer_tracking@basic:
- {fi-icl-u4}: [FAIL][13] ([fdo#103167]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/fi-icl-u4/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/fi-icl-u4/igt@[email protected]

#### Warnings ####

* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-kbl-guc: [FAIL][15] ([fdo#107707]) -> [SKIP][16] ([fdo#109271])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/fi-kbl-guc/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/fi-kbl-guc/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#100368]: https://bugs.freedesktop.org/show_bug.cgi?id=100368
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
[fdo#107139]: https://bugs.freedesktop.org/show_bug.cgi?id=107139
[fdo#107707]: https://bugs.freedesktop.org/show_bug.cgi?id=107707
[fdo#107709]: https://bugs.freedesktop.org/show_bug.cgi?id=107709
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108126]: https://bugs.freedesktop.org/show_bug.cgi?id=108126
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#110788]: https://bugs.freedesktop.org/show_bug.cgi?id=110788
[fdo#111108]: https://bugs.freedesktop.org/show_bug.cgi?id=111108
[fdo#111373]: https://bugs.freedesktop.org/show_bug.cgi?id=111373

Participating hosts (51 -> 45)
------------------------------

Additional (2): fi-hsw-peppy fi-icl-u3
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-apl-guc fi-icl-y fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_6807 -> Patchwork_14236

CI-20190529: 20190529
CI_DRM_6807: 7dfe53944a301f8b7946e69edb570661798dd0b9 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5159: c06ee2989c012fcc43cd361e75e9ee5a3a9292df @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14236: f7b42bdab12b0ed2105d321acece2de95a082fcd @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

f7b42bdab12b drm/i915: Document locking guidelines

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.IGT: success for drm/i915: Document locking guidelines

In reply to Joonas Lahtinen
== Series Details ==

== Series Details ==

Series: drm/i915: Document locking guidelines
URL : https://patchwork.freedesktop.org/series/66052/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6807_full -> Patchwork_14236_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_14236_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_parallel@bcs0-contexts:
- shard-hsw: [PASS][1] -> [FAIL][2] ([fdo#111469])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-hsw1/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-hsw6/igt@[email protected]

* igt@gem_exec_schedule@deep-bsd:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#111325]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb1/igt@[email protected]

* igt@gem_exec_schedule@fifo-bsd1:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#109276]) +12 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb4/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb7/igt@[email protected]

* igt@i915_pm_rpm@modeset-stress-extra-wait:
- shard-iclb: [PASS][7] -> [INCOMPLETE][8] ([fdo#107713] / [fdo#108840])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb5/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb1/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank:
- shard-skl: [PASS][9] -> [FAIL][10] ([fdo#105363])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-skl2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-skl7/igt@[email protected]
- shard-glk: [PASS][11] -> [FAIL][12] ([fdo#105363])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-glk2/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-glk5/igt@[email protected]

* igt@kms_flip@flip-vs-suspend:
- shard-skl: [PASS][13] -> [INCOMPLETE][14] ([fdo#109507]) +1 similar issue
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-skl4/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-skl9/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-shrfb-msflip-blt:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +2 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb1/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb6/igt@[email protected]

* igt@kms_frontbuffer_tracking@psr-suspend:
- shard-skl: [PASS][17] -> [INCOMPLETE][18] ([fdo#104108] / [fdo#106978])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-skl9/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-skl8/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: [PASS][19] -> [FAIL][20] ([fdo#108145] / [fdo#110403])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-skl6/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-skl9/igt@[email protected]

* igt@kms_psr@psr2_cursor_render:
- shard-iclb: [PASS][21] -> [SKIP][22] ([fdo#109441]) +1 similar issue
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb2/igt@kms_psr@psr2_cursor_render.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb1/igt@kms_psr@psr2_cursor_render.html

* igt@kms_vblank@pipe-a-ts-continuation-dpms-suspend:
- shard-skl: [PASS][23] -> [INCOMPLETE][24] ([fdo#104108])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-skl9/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-skl8/igt@[email protected]

* igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-apl: [PASS][25] -> [DMESG-WARN][26] ([fdo#108566]) +3 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-apl1/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-apl7/igt@[email protected]

* igt@kms_vblank@pipe-b-wait-idle-hang:
- shard-apl: [PASS][27] -> [INCOMPLETE][28] ([fdo#103927]) +1 similar issue
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-apl7/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-apl4/igt@[email protected]

* igt@tools_test@tools_test:
- shard-apl: [PASS][29] -> [SKIP][30] ([fdo#109271])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-apl1/igt@tools_test@tools_test.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-apl7/igt@tools_test@tools_test.html
- shard-glk: [PASS][31] -> [SKIP][32] ([fdo#109271])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-glk6/igt@tools_test@tools_test.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-glk2/igt@tools_test@tools_test.html

#### Possible fixes ####

* igt@gem_exec_schedule@smoketest-bsd:
- shard-iclb: [SKIP][33] ([fdo#111325]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb1/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb3/igt@[email protected]

* igt@i915_pm_rpm@i2c:
- shard-hsw: [FAIL][35] ([fdo#104097]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-hsw2/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-hsw5/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-skl: [INCOMPLETE][37] ([fdo#110741]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-skl6/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-skl10/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-skl: [FAIL][39] ([fdo#105363]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-skl2/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-skl7/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-apl: [DMESG-WARN][41] ([fdo#108566]) -> [PASS][42] +5 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-apl4/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-apl3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [FAIL][43] ([fdo#103167]) -> [PASS][44] +7 similar issues
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-min:
- shard-skl: [FAIL][45] ([fdo#108145]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-skl5/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-skl6/igt@[email protected]

* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: [SKIP][47] ([fdo#109441]) -> [PASS][48] +2 similar issues
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb6/igt@kms_psr@psr2_primary_mmap_cpu.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb2/igt@kms_psr@psr2_primary_mmap_cpu.html

* igt@prime_busy@hang-bsd2:
- shard-iclb: [SKIP][49] ([fdo#109276]) -> [PASS][50] +12 similar issues
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb3/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb1/igt@[email protected]

#### Warnings ####

* igt@gem_ctx_isolation@vcs1-nonpriv:
- shard-iclb: [FAIL][51] ([fdo#111329]) -> [SKIP][52] ([fdo#109276])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb4/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb7/igt@[email protected]

* igt@gem_mocs_settings@mocs-settings-bsd2:
- shard-iclb: [SKIP][53] ([fdo#109276]) -> [FAIL][54] ([fdo#111330])
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-iclb3/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-iclb2/igt@[email protected]

* igt@kms_content_protection@srm:
- shard-apl: [FAIL][55] ([fdo#110321]) -> [INCOMPLETE][56] ([fdo#103927])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6807/shard-apl3/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/shard-apl3/igt@[email protected]

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104097]: https://bugs.freedesktop.org/show_bug.cgi?id=104097
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#106978]: https://bugs.freedesktop.org/show_bug.cgi?id=106978
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109507]: https://bugs.freedesktop.org/show_bug.cgi?id=109507
[fdo#110321]: https://bugs.freedesktop.org/show_bug.cgi?id=110321
[fdo#110403]: https://bugs.freedesktop.org/show_bug.cgi?id=110403
[fdo#110741]: https://bugs.freedesktop.org/show_bug.cgi?id=110741
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111329]: https://bugs.freedesktop.org/show_bug.cgi?id=111329
[fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330
[fdo#111469]: https://bugs.freedesktop.org/show_bug.cgi?id=111469

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_6807 -> Patchwork_14236

CI-20190529: 20190529
CI_DRM_6807: 7dfe53944a301f8b7946e69edb570661798dd0b9 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5159: c06ee2989c012fcc43cd361e75e9ee5a3a9292df @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14236: f7b42bdab12b0ed2105d321acece2de95a082fcd @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14236/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Joonas Lahtinen
Quoted 21 lines · Joonas Lahtinen

To ensure cross-driver locking compatibility, document the expected guidelines for implementing the GEM locking in i915. Note that this is a description of how things should end up after being reworked, and does not reflect the current state of things.

---
 Documentation/gpu/i915.rst | 45 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
Documentation/gpu/i915.rst +0 -0
index e249ea7b0ec7..63a72d10f2c7 100644

Documentation/gpu/i915.rst for execution also include a list of all locations within buffers that · line 328

Quoted 9 lines
Documentation/gpu/i915.rst +6 -0
@@ -320,6 +320,51 @@ for execution also include a list of all locations within buffers that
 refer to GPU-addresses so that the kernel can edit the buffer correctly.
 This process is dubbed relocation.
 
+Locking Guidelines
+------------------
+
+**NOTE:** This is a description of how the locking should be after
+refactoring is done. Does not necessarily reflect what the locking
+looks like while WIP.

Maybe use rst note block for this?
.. note::

Quoted 29 lines
Documentation/gpu/i915.rst +29 -0
+
+#. All locking rules and interface contracts with cross-driver interfaces
+   (dma-buf, dma_fence) need to be followed.
+
+#. No struct_mutex anywhere in the code
+
+#. dma_resv will be the outermost lock (when needed) and ww_acquire_ctx
+   is to be hoisted at highest level and passed down within i915_gem_ctx
+   in the call chain
+
+#. While holding lru/memory manager (buddy, drm_mm, whatever) locks
+   system memory allocations are not allowed
+
+	* Enforce this by priming lockdep (with fs_reclaim). If we
+	  allocate memory while holding these looks we get a rehash
+	  of the shrinker vs. struct_mutex saga, and that would be
+	  real bad.
+
+#. Do not nest different lru/memory manager locks within each other.
+   Take them in turn to update memory allocations, relying on the object’s
+   dma_resv ww_mutex to serialize against other operations.
+
+#. The suggestion for lru/memory managers locks is that they are small
+   enough to be spinlocks.
+
+#. All features need to come with exhaustive kernel selftests and/or
+   IGT tests when appropriate
+
+#. All LMEM uAPI paths need to be fully restartable (_interruptible()

Documentation/gpu/i915.rst for execution also include a list of all locations within buffers that · line 367

Quoted 10 lines
Documentation/gpu/i915.rst +10 -0
+   for all locks/waits/sleeps)
+
+	* Error handling validation through signal injection.
+	  Still the best strategy we have for validating GEM uAPI
+          corner cases.
+	  Must be excessively used in the IGT, and we need to check
+	  that we really have full path coverage of all error cases.
+
+	* -EDEADLK handling with ww_mutex
+

It seems clear and clean to me. So from my point of view:

Quoted 10 lines
Documentation/gpu/i915.rst +0 -0
 GEM BO Management Implementation Details
 ----------------------------------------
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#4 lore raw
In reply to Joonas Lahtinen

Dave, ping for Acked-by here so we can merge? You already gave an early ack in IRC while travelling.

Regards, Joonas

Quoting Joonas Lahtinen (2019-08-30 13:50:53)

Quoted 75 lines

To ensure cross-driver locking compatibility, document the expected guidelines for implementing the GEM locking in i915. Note that this is a description of how things should end up after being reworked, and does not reflect the current state of things.

---
 Documentation/gpu/i915.rst | 45 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
Documentation/gpu/i915.rst +45 -0
index e249ea7b0ec7..63a72d10f2c7 100644
@@ -320,6 +320,51 @@ for execution also include a list of all locations within buffers that
 refer to GPU-addresses so that the kernel can edit the buffer correctly.
 This process is dubbed relocation.
 
+Locking Guidelines
+------------------
+
+**NOTE:** This is a description of how the locking should be after
+refactoring is done. Does not necessarily reflect what the locking
+looks like while WIP.
+
+#. All locking rules and interface contracts with cross-driver interfaces
+   (dma-buf, dma_fence) need to be followed.
+
+#. No struct_mutex anywhere in the code
+
+#. dma_resv will be the outermost lock (when needed) and ww_acquire_ctx
+   is to be hoisted at highest level and passed down within i915_gem_ctx
+   in the call chain
+
+#. While holding lru/memory manager (buddy, drm_mm, whatever) locks
+   system memory allocations are not allowed
+
+       * Enforce this by priming lockdep (with fs_reclaim). If we
+         allocate memory while holding these looks we get a rehash
+         of the shrinker vs. struct_mutex saga, and that would be
+         real bad.
+
+#. Do not nest different lru/memory manager locks within each other.
+   Take them in turn to update memory allocations, relying on the object’s
+   dma_resv ww_mutex to serialize against other operations.
+
+#. The suggestion for lru/memory managers locks is that they are small
+   enough to be spinlocks.
+
+#. All features need to come with exhaustive kernel selftests and/or
+   IGT tests when appropriate
+
+#. All LMEM uAPI paths need to be fully restartable (_interruptible()
+   for all locks/waits/sleeps)
+
+       * Error handling validation through signal injection.
+         Still the best strategy we have for validating GEM uAPI
+          corner cases.
+         Must be excessively used in the IGT, and we need to check
+         that we really have full path coverage of all error cases.
+
+       * -EDEADLK handling with ww_mutex
+
 GEM BO Management Implementation Details
 ----------------------------------------
 
Signature · 1 line
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer Acked-by
#5 lore raw
Quoted 79 lines · Joonas Lahtinen

Dave, ping for Acked-by here so we can merge? You already gave an early ack in IRC while travelling.

Regards, Joonas

Quoting Joonas Lahtinen (2019-08-30 13:50:53)

Quoted 72 lines

To ensure cross-driver locking compatibility, document the expected guidelines for implementing the GEM locking in i915. Note that this is a description of how things should end up after being reworked, and does not reflect the current state of things.

---
 Documentation/gpu/i915.rst | 45 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
Documentation/gpu/i915.rst +45 -0
index e249ea7b0ec7..63a72d10f2c7 100644
@@ -320,6 +320,51 @@ for execution also include a list of all locations within buffers that
 refer to GPU-addresses so that the kernel can edit the buffer correctly.
 This process is dubbed relocation.
 
+Locking Guidelines
+------------------
+
+**NOTE:** This is a description of how the locking should be after
+refactoring is done. Does not necessarily reflect what the locking
+looks like while WIP.
+
+#. All locking rules and interface contracts with cross-driver interfaces
+   (dma-buf, dma_fence) need to be followed.
+
+#. No struct_mutex anywhere in the code
+
+#. dma_resv will be the outermost lock (when needed) and ww_acquire_ctx
+   is to be hoisted at highest level and passed down within i915_gem_ctx
+   in the call chain
+
+#. While holding lru/memory manager (buddy, drm_mm, whatever) locks
+   system memory allocations are not allowed
+
+       * Enforce this by priming lockdep (with fs_reclaim). If we
+         allocate memory while holding these looks we get a rehash
+         of the shrinker vs. struct_mutex saga, and that would be
+         real bad.
+
+#. Do not nest different lru/memory manager locks within each other.
+   Take them in turn to update memory allocations, relying on the object’s
+   dma_resv ww_mutex to serialize against other operations.
+
+#. The suggestion for lru/memory managers locks is that they are small
+   enough to be spinlocks.
+
+#. All features need to come with exhaustive kernel selftests and/or
+   IGT tests when appropriate
+
+#. All LMEM uAPI paths need to be fully restartable (_interruptible()
+   for all locks/waits/sleeps)
+
+       * Error handling validation through signal injection.
+         Still the best strategy we have for validating GEM uAPI
+          corner cases.
+         Must be excessively used in the IGT, and we need to check
+         that we really have full path coverage of all error cases.
+
+       * -EDEADLK handling with ww_mutex
+
 GEM BO Management Implementation Details
 ----------------------------------------
 
Quoted 7 lines
Quoted 3 lines

--
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx