Skip to contentSkip to conversation

drm/kms: Catch mode_object lifetime errors

PATCH In review Daniel Vetter 5 participants 10 messages Jun 14, 2019 – Aug 20, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/kms: Catch mode_object lifetime errors

Only dynamic mode objects, i.e. those which are refcounted and have a free callback, can be added while the overall drm_device is visible to userspace. All others must be added before drm_dev_register and removed after drm_dev_unregister.

Small issue around drivers still using the load/unload callbacks, we need to make sure we set dev->registered so that load/unload code in these callbacks doesn't trigger false warnings. Only a small adjustement in drm_dev_register was needed.

Motivated by some irc discussions about object ids of dynamic objects like blobs become invalid, and me going on a bit an audit spree.

---
 drivers/gpu/drm/drm_drv.c         | 4 ++--
 drivers/gpu/drm/drm_mode_object.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index cb6f0245de7c..48c84e3e1931 100644
@@ -997,14 +997,14 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 	if (ret)
 		goto err_minors;
 
-	dev->registered = true;
-
 	if (dev->driver->load) {
 		ret = dev->driver->load(dev, flags);
 		if (ret)
 			goto err_minors;
 	}
 
+	dev->registered = true;
+
 	if (drm_core_check_feature(dev, DRIVER_MODESET))
 		drm_modeset_register_all(dev);
 
drivers/gpu/drm/drm_mode_object.c +4 -0
index 1c6e51135962..c355ba8e6d5d 100644
@@ -42,6 +42,8 @@ int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
 {
 	int ret;
 
+	WARN_ON(dev->registered && !obj_free_cb);
+
 	mutex_lock(&dev->mode_config.idr_mutex);
 	ret = idr_alloc(&dev->mode_config.object_idr, register_obj ? obj : NULL,
 			1, 0, GFP_KERNEL);
@@ -102,6 +104,8 @@ void drm_mode_object_register(struct drm_device *dev,
 void drm_mode_object_unregister(struct drm_device *dev,
 				struct drm_mode_object *object)
 {
+	WARN_ON(dev->registered && !object->free_cb);
+
 	mutex_lock(&dev->mode_config.idr_mutex);
 	if (object->id) {
 		idr_remove(&dev->mode_config.object_idr, object->id);
Signature · 6 lines
2.20.1

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

✗ Fi.CI.CHECKPATCH: warning for drm/kms: Catch mode_object lifetime errors

== Series Details ==

== Series Details ==

Series: drm/kms: Catch mode_object lifetime errors
URL : https://patchwork.freedesktop.org/series/62083/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
4800ebbe4df3 drm/kms: Catch mode_object lifetime errors
-:63: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter <[email protected]>'

total: 0 errors, 1 warnings, 0 checks, 32 lines checked

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

#2 lore raw

✓ Fi.CI.BAT: success for drm/kms: Catch mode_object lifetime errors

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: drm/kms: Catch mode_object lifetime errors
URL : https://patchwork.freedesktop.org/series/62083/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6265 -> Patchwork_13282
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_create@basic-files:
- fi-icl-u3: [PASS][1] -> [INCOMPLETE][2] ([fdo#107713] / [fdo#109100])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/fi-icl-u3/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/fi-icl-u3/igt@[email protected]

* igt@gem_exec_basic@basic-all:
- fi-icl-y: [PASS][3] -> [INCOMPLETE][4] ([fdo#107713])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/fi-icl-y/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/fi-icl-y/igt@[email protected]

#### Possible fixes ####

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][5] ([fdo#109485]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/fi-kbl-7500u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/fi-kbl-7500u/igt@[email protected]

[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485

Participating hosts (53 -> 45)
------------------------------

Additional (1): fi-byt-j1900
Missing (9): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-kbl-8809g fi-icl-dsi fi-bdw-samus

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

* Linux: CI_DRM_6265 -> Patchwork_13282

CI_DRM_6265: 657b9f601946cab518d8911ea92dc0f437a1f4b4 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5055: 495287320225e7f180d384cad7b207b77154438f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13282: 4800ebbe4df3d318d95be75cf230f31f7026afc3 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

4800ebbe4df3 drm/kms: Catch mode_object lifetime errors

== Logs ==

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

#3 lore raw

✓ Fi.CI.IGT: success for drm/kms: Catch mode_object lifetime errors

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: drm/kms: Catch mode_object lifetime errors
URL : https://patchwork.freedesktop.org/series/62083/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6265_full -> Patchwork_13282_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_eio@in-flight-internal-immediate:
- shard-apl: [PASS][1] -> [DMESG-WARN][2] ([fdo#110913 ])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl7/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-apl2/igt@[email protected]
- shard-glk: [PASS][3] -> [DMESG-WARN][4] ([fdo#110913 ])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-glk9/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-glk2/igt@[email protected]

* igt@gem_eio@wait-wedge-1us:
- shard-iclb: [PASS][5] -> [DMESG-WARN][6] ([fdo#110913 ])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-iclb1/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-iclb1/igt@[email protected]

* igt@gem_persistent_relocs@forked-interruptible-thrashing:
- shard-skl: ([PASS][7], [PASS][8]) -> [DMESG-WARN][9] ([fdo#110913 ]) +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl8/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl7/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-skl3/igt@[email protected]
- shard-hsw: [PASS][10] -> [DMESG-WARN][11] ([fdo#110789] / [fdo#110913 ])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw5/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw4/igt@[email protected]

* igt@gem_persistent_relocs@forked-thrashing:
- shard-hsw: ([PASS][12], [PASS][13]) -> [DMESG-WARN][14] ([fdo#110789] / [fdo#110913 ]) +1 similar issue
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw6/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw4/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw7/igt@[email protected]

* igt@gem_pipe_control_store_loop@fresh-buffer:
- shard-apl: ([PASS][15], [PASS][16]) -> [INCOMPLETE][17] ([fdo#103927])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl1/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl4/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-apl8/igt@[email protected]

* igt@gem_tiled_swapping@non-threaded:
- shard-iclb: [PASS][18] -> [FAIL][19] ([fdo#108686])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-iclb2/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-iclb1/igt@[email protected]

* igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy:
- shard-apl: ([PASS][20], [PASS][21]) -> [DMESG-WARN][22] ([fdo#110913 ])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl3/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl1/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-apl3/igt@[email protected]

* igt@i915_pm_rpm@fences-dpms:
- shard-iclb: [PASS][23] -> [INCOMPLETE][24] ([fdo#107713] / [fdo#108840])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-iclb5/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-iclb2/igt@[email protected]

* igt@i915_selftest@mock_requests:
- shard-skl: ([PASS][25], [PASS][26]) -> [INCOMPLETE][27] ([fdo#110550])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl5/igt@i915_selftest@mock_requests.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl7/igt@i915_selftest@mock_requests.html
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-skl10/igt@i915_selftest@mock_requests.html

* igt@kms_frontbuffer_tracking@fbc-2p-pri-indfb-multidraw:
- shard-hsw: [PASS][28] -> [SKIP][29] ([fdo#109271]) +3 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw5/igt@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-cur-indfb-move:
- shard-hsw: ([PASS][30], [PASS][31]) -> [SKIP][32] ([fdo#109271]) +12 similar issues
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw4/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw8/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-kbl: ([PASS][33], [PASS][34]) -> [DMESG-WARN][35] ([fdo#108566]) +2 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-kbl3/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-kbl6/igt@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-kbl7/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-mmap-gtt:
- shard-iclb: [PASS][36] -> [FAIL][37] ([fdo#103167]) +4 similar issues
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-mmap-gtt.html
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-mmap-gtt.html

* igt@kms_plane@plane-panning-bottom-right-pipe-b-planes:
- shard-skl: ([PASS][38], [PASS][39]) -> [FAIL][40] ([fdo#103166])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl5/igt@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl4/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-skl1/igt@[email protected]

* igt@kms_psr@psr2_cursor_blt:
- shard-iclb: [PASS][41] -> [SKIP][42] ([fdo#109441]) +2 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-iclb2/igt@kms_psr@psr2_cursor_blt.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-iclb5/igt@kms_psr@psr2_cursor_blt.html

* igt@perf@blocking:
- shard-skl: ([PASS][43], [PASS][44]) -> [FAIL][45] ([fdo#110728])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl7/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl3/igt@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-skl2/igt@[email protected]

#### Possible fixes ####

* igt@gem_eio@in-flight-10ms:
- shard-skl: ([PASS][46], [DMESG-WARN][47]) ([fdo#110913 ]) -> [PASS][48] +3 similar issues
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl9/igt@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl7/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-skl8/igt@[email protected]

* igt@gem_eio@reset-stress:
- shard-snb: ([PASS][49], [FAIL][50]) ([fdo#109661]) -> [PASS][51]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-snb4/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-snb7/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-snb1/igt@[email protected]

* igt@gem_exec_balancer@smoke:
- shard-iclb: [SKIP][52] ([fdo#110854]) -> [PASS][53]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-iclb3/igt@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-iclb4/igt@[email protected]

* igt@gem_persistent_relocs@forked-faulting-reloc-thrash-inactive:
- shard-apl: ([INCOMPLETE][54], [PASS][55]) ([fdo#103927]) -> [PASS][56]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl3/igt@[email protected]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl6/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-apl3/igt@[email protected]

* igt@gem_persistent_relocs@forked-thrashing:
- shard-glk: ([PASS][57], [DMESG-WARN][58]) ([fdo#110913 ]) -> [PASS][59] +3 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-glk2/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-glk8/igt@[email protected]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-glk1/igt@[email protected]
- shard-skl: ([DMESG-WARN][60], [DMESG-WARN][61]) ([fdo#110913 ]) -> [PASS][62]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl5/igt@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl8/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-skl3/igt@[email protected]
- shard-kbl: ([DMESG-WARN][63], [PASS][64]) ([fdo#110913 ]) -> [PASS][65] +1 similar issue
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-kbl6/igt@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-kbl2/igt@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-kbl2/igt@[email protected]
- shard-snb: ([PASS][66], [DMESG-WARN][67]) ([fdo#110789] / [fdo#110913 ]) -> [PASS][68]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-snb4/igt@[email protected]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-snb5/igt@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-snb1/igt@[email protected]

* igt@gem_ppgtt@blt-vs-render-ctx0:
- shard-apl: ([PASS][69], [DMESG-WARN][70]) ([fdo#110913 ]) -> [PASS][71] +2 similar issues
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl4/igt@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl5/igt@[email protected]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-apl4/igt@[email protected]

* igt@gem_tiled_swapping@non-threaded:
- shard-apl: ([DMESG-WARN][72], [PASS][73]) ([fdo#108686]) -> [PASS][74]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl3/igt@[email protected]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl1/igt@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-apl4/igt@[email protected]
- shard-hsw: ([FAIL][75], [INCOMPLETE][76]) ([fdo#103540] / [fdo#108686]) -> [PASS][77]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw8/igt@[email protected]
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw2/igt@[email protected]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw8/igt@[email protected]

* igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy-gup:
- shard-snb: ([DMESG-WARN][78], [PASS][79]) ([fdo#110913 ]) -> [PASS][80]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-snb1/igt@[email protected]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-snb5/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-snb5/igt@[email protected]

* igt@gem_userptr_blits@sync-unmap-cycles:
- shard-hsw: ([DMESG-WARN][81], [PASS][82]) ([fdo#110913 ]) -> [PASS][83] +1 similar issue
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw8/igt@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw7/igt@[email protected]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw2/igt@[email protected]
- shard-apl: ([DMESG-WARN][84], [DMESG-WARN][85]) ([fdo#110913 ]) -> [PASS][86]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl4/igt@[email protected]
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl2/igt@[email protected]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-apl2/igt@[email protected]

* igt@kms_big_fb@x-tiled-32bpp-rotate-180:
- shard-snb: ([PASS][87], [SKIP][88]) ([fdo#109271]) -> [PASS][89]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-snb7/igt@[email protected]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-snb4/igt@[email protected]
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-snb7/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-suspend:
- shard-kbl: ([PASS][90], [DMESG-WARN][91]) ([fdo#108566]) -> [PASS][92] +2 similar issues
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-kbl2/igt@[email protected]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-kbl7/igt@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-kbl1/igt@[email protected]

* igt@kms_cursor_legacy@cursor-vs-flip-varying-size:
- shard-hsw: ([FAIL][93], [PASS][94]) ([fdo#103355]) -> [PASS][95]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw6/igt@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw8/igt@[email protected]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw2/igt@[email protected]

* igt@kms_flip@2x-flip-vs-suspend:
- shard-hsw: [SKIP][96] ([fdo#109271]) -> [PASS][97] +8 similar issues
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw1/igt@[email protected]
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw8/igt@[email protected]

* igt@kms_flip@2x-plain-flip:
- shard-hsw: ([PASS][98], [SKIP][99]) ([fdo#109271]) -> [PASS][100] +33 similar issues
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw7/igt@[email protected]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw1/igt@[email protected]
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw5/igt@[email protected]

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

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-skl: ([INCOMPLETE][103], [PASS][104]) ([fdo#104108]) -> [PASS][105]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl8/igt@[email protected]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-skl2/igt@[email protected]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-skl5/igt@[email protected]

* igt@kms_psr@psr2_sprite_plane_onoff:
- shard-iclb: [SKIP][106] ([fdo#109441]) -> [PASS][107]
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-iclb5/igt@kms_psr@psr2_sprite_plane_onoff.html
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-iclb2/igt@kms_psr@psr2_sprite_plane_onoff.html

* igt@kms_setmode@basic:
- shard-apl: ([FAIL][108], [FAIL][109]) ([fdo#99912]) -> [PASS][110]
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl4/igt@[email protected]
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-apl2/igt@[email protected]
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-apl7/igt@[email protected]

* igt@perf_pmu@rc6-runtime-pm:
- shard-hsw: ([FAIL][111], [FAIL][112]) ([fdo#105010]) -> [PASS][113]
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw2/igt@[email protected]
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw8/igt@[email protected]
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw8/igt@[email protected]

* igt@prime_busy@wait-hang-default:
- shard-hsw: ([DMESG-WARN][114], [DMESG-WARN][115]) ([fdo#110789] / [fdo#110913 ]) -> [PASS][116]
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw8/igt@[email protected]
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6265/shard-hsw6/igt@[email protected]
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13282/shard-hsw1/igt@[email protected]

#### Warnings ####

* igt@gem_eio@in-flight-suspend:
- shard-kbl: ([INCOMPLETE][117], [PASS][118]) ([fdo#103

== Logs ==

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

Reviewed-by on v1 1/1
#4 lore raw
In reply to Daniel Vetter
Quoted 5 lines · Daniel Vetter

Only dynamic mode objects, i.e. those which are refcounted and have a free callback, can be added while the overall drm_device is visible to userspace. All others must be added before drm_dev_register and removed after drm_dev_unregister.

Quoted 8 lines

Small issue around drivers still using the load/unload callbacks, we need to make sure we set dev->registered so that load/unload code in these callbacks doesn't trigger false warnings. Only a small adjustement in drm_dev_register was needed.

Motivated by some irc discussions about object ids of dynamic objects like blobs become invalid, and me going on a bit an audit spree.

Seems like a very worthwhile change, any idea how many drivers are going to be sad after this change?

Quoted 32 lines
---
 drivers/gpu/drm/drm_drv.c         | 4 ++--
 drivers/gpu/drm/drm_mode_object.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index cb6f0245de7c..48c84e3e1931 100644
@@ -997,14 +997,14 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
 	if (ret)
 		goto err_minors;
 
-	dev->registered = true;
-
 	if (dev->driver->load) {
 		ret = dev->driver->load(dev, flags);
 		if (ret)
 			goto err_minors;
 	}
 
+	dev->registered = true;
+
 	if (drm_core_check_feature(dev, DRIVER_MODESET))
 		drm_modeset_register_all(dev);
 
drivers/gpu/drm/drm_mode_object.c +0 -0
index 1c6e51135962..c355ba8e6d5d 100644

drivers/gpu/drm/drm_mode_object.c int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, · line 45

Quoted 4 lines
drivers/gpu/drm/drm_mode_object.c +1 -0
@@ -42,6 +42,8 @@ int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
 {
 	int ret;
 
+	WARN_ON(dev->registered && !obj_free_cb);

These should probably have a comment above them giving some guidance to the driver developer.

With some comments, this is:

Quoted 20 lines
drivers/gpu/drm/drm_mode_object.c +3 -0
+
 	mutex_lock(&dev->mode_config.idr_mutex);
 	ret = idr_alloc(&dev->mode_config.object_idr, register_obj ? obj : NULL,
 			1, 0, GFP_KERNEL);
@@ -102,6 +104,8 @@ void drm_mode_object_register(struct drm_device *dev,
 void drm_mode_object_unregister(struct drm_device *dev,
 				struct drm_mode_object *object)
 {
+	WARN_ON(dev->registered && !object->free_cb);
+
 	mutex_lock(&dev->mode_config.idr_mutex);
 	if (object->id) {
 		idr_remove(&dev->mode_config.object_idr, object->id);
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw
Quoted 12 lines · Sean Paul
Quoted 10 lines · Daniel Vetter

Only dynamic mode objects, i.e. those which are refcounted and have a free callback, can be added while the overall drm_device is visible to userspace. All others must be added before drm_dev_register and removed after drm_dev_unregister.

Small issue around drivers still using the load/unload callbacks, we need to make sure we set dev->registered so that load/unload code in these callbacks doesn't trigger false warnings. Only a small adjustement in drm_dev_register was needed.

Quoted 6 lines
Quoted 3 lines

Motivated by some irc discussions about object ids of dynamic objects like blobs become invalid, and me going on a bit an audit spree.

Seems like a very worthwhile change, any idea how many drivers are going to be sad after this change?

None I think/hope, really just defense WARN_ON just in case. The main ones that would be sad are all the ones that have a ->load callback, but I'm taking care of them. Everyone else does things correctly and calls drm_dev_register last in their probe function (or around where they set up fbdev, which is also register the driver at least to the fbdev world, so really the same).

Quoted 35 lines
Quoted 35 lines
---
 drivers/gpu/drm/drm_drv.c         | 4 ++--
 drivers/gpu/drm/drm_mode_object.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index cb6f0245de7c..48c84e3e1931 100644
@@ -997,14 +997,14 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
      if (ret)
              goto err_minors;
 
-     dev->registered = true;
-
      if (dev->driver->load) {
              ret = dev->driver->load(dev, flags);
              if (ret)
                      goto err_minors;
      }
 
+     dev->registered = true;
+
      if (drm_core_check_feature(dev, DRIVER_MODESET))
              drm_modeset_register_all(dev);
 
drivers/gpu/drm/drm_mode_object.c +0 -0
index 1c6e51135962..c355ba8e6d5d 100644
@@ -42,6 +42,8 @@ int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
 {
      int ret;
 
Quoted 6 lines

drivers/gpu/drm/drm_mode_object.c int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, · line 45

Quoted 1 line
drivers/gpu/drm/drm_mode_object.c +1 -0
+     WARN_ON(dev->registered && !obj_free_cb);

These should probably have a comment above them giving some guidance to the driver developer.

With some comments, this is:

What comment do you expect here? drm_dev_register explains what you should do already, and I expect driver developers to find that one pretty quickly. From there: "This should be done last in the device initialization sequence to make sure userspace can't access an inconsistent state."
-Daniel

Quoted 26 lines
Quoted 16 lines
drivers/gpu/drm/drm_mode_object.c +3 -1
+
      mutex_lock(&dev->mode_config.idr_mutex);
      ret = idr_alloc(&dev->mode_config.object_idr, register_obj ? obj : NULL,
                      1, 0, GFP_KERNEL);
@@ -102,6 +104,8 @@ void drm_mode_object_register(struct drm_device *dev,
 void drm_mode_object_unregister(struct drm_device *dev,
                              struct drm_mode_object *object)
 {
+     WARN_ON(dev->registered && !object->free_cb);
+
      mutex_lock(&dev->mode_config.idr_mutex);
      if (object->id) {
              idr_remove(&dev->mode_config.object_idr, object->id);
--

2.20.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Sean Paul, Software Engineer, Google / Chromium OS

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 70 lines · Daniel Vetter
Quoted 14 lines · Sean Paul
Quoted 13 lines · Daniel Vetter

Only dynamic mode objects, i.e. those which are refcounted and have a free
callback, can be added while the overall drm_device is visible to userspace. All others must be added before drm_dev_register and removed after drm_dev_unregister.

Small issue around drivers still using the load/unload callbacks, we
need to make sure we set dev->registered so that load/unload code in
these callbacks doesn't trigger false warnings. Only a small adjustement in drm_dev_register was needed.

Quoted 8 lines
Quoted 4 lines

Motivated by some irc discussions about object ids of dynamic objects
like blobs become invalid, and me going on a bit an audit spree.

Seems like a very worthwhile change, any idea how many drivers are going
to be sad after this change?

None I think/hope, really just defense WARN_ON just in case. The main ones that would be sad are all the ones that have a ->load callback, but I'm taking care of them. Everyone else does things correctly and calls drm_dev_register last in their probe function (or around where they set up fbdev, which is also register the driver at least to the fbdev world, so really the same).

Quoted 39 lines
Quoted 39 lines
---
 drivers/gpu/drm/drm_drv.c         | 4 ++--
 drivers/gpu/drm/drm_mode_object.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index cb6f0245de7c..48c84e3e1931 100644
@@ -997,14 +997,14 @@ int drm_dev_register(struct drm_device
 *dev, unsigned long flags)
      if (ret)
              goto err_minors;
 
-     dev->registered = true;
-
      if (dev->driver->load) {
              ret = dev->driver->load(dev, flags);
              if (ret)
                      goto err_minors;
      }
 
+     dev->registered = true;
+
      if (drm_core_check_feature(dev, DRIVER_MODESET))
              drm_modeset_register_all(dev);
drivers/gpu/drm/drm_mode_object.c +0 -0
index 1c6e51135962..c355ba8e6d5d 100644
@@ -42,6 +42,8 @@ int __drm_mode_object_add(struct drm_device
 *dev, struct drm_mode_object *obj,
 {
      int ret;
 
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/drm_mode_object.c int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, · line 45

Quoted 1 line
drivers/gpu/drm/drm_mode_object.c +1 -0
+     WARN_ON(dev->registered && !obj_free_cb);

Getting warnings on i915 with MST, we add fake MST connectors when a sink with MST support is connected;

intel_dp_add_mst_connector()->drm_connector_attach_max_bpc_property()

Not sure how to fix that, add a global i915 device property like we do for "audio" and "Broadcast RGB" don't look the right approach here. Any tips?

We definitely need a platform with a MST sink on our CI.

Quoted 5 lines
Quoted 5 lines

These should probably have a comment above them giving some guidance to the
driver developer.

Quoted 40 lines
Quoted 1 line

With some comments, this is:

What comment do you expect here? drm_dev_register explains what you should do already, and I expect driver developers to find that one pretty quickly. From there: "This should be done last in the device initialization sequence to make sure userspace can't access an inconsistent state."
-Daniel

Quoted 29 lines
Quoted 15 lines
drivers/gpu/drm/drm_mode_object.c +1 -0
+
      mutex_lock(&dev->mode_config.idr_mutex);
      ret = idr_alloc(&dev->mode_config.object_idr, register_obj

? obj : NULL,

                      1, 0, GFP_KERNEL);
drivers/gpu/drm/drm_mode_object.c +2 -0
@@ -102,6 +104,8 @@ void drm_mode_object_register(struct
 drm_device *dev,
 void drm_mode_object_unregister(struct drm_device *dev,
                              struct drm_mode_object *object)
 {
+     WARN_ON(dev->registered && !object->free_cb);
+
      mutex_lock(&dev->mode_config.idr_mutex);
      if (object->id) {
              idr_remove(&dev->mode_config.object_idr, object-
Quoted 8 lines
Quoted 1 line

id);

--
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
Quoted 76 lines · Jose
Quoted 70 lines · Daniel Vetter
Quoted 14 lines · Sean Paul
Quoted 13 lines · Daniel Vetter

Only dynamic mode objects, i.e. those which are refcounted and have a free
callback, can be added while the overall drm_device is visible to userspace. All others must be added before drm_dev_register and removed after drm_dev_unregister.

Small issue around drivers still using the load/unload callbacks, we
need to make sure we set dev->registered so that load/unload code in
these callbacks doesn't trigger false warnings. Only a small adjustement in drm_dev_register was needed.

Quoted 8 lines
Quoted 4 lines

Motivated by some irc discussions about object ids of dynamic objects
like blobs become invalid, and me going on a bit an audit spree.

Seems like a very worthwhile change, any idea how many drivers are going
to be sad after this change?

None I think/hope, really just defense WARN_ON just in case. The main ones that would be sad are all the ones that have a ->load callback, but I'm taking care of them. Everyone else does things correctly and calls drm_dev_register last in their probe function (or around where they set up fbdev, which is also register the driver at least to the fbdev world, so really the same).

Quoted 39 lines
Quoted 39 lines
---
 drivers/gpu/drm/drm_drv.c         | 4 ++--
 drivers/gpu/drm/drm_mode_object.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index cb6f0245de7c..48c84e3e1931 100644
@@ -997,14 +997,14 @@ int drm_dev_register(struct drm_device
 *dev, unsigned long flags)
      if (ret)
              goto err_minors;
 
-     dev->registered = true;
-
      if (dev->driver->load) {
              ret = dev->driver->load(dev, flags);
              if (ret)
                      goto err_minors;
      }
 
+     dev->registered = true;
+
      if (drm_core_check_feature(dev, DRIVER_MODESET))
              drm_modeset_register_all(dev);
drivers/gpu/drm/drm_mode_object.c +0 -0
index 1c6e51135962..c355ba8e6d5d 100644
@@ -42,6 +42,8 @@ int __drm_mode_object_add(struct drm_device
 *dev, struct drm_mode_object *obj,
 {
      int ret;
 
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/drm_mode_object.c int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, · line 45

Quoted 1 line
drivers/gpu/drm/drm_mode_object.c +1 -0
+     WARN_ON(dev->registered && !obj_free_cb);

Getting warnings on i915 with MST, we add fake MST connectors when a sink with MST support is connected;

Quoted 7 lines

intel_dp_add_mst_connector()->drm_connector_attach_max_bpc_property()

Not sure how to fix that, add a global i915 device property like we do for "audio" and "Broadcast RGB" don't look the right approach here. Any tips?

We definitely need a platform with a MST sink on our CI.

Uh yeah this is bad. I guess we need to preemptively create all possible bpc properties, so that we can only do an attach. Those really can't be hotplugged.

We might also want to revert

commit 5ca0ef8a56b8c4812ed78ef9ca53052191dab6e7

Author: Ville Syrjälä <[email protected]>
Date:   Tue Mar 26 16:25:54 2019 +0200

drm/i915: Add max_bpc property for DP MST

as an interim solution. Adding Ville and Jani.
-Daniel

Quoted 45 lines
Quoted 45 lines
Quoted 6 lines

These should probably have a comment above them giving some guidance to the
driver developer.

With some comments, this is:

What comment do you expect here? drm_dev_register explains what you should do already, and I expect driver developers to find that one pretty quickly. From there: "This should be done last in the device initialization sequence to make sure userspace can't access an inconsistent state."
-Daniel

Quoted 29 lines
Quoted 15 lines
drivers/gpu/drm/drm_mode_object.c +1 -0
+
      mutex_lock(&dev->mode_config.idr_mutex);
      ret = idr_alloc(&dev->mode_config.object_idr, register_obj

? obj : NULL,

                      1, 0, GFP_KERNEL);
drivers/gpu/drm/drm_mode_object.c +2 -0
@@ -102,6 +104,8 @@ void drm_mode_object_register(struct
 drm_device *dev,
 void drm_mode_object_unregister(struct drm_device *dev,
                              struct drm_mode_object *object)
 {
+     WARN_ON(dev->registered && !object->free_cb);
+
      mutex_lock(&dev->mode_config.idr_mutex);
      if (object->id) {
              idr_remove(&dev->mode_config.object_idr, object-
Quoted 8 lines
Quoted 1 line

id);

--
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Sean Paul, Software Engineer, Google / Chromium OS

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw
Quoted 83 lines · Daniel Vetter
Quoted 82 lines · Jose
Quoted 70 lines · Daniel Vetter
Quoted 14 lines · Sean Paul
Quoted 13 lines · Daniel Vetter

Only dynamic mode objects, i.e. those which are refcounted and have a free
callback, can be added while the overall drm_device is visible to userspace. All others must be added before drm_dev_register and removed after drm_dev_unregister.

Small issue around drivers still using the load/unload callbacks, we
need to make sure we set dev->registered so that load/unload code in
these callbacks doesn't trigger false warnings. Only a small adjustement in drm_dev_register was needed.

Quoted 8 lines
Quoted 4 lines

Motivated by some irc discussions about object ids of dynamic objects
like blobs become invalid, and me going on a bit an audit spree.

Seems like a very worthwhile change, any idea how many drivers are going
to be sad after this change?

None I think/hope, really just defense WARN_ON just in case. The main ones that would be sad are all the ones that have a ->load callback, but I'm taking care of them. Everyone else does things correctly and calls drm_dev_register last in their probe function (or around where they set up fbdev, which is also register the driver at least to the fbdev world, so really the same).

Quoted 39 lines
Quoted 39 lines
---
 drivers/gpu/drm/drm_drv.c         | 4 ++--
 drivers/gpu/drm/drm_mode_object.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index cb6f0245de7c..48c84e3e1931 100644
@@ -997,14 +997,14 @@ int drm_dev_register(struct drm_device
 *dev, unsigned long flags)
      if (ret)
              goto err_minors;
 
-     dev->registered = true;
-
      if (dev->driver->load) {
              ret = dev->driver->load(dev, flags);
              if (ret)
                      goto err_minors;
      }
 
+     dev->registered = true;
+
      if (drm_core_check_feature(dev, DRIVER_MODESET))
              drm_modeset_register_all(dev);
drivers/gpu/drm/drm_mode_object.c +0 -0
index 1c6e51135962..c355ba8e6d5d 100644
@@ -42,6 +42,8 @@ int __drm_mode_object_add(struct drm_device
 *dev, struct drm_mode_object *obj,
 {
      int ret;
 
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/drm_mode_object.c int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, · line 45

Quoted 1 line
drivers/gpu/drm/drm_mode_object.c +1 -0
+     WARN_ON(dev->registered && !obj_free_cb);

Getting warnings on i915 with MST, we add fake MST connectors when a sink with MST support is connected;

intel_dp_add_mst_connector()->drm_connector_attach_max_bpc_property()

Not sure how to fix that, add a global i915 device property like we do for "audio" and "Broadcast RGB" don't look the right approach here. Any tips?

Quoted 5 lines
Quoted 1 line

We definitely need a platform with a MST sink on our CI.

Uh yeah this is bad. I guess we need to preemptively create all possible bpc properties, so that we can only do an attach. Those really can't be hotplugged.

Should we plan to make all objects dynamic and refcounted in the long run? It's kind of silly that we've made connectors dynamic yet can't dynamically allocate properties for them. (Except blob properties which are special dynamic snowflakes.)

Quoted 9 lines

We might also want to revert

commit 5ca0ef8a56b8c4812ed78ef9ca53052191dab6e7

Author: Ville Syrjälä <[email protected]>
Date:   Tue Mar 26 16:25:54 2019 +0200

drm/i915: Add max_bpc property for DP MST

as an interim solution. Adding Ville and Jani.

I think we'll want the fixed, pre-created DP MST max BPC property, shoved in dev_priv, as an interim solution before we have everything dynamic. This shouldn't really be more than 50-100 lines, especially given that we'll only need the 6-12 BPC range for MST connectors, and the rest can use the usual methods.

Whether we need the revert as an interim solution before the interim solution, I'll leave it up to Ville. How quick do you think you'd get to fixing this?

Other than that, ugh. Just ugh.

BR,
Jani.

Quoted 47 lines

-Daniel

Quoted 45 lines
Quoted 45 lines
Quoted 6 lines

These should probably have a comment above them giving some guidance to the
driver developer.

With some comments, this is:

What comment do you expect here? drm_dev_register explains what you should do already, and I expect driver developers to find that one pretty quickly. From there: "This should be done last in the device initialization sequence to make sure userspace can't access an inconsistent state."
-Daniel

Quoted 29 lines
Quoted 15 lines
drivers/gpu/drm/drm_mode_object.c +1 -0
+
      mutex_lock(&dev->mode_config.idr_mutex);
      ret = idr_alloc(&dev->mode_config.object_idr, register_obj

? obj : NULL,

                      1, 0, GFP_KERNEL);
drivers/gpu/drm/drm_mode_object.c +2 -0
@@ -102,6 +104,8 @@ void drm_mode_object_register(struct
 drm_device *dev,
 void drm_mode_object_unregister(struct drm_device *dev,
                              struct drm_mode_object *object)
 {
+     WARN_ON(dev->registered && !object->free_cb);
+
      mutex_lock(&dev->mode_config.idr_mutex);
      if (object->id) {
              idr_remove(&dev->mode_config.object_idr, object-
Quoted 8 lines
Quoted 1 line

id);

--
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Sean Paul, Software Engineer, Google / Chromium OS

Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw
Quoted 87 lines · Jani Nikula
Quoted 85 lines · Daniel Vetter
Quoted 83 lines · Jose
Quoted 70 lines · Daniel Vetter
Quoted 14 lines · Sean Paul
Quoted 13 lines · Daniel Vetter

Only dynamic mode objects, i.e. those which are refcounted and have a free
callback, can be added while the overall drm_device is visible to userspace. All others must be added before drm_dev_register and removed after drm_dev_unregister.

Small issue around drivers still using the load/unload callbacks, we
need to make sure we set dev->registered so that load/unload code in
these callbacks doesn't trigger false warnings. Only a small adjustement in drm_dev_register was needed.

Quoted 8 lines
Quoted 4 lines

Motivated by some irc discussions about object ids of dynamic objects
like blobs become invalid, and me going on a bit an audit spree.

Seems like a very worthwhile change, any idea how many drivers are going
to be sad after this change?

None I think/hope, really just defense WARN_ON just in case. The main ones that would be sad are all the ones that have a ->load callback, but I'm taking care of them. Everyone else does things correctly and calls drm_dev_register last in their probe function (or around where they set up fbdev, which is also register the driver at least to the fbdev world, so really the same).

Quoted 39 lines
Quoted 39 lines
---
 drivers/gpu/drm/drm_drv.c         | 4 ++--
 drivers/gpu/drm/drm_mode_object.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index cb6f0245de7c..48c84e3e1931 100644
@@ -997,14 +997,14 @@ int drm_dev_register(struct drm_device
 *dev, unsigned long flags)
      if (ret)
              goto err_minors;
 
-     dev->registered = true;
-
      if (dev->driver->load) {
              ret = dev->driver->load(dev, flags);
              if (ret)
                      goto err_minors;
      }
 
+     dev->registered = true;
+
      if (drm_core_check_feature(dev, DRIVER_MODESET))
              drm_modeset_register_all(dev);
drivers/gpu/drm/drm_mode_object.c +0 -0
index 1c6e51135962..c355ba8e6d5d 100644
@@ -42,6 +42,8 @@ int __drm_mode_object_add(struct drm_device
 *dev, struct drm_mode_object *obj,
 {
      int ret;
 
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/drm_mode_object.c int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, · line 45

Quoted 1 line
drivers/gpu/drm/drm_mode_object.c +1 -0
+     WARN_ON(dev->registered && !obj_free_cb);

Getting warnings on i915 with MST, we add fake MST connectors when a sink with MST support is connected;

intel_dp_add_mst_connector()->drm_connector_attach_max_bpc_property()

Not sure how to fix that, add a global i915 device property like we do for "audio" and "Broadcast RGB" don't look the right approach here. Any tips?

We definitely need a platform with a MST sink on our CI.

Quoted 8 lines
Quoted 3 lines

Uh yeah this is bad. I guess we need to preemptively create all possible bpc properties, so that we can only do an attach. Those really can't be hotplugged.

Should we plan to make all objects dynamic and refcounted in the long run? It's kind of silly that we've made connectors dynamic yet can't dynamically allocate properties for them. (Except blob properties which are special dynamic snowflakes.)

Need to make sure userspace is ok with that. Plus given that it took us years to make drm_connector refcounting not be a pure fireworks show (and Lyude is still busy) I'm not too enthusiastic about this.

Also even with the objects which have been dynamic since forever (edid blobs) userspace mixed things up since we reuse ids. It's a mess.

Quoted 16 lines
Quoted 9 lines

We might also want to revert

commit 5ca0ef8a56b8c4812ed78ef9ca53052191dab6e7

Author: Ville Syrjälä <[email protected]>
Date:   Tue Mar 26 16:25:54 2019 +0200

drm/i915: Add max_bpc property for DP MST

as an interim solution. Adding Ville and Jani.

I think we'll want the fixed, pre-created DP MST max BPC property, shoved in dev_priv, as an interim solution before we have everything dynamic. This shouldn't really be more than 50-100 lines, especially given that we'll only need the 6-12 BPC range for MST connectors, and the rest can use the usual methods.

Quoted 5 lines

Whether we need the revert as an interim solution before the interim solution, I'll leave it up to Ville. How quick do you think you'd get to fixing this?

Other than that, ugh. Just ugh.

Agreed on that :-/
-Daniel

Quoted 55 lines

BR,
Jani.

Quoted 47 lines

-Daniel

Quoted 45 lines
Quoted 45 lines
Quoted 6 lines

These should probably have a comment above them giving some guidance to the
driver developer.

With some comments, this is:

What comment do you expect here? drm_dev_register explains what you should do already, and I expect driver developers to find that one pretty quickly. From there: "This should be done last in the device initialization sequence to make sure userspace can't access an inconsistent state."
-Daniel

Quoted 29 lines
Quoted 15 lines
drivers/gpu/drm/drm_mode_object.c +1 -0
+
      mutex_lock(&dev->mode_config.idr_mutex);
      ret = idr_alloc(&dev->mode_config.object_idr, register_obj

? obj : NULL,

                      1, 0, GFP_KERNEL);
drivers/gpu/drm/drm_mode_object.c +2 -0
@@ -102,6 +104,8 @@ void drm_mode_object_register(struct
 drm_device *dev,
 void drm_mode_object_unregister(struct drm_device *dev,
                              struct drm_mode_object *object)
 {
+     WARN_ON(dev->registered && !object->free_cb);
+
      mutex_lock(&dev->mode_config.idr_mutex);
      if (object->id) {
              idr_remove(&dev->mode_config.object_idr, object-
Quoted 8 lines
Quoted 1 line

id);

--
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Sean Paul, Software Engineer, Google / Chromium OS

--
Jani Nikula, Intel Open Source Graphics Center

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx