Skip to contentSkip to conversation

drm: Replace drm_modeset_lock/unlock_all with DRM_MODESET_LOCK_ALL_* helpers

PATCH In review Michal Orzel 5 participants 11 messages Apr 28, 2020 – May 5, 2020

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

PATCH 1/1 drm: Replace drm_modeset_lock/unlock_all with DRM_MODESET_LOCK_ALL_* helpers

As suggested by the TODO list for the kernel DRM subsystem, replace the deprecated functions that take/drop modeset locks with new helpers.

---
 drivers/gpu/drm/drm_mode_object.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_mode_object.c +6 -4
index 35c2719..901b078 100644
@@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 {
 	struct drm_mode_obj_get_properties *arg = data;
 	struct drm_mode_object *obj;
+	struct drm_modeset_acquire_ctx ctx;
 	int ret = 0;
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		return -EOPNOTSUPP;
 
-	drm_modeset_lock_all(dev);
+	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
 
 	obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
 	if (!obj) {
@@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
 	drm_mode_object_put(obj);
 out:
-	drm_modeset_unlock_all(dev);
+	DRM_MODESET_LOCK_ALL_END(ctx, ret);
 	return ret;
 }
 
@@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
 {
 	struct drm_device *dev = prop->dev;
 	struct drm_mode_object *ref;
+	struct drm_modeset_acquire_ctx ctx;
 	int ret = -EINVAL;
 
 	if (!drm_property_change_valid_get(prop, prop_value, &ref))
 		return -EINVAL;
 
-	drm_modeset_lock_all(dev);
+	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
 	switch (obj->type) {
 	case DRM_MODE_OBJECT_CONNECTOR:
 		ret = drm_connector_set_obj_prop(obj, prop, prop_value);
@@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
 		break;
 	}
 	drm_property_change_valid_put(prop, ref);
-	drm_modeset_unlock_all(dev);
+	DRM_MODESET_LOCK_ALL_END(ctx, ret);
 
 	return ret;
 }
Signature · 6 lines
2.7.4

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

[Intel-gfx] ✓ Fi.CI.BAT: success for drm: Replace drm_modeset_lock/unlock_all with DRM_MODESET_LOCK_ALL_* helpers (rev2)

== Series Details ==

== Series Details ==

Series: drm: Replace drm_modeset_lock/unlock_all with DRM_MODESET_LOCK_ALL_* helpers (rev2)
URL : https://patchwork.freedesktop.org/series/76671/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_8384 -> Patchwork_17496
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/index.html

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@execlists:
- fi-kbl-soraka: [PASS][1] -> [INCOMPLETE][2] ([CI#80])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/fi-kbl-soraka/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/fi-kbl-soraka/igt@i915_selftest@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@perf:
- fi-bwr-2160: [INCOMPLETE][3] ([i915#489]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/fi-bwr-2160/igt@i915_selftest@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/fi-bwr-2160/igt@i915_selftest@[email protected]

[CI#80]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/80
[i915#489]: https://gitlab.freedesktop.org/drm/intel/issues/489

Participating hosts (49 -> 42)
------------------------------

Missing (7): fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-kbl-7500u fi-ctg-p8600 fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_8384 -> Patchwork_17496

CI-20190529: 20190529
CI_DRM_8384: 513c18c3d94d97a584c40998d2666f5e1390ac66 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5614: d095827add11d4e8158b87683971ee659749d9a4 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17496: a9abedc6ec4fba47e6d5cf17c849e32901bedb63 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

a9abedc6ec4f drm: Replace drm_modeset_lock/unlock_all with DRM_MODESET_LOCK_ALL_* helpers

== Logs ==

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

#2 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for drm: Replace drm_modeset_lock/unlock_all with DRM_MODESET_LOCK_ALL_* helpers (rev2)

In reply to Michal Orzel
== Series Details ==

== Series Details ==

Series: drm: Replace drm_modeset_lock/unlock_all with DRM_MODESET_LOCK_ALL_* helpers (rev2)
URL : https://patchwork.freedesktop.org/series/76671/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_8384_full -> Patchwork_17496_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rps@waitboost:
- shard-apl: [PASS][1] -> [FAIL][2] ([i915#39])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-apl4/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-apl7/igt@[email protected]

* igt@i915_suspend@sysfs-reader:
- shard-skl: [PASS][3] -> [INCOMPLETE][4] ([i915#69])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-skl4/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-skl5/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-256x256-sliding:
- shard-kbl: [PASS][5] -> [FAIL][6] ([i915#54] / [i915#93] / [i915#95])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-kbl2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-kbl6/igt@[email protected]

* igt@kms_cursor_legacy@pipe-b-torture-bo:
- shard-kbl: [PASS][7] -> [DMESG-WARN][8] ([i915#128])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-kbl6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-kbl2/igt@[email protected]

* igt@kms_dp_dsc@basic-dsc-enable-edp:
- shard-iclb: [PASS][9] -> [SKIP][10] ([fdo#109349])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-iclb2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-iclb7/igt@[email protected]

* igt@kms_hdr@bpc-switch-dpms:
- shard-skl: [PASS][11] -> [FAIL][12] ([i915#1188]) +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-skl8/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-skl3/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
- shard-kbl: [PASS][13] -> [DMESG-WARN][14] ([i915#180])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-kbl3/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-kbl1/igt@[email protected]
- shard-apl: [PASS][15] -> [DMESG-WARN][16] ([i915#180])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-apl1/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-apl4/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: [PASS][17] -> [FAIL][18] ([fdo#108145] / [i915#265])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-skl6/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-skl2/igt@[email protected]

* igt@kms_psr@psr2_sprite_render:
- shard-iclb: [PASS][19] -> [SKIP][20] ([fdo#109441]) +1 similar issue
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-iclb2/igt@kms_psr@psr2_sprite_render.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-iclb5/igt@kms_psr@psr2_sprite_render.html

* igt@kms_vblank@pipe-c-accuracy-idle:
- shard-glk: [PASS][21] -> [FAIL][22] ([i915#43])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-glk4/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-glk2/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_persistence@legacy-engines-mixed-process@vebox:
- shard-tglb: [FAIL][23] ([i915#1528]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-tglb6/igt@gem_ctx_persistence@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-tglb3/igt@gem_ctx_persistence@[email protected]

* igt@gem_exec_params@invalid-bsd-ring:
- shard-iclb: [SKIP][25] ([fdo#109276]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-iclb7/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-iclb2/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-suspend:
- shard-kbl: [DMESG-WARN][27] ([i915#180]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-kbl1/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-kbl2/igt@[email protected]

* {igt@kms_flip@flip-vs-suspend-interruptible@c-dp1}:
- shard-apl: [DMESG-WARN][29] ([i915#180]) -> [PASS][30] +4 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-apl1/igt@kms_flip@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-apl4/igt@kms_flip@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: [FAIL][31] ([fdo#108145] / [i915#265]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-skl9/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-skl6/igt@[email protected]

* igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-glk: [FAIL][33] ([i915#899]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-glk9/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-glk1/igt@[email protected]

* igt@kms_psr2_su@frontbuffer:
- shard-iclb: [SKIP][35] ([fdo#109642] / [fdo#111068]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-iclb5/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-iclb2/igt@[email protected]

* igt@kms_psr@psr2_no_drrs:
- shard-iclb: [SKIP][37] ([fdo#109441]) -> [PASS][38] +3 similar issues
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-iclb7/igt@kms_psr@psr2_no_drrs.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-iclb2/igt@kms_psr@psr2_no_drrs.html

* igt@kms_setmode@basic:
- shard-apl: [FAIL][39] ([i915#31]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-apl2/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-apl3/igt@[email protected]

* {igt@perf@blocking-parameterized}:
- shard-iclb: [FAIL][41] ([i915#1542]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-iclb3/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-iclb6/igt@[email protected]

#### Warnings ####

* igt@kms_content_protection@atomic-dpms:
- shard-apl: [TIMEOUT][43] ([i915#1319]) -> [FAIL][44] ([fdo#110321] / [fdo#110336]) +1 similar issue
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-apl2/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-apl7/igt@[email protected]

* igt@kms_psr2_su@page_flip:
- shard-iclb: [SKIP][45] ([fdo#109642] / [fdo#111068]) -> [FAIL][46] ([i915#608])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8384/shard-iclb5/igt@kms_psr2_su@page_flip.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17496/shard-iclb2/igt@kms_psr2_su@page_flip.html

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

[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#110321]: https://bugs.freedesktop.org/show_bug.cgi?id=110321
[fdo#110336]: https://bugs.freedesktop.org/show_bug.cgi?id=110336
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[i915#1188]: https://gitlab.freedesktop.org/drm/intel/issues/1188
[i915#128]: https://gitlab.freedesktop.org/drm/intel/issues/128
[i915#1319]: https://gitlab.freedesktop.org/drm/intel/issues/1319
[i915#1528]: https://gitlab.freedesktop.org/drm/intel/issues/1528
[i915#1542]: https://gitlab.freedesktop.org/drm/intel/issues/1542
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#31]: https://gitlab.freedesktop.org/drm/intel/issues/31
[i915#34]: https://gitlab.freedesktop.org/drm/intel/issues/34
[i915#39]: https://gitlab.freedesktop.org/drm/intel/issues/39
[i915#43]: https://gitlab.freedesktop.org/drm/intel/issues/43
[i915#54]: https://gitlab.freedesktop.org/drm/intel/issues/54
[i915#608]: https://gitlab.freedesktop.org/drm/intel/issues/608
[i915#69]: https://gitlab.freedesktop.org/drm/intel/issues/69
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#899]: https://gitlab.freedesktop.org/drm/intel/issues/899
[i915#93]: https://gitlab.freedesktop.org/drm/intel/issues/93
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95

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

No changes in participating hosts

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_8384 -> Patchwork_17496

CI-20190529: 20190529
CI_DRM_8384: 513c18c3d94d97a584c40998d2666f5e1390ac66 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5614: d095827add11d4e8158b87683971ee659749d9a4 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17496: a9abedc6ec4fba47e6d5cf17c849e32901bedb63 @ 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_17496/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Michal Orzel
Quoted 14 lines · Michal Orzel

As suggested by the TODO list for the kernel DRM subsystem, replace the deprecated functions that take/drop modeset locks with new helpers.

---
 drivers/gpu/drm/drm_mode_object.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_mode_object.c +0 -0
index 35c2719..901b078 100644
@@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 {

drivers/gpu/drm/drm_mode_object.c int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, · line 411

Quoted 10 lines
drivers/gpu/drm/drm_mode_object.c +2 -1
 	struct drm_mode_obj_get_properties *arg = data;
 	struct drm_mode_object *obj;
+	struct drm_modeset_acquire_ctx ctx;
 	int ret = 0;
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		return -EOPNOTSUPP;
 
-	drm_modeset_lock_all(dev);
+	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

I cry a little every time I look at the DRM_MODESET_LOCK_ALL_BEGIN and DRM_MODESET_LOCK_ALL_END macros. :(

Currently only six users... but there are ~60 calls to drm_modeset_lock_all{,_ctx} that I presume are to be replaced. I wonder if this will come back and haunt us.

BR,
Jani.

Quoted 36 lines
drivers/gpu/drm/drm_mode_object.c +4 -3
 	obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
 	if (!obj) {
@@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
 	drm_mode_object_put(obj);
 out:
-	drm_modeset_unlock_all(dev);
+	DRM_MODESET_LOCK_ALL_END(ctx, ret);
 	return ret;
 }
 
@@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
 {
 	struct drm_device *dev = prop->dev;
 	struct drm_mode_object *ref;
+	struct drm_modeset_acquire_ctx ctx;
 	int ret = -EINVAL;
 
 	if (!drm_property_change_valid_get(prop, prop_value, &ref))
 		return -EINVAL;
 
-	drm_modeset_lock_all(dev);
+	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
 	switch (obj->type) {
 	case DRM_MODE_OBJECT_CONNECTOR:
 		ret = drm_connector_set_obj_prop(obj, prop, prop_value);
@@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
 		break;
 	}
 	drm_property_change_valid_put(prop, ref);
-	drm_modeset_unlock_all(dev);
+	DRM_MODESET_LOCK_ALL_END(ctx, ret);
 
 	return ret;
 }
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 29 lines · Jani Nikula
Quoted 14 lines · Michal Orzel

As suggested by the TODO list for the kernel DRM subsystem, replace the deprecated functions that take/drop modeset locks with new helpers.

---
 drivers/gpu/drm/drm_mode_object.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_mode_object.c +0 -0
index 35c2719..901b078 100644
@@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 {

drivers/gpu/drm/drm_mode_object.c int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, · line 411

Quoted 10 lines
drivers/gpu/drm/drm_mode_object.c +2 -1
 	struct drm_mode_obj_get_properties *arg = data;
 	struct drm_mode_object *obj;
+	struct drm_modeset_acquire_ctx ctx;
 	int ret = 0;
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		return -EOPNOTSUPP;
 
-	drm_modeset_lock_all(dev);
+	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

I cry a little every time I look at the DRM_MODESET_LOCK_ALL_BEGIN and DRM_MODESET_LOCK_ALL_END macros. :(

Quoted 6 lines

Currently only six users... but there are ~60 calls to drm_modeset_lock_all{,_ctx} that I presume are to be replaced. I wonder if this will come back and haunt us.

BR,
Jani.

Hm, so we can either replace all of these calls(I think it's a better option) or abandon the idea of removing this deprecated function. In the latter scenario, it'd be beneficial to remove this from TODO.

Best regards
Michal

Quoted 39 lines
Quoted 38 lines
drivers/gpu/drm/drm_mode_object.c +4 -3
 	obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
 	if (!obj) {
@@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
 	drm_mode_object_put(obj);
 out:
-	drm_modeset_unlock_all(dev);
+	DRM_MODESET_LOCK_ALL_END(ctx, ret);
 	return ret;
 }
 
@@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
 {
 	struct drm_device *dev = prop->dev;
 	struct drm_mode_object *ref;
+	struct drm_modeset_acquire_ctx ctx;
 	int ret = -EINVAL;
 
 	if (!drm_property_change_valid_get(prop, prop_value, &ref))
 		return -EINVAL;
 
-	drm_modeset_lock_all(dev);
+	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
 	switch (obj->type) {
 	case DRM_MODE_OBJECT_CONNECTOR:
 		ret = drm_connector_set_obj_prop(obj, prop, prop_value);
@@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
 		break;
 	}
 	drm_property_change_valid_put(prop, ref);
-	drm_modeset_unlock_all(dev);
+	DRM_MODESET_LOCK_ALL_END(ctx, ret);
 
 	return ret;
 }
#5 lore raw
In reply to Jani Nikula
Quoted 30 lines · Jani Nikula
Quoted 14 lines · Michal Orzel

As suggested by the TODO list for the kernel DRM subsystem, replace the deprecated functions that take/drop modeset locks with new helpers.

---
 drivers/gpu/drm/drm_mode_object.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_mode_object.c +0 -0
index 35c2719..901b078 100644
@@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 {

drivers/gpu/drm/drm_mode_object.c int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, · line 411

Quoted 10 lines
drivers/gpu/drm/drm_mode_object.c +2 -1
      struct drm_mode_obj_get_properties *arg = data;
      struct drm_mode_object *obj;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = 0;
 
      if (!drm_core_check_feature(dev, DRIVER_MODESET))
              return -EOPNOTSUPP;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

I cry a little every time I look at the DRM_MODESET_LOCK_ALL_BEGIN and DRM_MODESET_LOCK_ALL_END macros. :(

Quoted 4 lines

Currently only six users... but there are ~60 calls to drm_modeset_lock_all{,_ctx} that I presume are to be replaced. I wonder if this will come back and haunt us.

What's the alternative? Seems like the options without the macros is to use incorrect scope or have a bunch of retry/backoff cargo-cult everywhere (and hope the copy source is done correctly).

Sean

Quoted 38 lines

BR,
Jani.

Quoted 34 lines
drivers/gpu/drm/drm_mode_object.c +4 -3
      obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
      if (!obj) {
@@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
      drm_mode_object_put(obj);
 out:
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
      return ret;
 }
 
@@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
 {
      struct drm_device *dev = prop->dev;
      struct drm_mode_object *ref;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = -EINVAL;
 
      if (!drm_property_change_valid_get(prop, prop_value, &ref))
              return -EINVAL;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
      switch (obj->type) {
      case DRM_MODE_OBJECT_CONNECTOR:
              ret = drm_connector_set_obj_prop(obj, prop, prop_value);
@@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
              break;
      }
      drm_property_change_valid_put(prop, ref);
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
 
Quoted 5 lines

drivers/gpu/drm/drm_mode_object.c static int set_property_legacy(struct drm_mode_object *obj, · line 476

Quoted 2 lines
drivers/gpu/drm/drm_mode_object.c +0 -0
      return ret;
 }

--
Jani Nikula, Intel Open Source Graphics Center

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

#6 lore raw
Quoted 32 lines · Sean Paul
Quoted 30 lines · Jani Nikula
Quoted 14 lines · Michal Orzel

As suggested by the TODO list for the kernel DRM subsystem, replace the deprecated functions that take/drop modeset locks with new helpers.

---
 drivers/gpu/drm/drm_mode_object.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_mode_object.c +0 -0
index 35c2719..901b078 100644
@@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 {

drivers/gpu/drm/drm_mode_object.c int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, · line 411

Quoted 10 lines
drivers/gpu/drm/drm_mode_object.c +2 -1
      struct drm_mode_obj_get_properties *arg = data;
      struct drm_mode_object *obj;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = 0;
 
      if (!drm_core_check_feature(dev, DRIVER_MODESET))
              return -EOPNOTSUPP;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

I cry a little every time I look at the DRM_MODESET_LOCK_ALL_BEGIN and DRM_MODESET_LOCK_ALL_END macros. :(

Quoted 8 lines
Quoted 4 lines

Currently only six users... but there are ~60 calls to drm_modeset_lock_all{,_ctx} that I presume are to be replaced. I wonder if this will come back and haunt us.

What's the alternative? Seems like the options without the macros is to use incorrect scope or have a bunch of retry/backoff cargo-cult everywhere (and hope the copy source is done correctly).

Yeah Sean & me had a bunch of bikesheds and this is the least worst option we could come up with. You can't make it a function because of the control flow. You don't want to open code this because it's tricky to get right, if all you want is to just grab all locks. But it is magic hidden behind a macro, which occasionally ends up hurting. -Daniel

Quoted 45 lines

Sean

Quoted 43 lines

BR,
Jani.

Quoted 28 lines
drivers/gpu/drm/drm_mode_object.c +3 -2
      obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
      if (!obj) {
@@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
      drm_mode_object_put(obj);
 out:
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
      return ret;
 }
 
@@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
 {
      struct drm_device *dev = prop->dev;
      struct drm_mode_object *ref;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = -EINVAL;
 
      if (!drm_property_change_valid_get(prop, prop_value, &ref))
              return -EINVAL;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
      switch (obj->type) {
      case DRM_MODE_OBJECT_CONNECTOR:
              ret = drm_connector_set_obj_prop(obj, prop, prop_value);

drivers/gpu/drm/drm_mode_object.c static int set_property_legacy(struct drm_mode_object *obj, · line 476

Quoted 8 lines
drivers/gpu/drm/drm_mode_object.c +1 -1
@@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
              break;
      }
      drm_property_change_valid_put(prop, ref);
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
 
      return ret;
 }

--
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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw
Quoted 42 lines · Daniel Vetter
Quoted 32 lines · Sean Paul
Quoted 30 lines · Jani Nikula
Quoted 14 lines · Michal Orzel

As suggested by the TODO list for the kernel DRM subsystem, replace the deprecated functions that take/drop modeset locks with new helpers.

---
 drivers/gpu/drm/drm_mode_object.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_mode_object.c +0 -0
index 35c2719..901b078 100644
@@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 {

drivers/gpu/drm/drm_mode_object.c int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, · line 411

Quoted 10 lines
drivers/gpu/drm/drm_mode_object.c +2 -1
      struct drm_mode_obj_get_properties *arg = data;
      struct drm_mode_object *obj;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = 0;
 
      if (!drm_core_check_feature(dev, DRIVER_MODESET))
              return -EOPNOTSUPP;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

I cry a little every time I look at the DRM_MODESET_LOCK_ALL_BEGIN and DRM_MODESET_LOCK_ALL_END macros. :(

Quoted 8 lines
Quoted 4 lines

Currently only six users... but there are ~60 calls to drm_modeset_lock_all{,_ctx} that I presume are to be replaced. I wonder if this will come back and haunt us.

What's the alternative? Seems like the options without the macros is to use incorrect scope or have a bunch of retry/backoff cargo-cult everywhere (and hope the copy source is done correctly).

Quoted 6 lines

Yeah Sean & me had a bunch of bikesheds and this is the least worst option we could come up with. You can't make it a function because of the control flow. You don't want to open code this because it's tricky to get right, if all you want is to just grab all locks. But it is magic hidden behind a macro, which occasionally ends up hurting. -Daniel

So what are we doing with this problem? Should we replace at once approx. 60 calls?

Michal

Quoted 41 lines
Quoted 41 lines

Sean

Quoted 38 lines

BR,
Jani.

Quoted 34 lines
drivers/gpu/drm/drm_mode_object.c +4 -3
      obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
      if (!obj) {
@@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
      drm_mode_object_put(obj);
 out:
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
      return ret;
 }
 
@@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
 {
      struct drm_device *dev = prop->dev;
      struct drm_mode_object *ref;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = -EINVAL;
 
      if (!drm_property_change_valid_get(prop, prop_value, &ref))
              return -EINVAL;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
      switch (obj->type) {
      case DRM_MODE_OBJECT_CONNECTOR:
              ret = drm_connector_set_obj_prop(obj, prop, prop_value);
@@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
              break;
      }
      drm_property_change_valid_put(prop, ref);
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
 
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/drm_mode_object.c static int set_property_legacy(struct drm_mode_object *obj, · line 476

Quoted 2 lines
drivers/gpu/drm/drm_mode_object.c +0 -0
      return ret;
 }

--
Jani Nikula, Intel Open Source Graphics Center

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

#8 lore raw
Quoted 45 lines · Michał Orzeł
Quoted 42 lines · Daniel Vetter
Quoted 40 lines · Sean Paul
Quoted 30 lines · Jani Nikula
Quoted 14 lines · Michal Orzel

As suggested by the TODO list for the kernel DRM subsystem, replace the deprecated functions that take/drop modeset locks with new helpers.

---
 drivers/gpu/drm/drm_mode_object.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_mode_object.c +0 -0
index 35c2719..901b078 100644
@@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 {

drivers/gpu/drm/drm_mode_object.c int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, · line 411

Quoted 10 lines
drivers/gpu/drm/drm_mode_object.c +2 -1
      struct drm_mode_obj_get_properties *arg = data;
      struct drm_mode_object *obj;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = 0;
 
      if (!drm_core_check_feature(dev, DRIVER_MODESET))
              return -EOPNOTSUPP;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

I cry a little every time I look at the DRM_MODESET_LOCK_ALL_BEGIN and DRM_MODESET_LOCK_ALL_END macros. :(

Quoted 4 lines

Currently only six users... but there are ~60 calls to drm_modeset_lock_all{,_ctx} that I presume are to be replaced. I wonder if this will come back and haunt us.

What's the alternative? Seems like the options without the macros is to use incorrect scope or have a bunch of retry/backoff cargo-cult everywhere (and hope the copy source is done correctly).

Quoted 7 lines
Quoted 6 lines

Yeah Sean & me had a bunch of bikesheds and this is the least worst option we could come up with. You can't make it a function because of the control flow. You don't want to open code this because it's tricky to get right, if all you want is to just grab all locks. But it is magic hidden behind a macro, which occasionally ends up hurting. -Daniel

So what are we doing with this problem? Should we replace at once approx. 60 calls?

I'm confused by your question - dradual conversion is entirely orthogonal to what exactly we're converting too. All I added here is that we've discussed this at length, and the macro is the best thing we've come up with. I still think it's the best compromise.

Flag-day conversion for over 60 calls doesn't work, no matter what. -Daniel

Quoted 51 lines

Michal

Quoted 49 lines
Quoted 46 lines

Sean

Quoted 43 lines

BR,
Jani.

Quoted 28 lines
drivers/gpu/drm/drm_mode_object.c +3 -2
      obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
      if (!obj) {
@@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
      drm_mode_object_put(obj);
 out:
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
      return ret;
 }
 
@@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
 {
      struct drm_device *dev = prop->dev;
      struct drm_mode_object *ref;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = -EINVAL;
 
      if (!drm_property_change_valid_get(prop, prop_value, &ref))
              return -EINVAL;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
      switch (obj->type) {
      case DRM_MODE_OBJECT_CONNECTOR:
              ret = drm_connector_set_obj_prop(obj, prop, prop_value);

drivers/gpu/drm/drm_mode_object.c static int set_property_legacy(struct drm_mode_object *obj, · line 476

Quoted 8 lines
drivers/gpu/drm/drm_mode_object.c +1 -1
@@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
              break;
      }
      drm_property_change_valid_put(prop, ref);
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
 
      return ret;
 }

--
Jani Nikula, Intel Open Source Graphics Center

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw
Quoted 54 lines · Daniel Vetter
Quoted 45 lines · Michał Orzeł
Quoted 42 lines · Daniel Vetter
Quoted 40 lines · Sean Paul
Quoted 30 lines · Jani Nikula
Quoted 14 lines · Michal Orzel

As suggested by the TODO list for the kernel DRM subsystem, replace the deprecated functions that take/drop modeset locks with new helpers.

---
 drivers/gpu/drm/drm_mode_object.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_mode_object.c +0 -0
index 35c2719..901b078 100644
@@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 {

drivers/gpu/drm/drm_mode_object.c int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, · line 411

Quoted 10 lines
drivers/gpu/drm/drm_mode_object.c +2 -1
      struct drm_mode_obj_get_properties *arg = data;
      struct drm_mode_object *obj;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = 0;
 
      if (!drm_core_check_feature(dev, DRIVER_MODESET))
              return -EOPNOTSUPP;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

I cry a little every time I look at the DRM_MODESET_LOCK_ALL_BEGIN and DRM_MODESET_LOCK_ALL_END macros. :(

Quoted 4 lines

Currently only six users... but there are ~60 calls to drm_modeset_lock_all{,_ctx} that I presume are to be replaced. I wonder if this will come back and haunt us.

What's the alternative? Seems like the options without the macros is to use incorrect scope or have a bunch of retry/backoff cargo-cult everywhere (and hope the copy source is done correctly).

Quoted 7 lines
Quoted 6 lines

Yeah Sean & me had a bunch of bikesheds and this is the least worst option we could come up with. You can't make it a function because of the control flow. You don't want to open code this because it's tricky to get right, if all you want is to just grab all locks. But it is magic hidden behind a macro, which occasionally ends up hurting. -Daniel

So what are we doing with this problem? Should we replace at once approx. 60 calls?

Quoted 8 lines

I'm confused by your question - dradual conversion is entirely orthogonal to what exactly we're converting too. All I added here is that we've discussed this at length, and the macro is the best thing we've come up with. I still think it's the best compromise.

Flag-day conversion for over 60 calls doesn't work, no matter what. -Daniel

I agree with that. All I wanted to ask was whether I should add something additional to this patch or not.

Thanks,
Michal

Quoted 43 lines
Quoted 43 lines

Michal

Quoted 41 lines
Quoted 41 lines

Sean

Quoted 38 lines

BR,
Jani.

Quoted 34 lines
drivers/gpu/drm/drm_mode_object.c +4 -3
      obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
      if (!obj) {
@@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
      drm_mode_object_put(obj);
 out:
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
      return ret;
 }
 
@@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
 {
      struct drm_device *dev = prop->dev;
      struct drm_mode_object *ref;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = -EINVAL;
 
      if (!drm_property_change_valid_get(prop, prop_value, &ref))
              return -EINVAL;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
      switch (obj->type) {
      case DRM_MODE_OBJECT_CONNECTOR:
              ret = drm_connector_set_obj_prop(obj, prop, prop_value);
@@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
              break;
      }
      drm_property_change_valid_put(prop, ref);
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
 
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/drm_mode_object.c static int set_property_legacy(struct drm_mode_object *obj, · line 476

Quoted 2 lines
drivers/gpu/drm/drm_mode_object.c +0 -0
      return ret;
 }

--
Jani Nikula, Intel Open Source Graphics Center

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

#10 lore raw
Quoted 62 lines · Michał Orzeł
Quoted 59 lines · Daniel Vetter
Quoted 45 lines · Michał Orzeł
Quoted 42 lines · Daniel Vetter
Quoted 40 lines · Sean Paul
Quoted 30 lines · Jani Nikula
Quoted 14 lines · Michal Orzel

As suggested by the TODO list for the kernel DRM subsystem, replace the deprecated functions that take/drop modeset locks with new helpers.

---
 drivers/gpu/drm/drm_mode_object.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_mode_object.c +0 -0
index 35c2719..901b078 100644
@@ -402,12 +402,13 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 {

drivers/gpu/drm/drm_mode_object.c int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, · line 411

Quoted 10 lines
drivers/gpu/drm/drm_mode_object.c +2 -1
      struct drm_mode_obj_get_properties *arg = data;
      struct drm_mode_object *obj;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = 0;
 
      if (!drm_core_check_feature(dev, DRIVER_MODESET))
              return -EOPNOTSUPP;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

I cry a little every time I look at the DRM_MODESET_LOCK_ALL_BEGIN and DRM_MODESET_LOCK_ALL_END macros. :(

Quoted 4 lines

Currently only six users... but there are ~60 calls to drm_modeset_lock_all{,_ctx} that I presume are to be replaced. I wonder if this will come back and haunt us.

What's the alternative? Seems like the options without the macros is to use incorrect scope or have a bunch of retry/backoff cargo-cult everywhere (and hope the copy source is done correctly).

Quoted 7 lines
Quoted 6 lines

Yeah Sean & me had a bunch of bikesheds and this is the least worst option we could come up with. You can't make it a function because of the control flow. You don't want to open code this because it's tricky to get right, if all you want is to just grab all locks. But it is magic hidden behind a macro, which occasionally ends up hurting. -Daniel

So what are we doing with this problem? Should we replace at once approx. 60 calls?

I'm confused by your question - dradual conversion is entirely orthogonal to what exactly we're converting too. All I added here is that we've discussed this at length, and the macro is the best thing we've come up with. I still think it's the best compromise.

Quoted 4 lines
Quoted 3 lines

Flag-day conversion for over 60 calls doesn't work, no matter what. -Daniel

I agree with that. All I wanted to ask was whether I should add something additional to this patch or not.

Patch looks good and passed CI, so I went ahead and applied it.

Thanks, Daniel

Quoted 55 lines

Thanks,
Michal

Quoted 52 lines
Quoted 51 lines

Michal

Quoted 49 lines
Quoted 46 lines

Sean

Quoted 43 lines

BR,
Jani.

Quoted 28 lines
drivers/gpu/drm/drm_mode_object.c +3 -2
      obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
      if (!obj) {
@@ -427,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
      drm_mode_object_put(obj);
 out:
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
      return ret;
 }
 
@@ -449,12 +450,13 @@ static int set_property_legacy(struct drm_mode_object *obj,
 {
      struct drm_device *dev = prop->dev;
      struct drm_mode_object *ref;
+     struct drm_modeset_acquire_ctx ctx;
      int ret = -EINVAL;
 
      if (!drm_property_change_valid_get(prop, prop_value, &ref))
              return -EINVAL;
 
-     drm_modeset_lock_all(dev);
+     DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
      switch (obj->type) {
      case DRM_MODE_OBJECT_CONNECTOR:
              ret = drm_connector_set_obj_prop(obj, prop, prop_value);

drivers/gpu/drm/drm_mode_object.c static int set_property_legacy(struct drm_mode_object *obj, · line 476

Quoted 8 lines
drivers/gpu/drm/drm_mode_object.c +1 -1
@@ -468,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
              break;
      }
      drm_property_change_valid_put(prop, ref);
-     drm_modeset_unlock_all(dev);
+     DRM_MODESET_LOCK_ALL_END(ctx, ret);
 
      return ret;
 }

--
Jani Nikula, Intel Open Source Graphics Center

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx