Skip to contentSkip to conversation

drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()

PATCH In review Thomas Zimmermann 4 participants 9 messages Feb 16, 2023 – Feb 21, 2023

Subsystems (14)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()

Move drm_fb_helper_unprepare() from drm_fb_helper_fini() into the calling fbdev implementation. Avoids a possible stale mutex with generic fbdev code.

As indicated by its name, drm_fb_helper_prepare() prepares struct drm_fb_helper before setting up the fbdev support with a call to drm_fb_helper_init(). In legacy fbdev emulation, this happens next to each other. If successful, drm_fb_helper_fini() later tear down the fbdev device and also unprepare via drm_fb_helper_unprepare().

Generic fbdev emulation prepares struct drm_fb_helper immediately after allocating the instance. It only calls drm_fb_helper_init() as part of processing a hotplug event. If the hotplug-handling fails, it runs drm_fb_helper_fini(). This unprepares the fb-helper instance and the next hotplug event runs on stale data.

Solve this by moving drm_fb_helper_unprepare() from drm_fb_helper_fini() into the fbdev implementations. Call it right before freeing the fb-helper instance.

Fixes 4825797c36da ("drm/fb-helper: Introduce drm_fb_helper_unprepare()")
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/armada/armada_fbdev.c      | 3 +++
 drivers/gpu/drm/drm_fb_helper.c            | 2 --
 drivers/gpu/drm/drm_fbdev_generic.c        | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c  | 3 ++-
 drivers/gpu/drm/gma500/framebuffer.c       | 2 ++
 drivers/gpu/drm/i915/display/intel_fbdev.c | 1 +
 drivers/gpu/drm/msm/msm_fbdev.c            | 2 ++
 drivers/gpu/drm/omapdrm/omap_fbdev.c       | 2 ++
 drivers/gpu/drm/radeon/radeon_fb.c         | 2 ++
 drivers/gpu/drm/tegra/fb.c                 | 1 +
 10 files changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/armada/armada_fbdev.c +3 -0
index 07e410c62b7a..0e44f53e9fa4 100644
@@ -147,6 +147,7 @@ int armada_fbdev_init(struct drm_device *dev)
  err_fb_setup:
 	drm_fb_helper_fini(fbh);
  err_fb_helper:
+	drm_fb_helper_unprepare(fbh);
 	priv->fbdev = NULL;
 	return ret;
 }
@@ -164,6 +165,8 @@ void armada_fbdev_fini(struct drm_device *dev)
 		if (fbh->fb)
 			fbh->fb->funcs->destroy(fbh->fb);
 
+		drm_fb_helper_unprepare(fbh);
+
 		priv->fbdev = NULL;
 	}
 }
drivers/gpu/drm/drm_fb_helper.c +0 -2
index 28c428e9c530..a39998047f8a 100644
@@ -590,8 +590,6 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
 	}
 	mutex_unlock(&kernel_fb_helper_lock);
 
-	drm_fb_helper_unprepare(fb_helper);
-
 	if (!fb_helper->client.funcs)
 		drm_client_release(&fb_helper->client);
 }
drivers/gpu/drm/drm_fbdev_generic.c +2 -0
index 365f80717fa1..4d6325e91565 100644
@@ -65,6 +65,8 @@ static void drm_fbdev_fb_destroy(struct fb_info *info)
 
 	drm_client_framebuffer_delete(fb_helper->buffer);
 	drm_client_release(&fb_helper->client);
+
+	drm_fb_helper_unprepare(fb_helper);
 	kfree(fb_helper);
 }
 
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +2 -1
index b89e33af8da8..4929ffe5a09a 100644
@@ -183,8 +183,8 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
 
 err_setup:
 	drm_fb_helper_fini(helper);
-
 err_init:
+	drm_fb_helper_unprepare(helper);
 	private->fb_helper = NULL;
 	kfree(fbdev);
 
@@ -219,6 +219,7 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
 	fbdev = to_exynos_fbdev(private->fb_helper);
 
 	exynos_drm_fbdev_destroy(dev, private->fb_helper);
+	drm_fb_helper_unprepare(private->fb_helper);
 	kfree(fbdev);
 	private->fb_helper = NULL;
 }
drivers/gpu/drm/gma500/framebuffer.c +2 -0
index 1f04c07ee180..f471e0cb7298 100644
@@ -427,6 +427,7 @@ int psb_fbdev_init(struct drm_device *dev)
 fini:
 	drm_fb_helper_fini(fb_helper);
 free:
+	drm_fb_helper_unprepare(fb_helper);
 	kfree(fb_helper);
 	return ret;
 }
@@ -439,6 +440,7 @@ static void psb_fbdev_fini(struct drm_device *dev)
 		return;
 
 	psb_fbdev_destroy(dev, dev_priv->fb_helper);
+	drm_fb_helper_unprepare(dev_priv->fb_helper);
 	kfree(dev_priv->fb_helper);
 	dev_priv->fb_helper = NULL;
 }
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -0
index 6113d7627d45..98029059f701 100644
@@ -352,6 +352,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
 	if (ifbdev->fb)
 		drm_framebuffer_remove(&ifbdev->fb->base);
 
+	drm_fb_helper_unprepare(&ifbdev->helper);
 	kfree(ifbdev);
 }
 
drivers/gpu/drm/msm/msm_fbdev.c +2 -0
index 915b213f3a5c..c804e5ba682a 100644
@@ -170,6 +170,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
 fini:
 	drm_fb_helper_fini(helper);
 fail:
+	drm_fb_helper_unprepare(helper);
 	kfree(fbdev);
 	return NULL;
 }
@@ -196,6 +197,7 @@ void msm_fbdev_free(struct drm_device *dev)
 		drm_framebuffer_remove(fbdev->fb);
 	}
 
+	drm_fb_helper_unprepare(helper);
 	kfree(fbdev);
 
 	priv->fbdev = NULL;
drivers/gpu/drm/omapdrm/omap_fbdev.c +2 -0
index fc5f52d567c6..84429728347f 100644
@@ -256,6 +256,7 @@ void omap_fbdev_init(struct drm_device *dev)
 fini:
 	drm_fb_helper_fini(helper);
 fail:
+	drm_fb_helper_unprepare(helper);
 	kfree(fbdev);
 
 	dev_warn(dev->dev, "omap_fbdev_init failed\n");
@@ -286,6 +287,7 @@ void omap_fbdev_fini(struct drm_device *dev)
 	if (fbdev->fb)
 		drm_framebuffer_remove(fbdev->fb);
 
+	drm_fb_helper_unprepare(helper);
 	kfree(fbdev);
 
 	priv->fbdev = NULL;
drivers/gpu/drm/radeon/radeon_fb.c +2 -0
index 6e5eed0e157c..c4807f0c43bc 100644
@@ -367,6 +367,7 @@ int radeon_fbdev_init(struct radeon_device *rdev)
 fini:
 	drm_fb_helper_fini(&rfbdev->helper);
 free:
+	drm_fb_helper_unprepare(&rfbdev->helper);
 	kfree(rfbdev);
 	return ret;
 }
@@ -377,6 +378,7 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
 		return;
 
 	radeon_fbdev_destroy(rdev->ddev, rdev->mode_info.rfbdev);
+	drm_fb_helper_unprepare(&rdev->mode_info.rfbdev->helper);
 	kfree(rdev->mode_info.rfbdev);
 	rdev->mode_info.rfbdev = NULL;
 }
drivers/gpu/drm/tegra/fb.c +1 -0
index 153c39c32c71..bfebe2786d61 100644
@@ -315,6 +315,7 @@ static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm)
 
 static void tegra_fbdev_free(struct tegra_fbdev *fbdev)
 {
+	drm_fb_helper_unprepare(&fbdev->base);
 	kfree(fbdev);
 }
 
Signature · 1 line
2.39.1
#1 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()

== Series Details ==

== Series Details ==

Series: drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()
URL : https://patchwork.freedesktop.org/series/114106/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12751 -> Patchwork_114106v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (38 -> 38)
------------------------------

Additional (2): bat-atsm-1 fi-pnv-d510
Missing (2): fi-kbl-soraka fi-snb-2520m

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

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

### IGT changes ###

#### Issues hit ####

* igt@fbdev@eof:
- bat-atsm-1: NOTRUN -> [SKIP][1] ([i915#2582]) +4 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@gem_mmap@basic:
- bat-atsm-1: NOTRUN -> [SKIP][2] ([i915#4083])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@gem_tiled_fence_blits@basic:
- bat-atsm-1: NOTRUN -> [SKIP][3] ([i915#4077]) +2 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@gem_tiled_pread_basic:
- bat-atsm-1: NOTRUN -> [SKIP][4] ([i915#4079]) +1 similar issue
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@gem_tiled_pread_basic.html

* igt@i915_pm_rps@basic-api:
- bat-atsm-1: NOTRUN -> [SKIP][5] ([i915#6621])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@i915_selftest@live@gt_pm:
- bat-rpls-2: [PASS][6] -> [DMESG-FAIL][7] ([i915#4258])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/bat-rpls-2/igt@i915_selftest@live@gt_pm.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-rpls-2/igt@i915_selftest@live@gt_pm.html

* igt@i915_selftest@live@slpc:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][8] ([i915#6367] / [i915#7996])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-rpls-2/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- bat-atsm-1: NOTRUN -> [SKIP][9] ([i915#6645])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@kms_addfb_basic@size-max:
- bat-atsm-1: NOTRUN -> [SKIP][10] ([i915#6077]) +36 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-rpls-2: NOTRUN -> [SKIP][11] ([i915#7828])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-rpls-2/igt@[email protected]

* igt@kms_cursor_legacy@basic-flip-after-cursor:
- bat-atsm-1: NOTRUN -> [SKIP][12] ([i915#6078]) +14 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@kms_flip@basic-plain-flip:
- bat-atsm-1: NOTRUN -> [SKIP][13] ([i915#6166]) +3 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@kms_force_connector_basic@prune-stale-modes:
- bat-atsm-1: NOTRUN -> [SKIP][14] ([i915#6093]) +3 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@kms_pipe_crc_basic@hang-read-crc:
- bat-atsm-1: NOTRUN -> [SKIP][15] ([i915#1836]) +6 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc:
- bat-adlp-9: NOTRUN -> [SKIP][16] ([i915#3546]) +1 similar issue
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-adlp-9/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc:
- bat-rpls-2: NOTRUN -> [SKIP][17] ([i915#1845])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-rpls-2/igt@[email protected]

* igt@kms_prop_blob@basic:
- bat-atsm-1: NOTRUN -> [SKIP][18] ([i915#7357])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-pnv-d510: NOTRUN -> [SKIP][19] ([fdo#109271]) +44 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/fi-pnv-d510/igt@kms_psr@primary_page_flip.html

* igt@kms_psr@sprite_plane_onoff:
- bat-atsm-1: NOTRUN -> [SKIP][20] ([i915#1072]) +3 similar issues
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@kms_psr@sprite_plane_onoff.html

* igt@kms_setmode@basic-clone-single-crtc:
- bat-atsm-1: NOTRUN -> [SKIP][21] ([i915#6094])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@prime_vgem@basic-fence-flip:
- bat-atsm-1: NOTRUN -> [SKIP][22] ([fdo#109295] / [i915#6078])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@prime_vgem@basic-fence-mmap:
- bat-atsm-1: NOTRUN -> [SKIP][23] ([fdo#109295] / [i915#4077]) +1 similar issue
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

* igt@prime_vgem@basic-write:
- bat-atsm-1: NOTRUN -> [SKIP][24] ([fdo#109295]) +3 similar issues
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-atsm-1/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@reset:
- bat-rpls-2: [ABORT][25] ([i915#4983]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/bat-rpls-2/igt@i915_selftest@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-rpls-2/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@slpc:
- bat-rpls-1: [DMESG-FAIL][27] ([i915#6367] / [i915#7996]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/bat-rpls-1/igt@i915_selftest@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/bat-rpls-1/igt@i915_selftest@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1836]: https://gitlab.freedesktop.org/drm/intel/issues/1836
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6077]: https://gitlab.freedesktop.org/drm/intel/issues/6077
[i915#6078]: https://gitlab.freedesktop.org/drm/intel/issues/6078
[i915#6093]: https://gitlab.freedesktop.org/drm/intel/issues/6093
[i915#6094]: https://gitlab.freedesktop.org/drm/intel/issues/6094
[i915#6166]: https://gitlab.freedesktop.org/drm/intel/issues/6166
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#7357]: https://gitlab.freedesktop.org/drm/intel/issues/7357
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7996]: https://gitlab.freedesktop.org/drm/intel/issues/7996

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

* Linux: CI_DRM_12751 -> Patchwork_114106v1

CI-20190529: 20190529
CI_DRM_12751: b6ba15d59cdc7e7d488646370f9ca6b0a36f9db5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7161: 5574f110ae838031eef6db5236bad02e8c2d2dee @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114106v1: b6ba15d59cdc7e7d488646370f9ca6b0a36f9db5 @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

73381d1e45b1 drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/index.html

Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Zimmermann
Quoted 29 lines · Thomas Zimmermann

Move drm_fb_helper_unprepare() from drm_fb_helper_fini() into the calling fbdev implementation. Avoids a possible stale mutex with generic fbdev code.

As indicated by its name, drm_fb_helper_prepare() prepares struct drm_fb_helper before setting up the fbdev support with a call to drm_fb_helper_init(). In legacy fbdev emulation, this happens next to each other. If successful, drm_fb_helper_fini() later tear down the fbdev device and also unprepare via drm_fb_helper_unprepare().

Generic fbdev emulation prepares struct drm_fb_helper immediately after allocating the instance. It only calls drm_fb_helper_init() as part of processing a hotplug event. If the hotplug-handling fails, it runs drm_fb_helper_fini(). This unprepares the fb-helper instance and the next hotplug event runs on stale data.

Solve this by moving drm_fb_helper_unprepare() from drm_fb_helper_fini() into the fbdev implementations. Call it right before freeing the fb-helper instance.

Fixes 4825797c36da ("drm/fb-helper: Introduce drm_fb_helper_unprepare()")
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Quoted 1 line

This reminds me of an old patch I just recently stumbled over again:

https://lore.kernel.org/dri-devel/[email protected]/

Should I resurrect that one maybe and send it out? I think that also ties a bit into your story here.

drivers/gpu/drm/drm_fb_helper.c void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)

Quoted 39 lines
---
 drivers/gpu/drm/armada/armada_fbdev.c      | 3 +++
 drivers/gpu/drm/drm_fb_helper.c            | 2 --
 drivers/gpu/drm/drm_fbdev_generic.c        | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c  | 3 ++-
 drivers/gpu/drm/gma500/framebuffer.c       | 2 ++
 drivers/gpu/drm/i915/display/intel_fbdev.c | 1 +
 drivers/gpu/drm/msm/msm_fbdev.c            | 2 ++
 drivers/gpu/drm/omapdrm/omap_fbdev.c       | 2 ++
 drivers/gpu/drm/radeon/radeon_fb.c         | 2 ++
 drivers/gpu/drm/tegra/fb.c                 | 1 +
 10 files changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/armada/armada_fbdev.c +3 -0
index 07e410c62b7a..0e44f53e9fa4 100644
@@ -147,6 +147,7 @@ int armada_fbdev_init(struct drm_device *dev)
  err_fb_setup:
 	drm_fb_helper_fini(fbh);
  err_fb_helper:
+	drm_fb_helper_unprepare(fbh);
 	priv->fbdev = NULL;
 	return ret;
 }
@@ -164,6 +165,8 @@ void armada_fbdev_fini(struct drm_device *dev)
 		if (fbh->fb)
 			fbh->fb->funcs->destroy(fbh->fb);
 
+		drm_fb_helper_unprepare(fbh);
+
 		priv->fbdev = NULL;
 	}
 }
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 28c428e9c530..a39998047f8a 100644
@@ -590,8 +590,6 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)

I think it would be good to update the kerneldoc of _init() and _fini() here to mention each another like we usually do with these pairs. Same with prepare/unprepare() although the latter rerfences _prepare() already.

Quoted 140 lines
drivers/gpu/drm/drm_fb_helper.c +0 -2
 	}
 	mutex_unlock(&kernel_fb_helper_lock);
 
-	drm_fb_helper_unprepare(fb_helper);
-
 	if (!fb_helper->client.funcs)
 		drm_client_release(&fb_helper->client);
 }
drivers/gpu/drm/drm_fbdev_generic.c +2 -0
index 365f80717fa1..4d6325e91565 100644
@@ -65,6 +65,8 @@ static void drm_fbdev_fb_destroy(struct fb_info *info)
 
 	drm_client_framebuffer_delete(fb_helper->buffer);
 	drm_client_release(&fb_helper->client);
+
+	drm_fb_helper_unprepare(fb_helper);
 	kfree(fb_helper);
 }
 
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +2 -1
index b89e33af8da8..4929ffe5a09a 100644
@@ -183,8 +183,8 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
 
 err_setup:
 	drm_fb_helper_fini(helper);
-
 err_init:
+	drm_fb_helper_unprepare(helper);
 	private->fb_helper = NULL;
 	kfree(fbdev);
 
@@ -219,6 +219,7 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
 	fbdev = to_exynos_fbdev(private->fb_helper);
 
 	exynos_drm_fbdev_destroy(dev, private->fb_helper);
+	drm_fb_helper_unprepare(private->fb_helper);
 	kfree(fbdev);
 	private->fb_helper = NULL;
 }
drivers/gpu/drm/gma500/framebuffer.c +2 -0
index 1f04c07ee180..f471e0cb7298 100644
@@ -427,6 +427,7 @@ int psb_fbdev_init(struct drm_device *dev)
 fini:
 	drm_fb_helper_fini(fb_helper);
 free:
+	drm_fb_helper_unprepare(fb_helper);
 	kfree(fb_helper);
 	return ret;
 }
@@ -439,6 +440,7 @@ static void psb_fbdev_fini(struct drm_device *dev)
 		return;
 
 	psb_fbdev_destroy(dev, dev_priv->fb_helper);
+	drm_fb_helper_unprepare(dev_priv->fb_helper);
 	kfree(dev_priv->fb_helper);
 	dev_priv->fb_helper = NULL;
 }
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -0
index 6113d7627d45..98029059f701 100644
@@ -352,6 +352,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
 	if (ifbdev->fb)
 		drm_framebuffer_remove(&ifbdev->fb->base);
 
+	drm_fb_helper_unprepare(&ifbdev->helper);
 	kfree(ifbdev);
 }
 
drivers/gpu/drm/msm/msm_fbdev.c +2 -0
index 915b213f3a5c..c804e5ba682a 100644
@@ -170,6 +170,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
 fini:
 	drm_fb_helper_fini(helper);
 fail:
+	drm_fb_helper_unprepare(helper);
 	kfree(fbdev);
 	return NULL;
 }
@@ -196,6 +197,7 @@ void msm_fbdev_free(struct drm_device *dev)
 		drm_framebuffer_remove(fbdev->fb);
 	}
 
+	drm_fb_helper_unprepare(helper);
 	kfree(fbdev);
 
 	priv->fbdev = NULL;
drivers/gpu/drm/omapdrm/omap_fbdev.c +2 -0
index fc5f52d567c6..84429728347f 100644
@@ -256,6 +256,7 @@ void omap_fbdev_init(struct drm_device *dev)
 fini:
 	drm_fb_helper_fini(helper);
 fail:
+	drm_fb_helper_unprepare(helper);
 	kfree(fbdev);
 
 	dev_warn(dev->dev, "omap_fbdev_init failed\n");
@@ -286,6 +287,7 @@ void omap_fbdev_fini(struct drm_device *dev)
 	if (fbdev->fb)
 		drm_framebuffer_remove(fbdev->fb);
 
+	drm_fb_helper_unprepare(helper);
 	kfree(fbdev);
 
 	priv->fbdev = NULL;
drivers/gpu/drm/radeon/radeon_fb.c +2 -0
index 6e5eed0e157c..c4807f0c43bc 100644
@@ -367,6 +367,7 @@ int radeon_fbdev_init(struct radeon_device *rdev)
 fini:
 	drm_fb_helper_fini(&rfbdev->helper);
 free:
+	drm_fb_helper_unprepare(&rfbdev->helper);
 	kfree(rfbdev);
 	return ret;
 }
@@ -377,6 +378,7 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
 		return;
 
 	radeon_fbdev_destroy(rdev->ddev, rdev->mode_info.rfbdev);
+	drm_fb_helper_unprepare(&rdev->mode_info.rfbdev->helper);
 	kfree(rdev->mode_info.rfbdev);
 	rdev->mode_info.rfbdev = NULL;
 }
drivers/gpu/drm/tegra/fb.c +0 -0
index 153c39c32c71..bfebe2786d61 100644

drivers/gpu/drm/tegra/fb.c static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm) · line 318

Quoted 4 lines
drivers/gpu/drm/tegra/fb.c +1 -0
@@ -315,6 +315,7 @@ static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm)
 
 static void tegra_fbdev_free(struct tegra_fbdev *fbdev)
 {
+	drm_fb_helper_unprepare(&fbdev->base);

Ok this one tegra change was a bit tricky, drivers really should just use drmm_/devm_ for everything :-)

With the kerneldoc augmented:

Quoted 6 lines
drivers/gpu/drm/tegra/fb.c +0 -0
 	kfree(fbdev);
 }
 
Signature · 1 line
2.39.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
author maintainer
#3 lore raw

Hi

Am 16.02.23 um 21:11 schrieb Daniel Vetter:

Quoted 30 lines · Thomas Zimmermann
Quoted 29 lines

Move drm_fb_helper_unprepare() from drm_fb_helper_fini() into the calling fbdev implementation. Avoids a possible stale mutex with generic fbdev code.

As indicated by its name, drm_fb_helper_prepare() prepares struct drm_fb_helper before setting up the fbdev support with a call to drm_fb_helper_init(). In legacy fbdev emulation, this happens next to each other. If successful, drm_fb_helper_fini() later tear down the fbdev device and also unprepare via drm_fb_helper_unprepare().

Generic fbdev emulation prepares struct drm_fb_helper immediately after allocating the instance. It only calls drm_fb_helper_init() as part of processing a hotplug event. If the hotplug-handling fails, it runs drm_fb_helper_fini(). This unprepares the fb-helper instance and the next hotplug event runs on stale data.

Solve this by moving drm_fb_helper_unprepare() from drm_fb_helper_fini() into the fbdev implementations. Call it right before freeing the fb-helper instance.

Fixes 4825797c36da ("drm/fb-helper: Introduce drm_fb_helper_unprepare()")
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Quoted 8 lines
Quoted 1 line

This reminds me of an old patch I just recently stumbled over again:

https://lore.kernel.org/dri-devel/[email protected]/

Should I resurrect that one maybe and send it out? I think that also ties a bit into your story here.

I don't think it will be necessary. I began to convert the existing fbdev emulation to make use of drm_client, which should resove a number of problems. I expect to post this after the various trees have merged the recent changes to fbdev helpers.

Best regards
Thomas

Quoted 204 lines

drivers/gpu/drm/drm_fb_helper.c void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)

Quoted 40 lines
---
  drivers/gpu/drm/armada/armada_fbdev.c      | 3 +++
  drivers/gpu/drm/drm_fb_helper.c            | 2 --
  drivers/gpu/drm/drm_fbdev_generic.c        | 2 ++
  drivers/gpu/drm/exynos/exynos_drm_fbdev.c  | 3 ++-
  drivers/gpu/drm/gma500/framebuffer.c       | 2 ++
  drivers/gpu/drm/i915/display/intel_fbdev.c | 1 +
  drivers/gpu/drm/msm/msm_fbdev.c            | 2 ++
  drivers/gpu/drm/omapdrm/omap_fbdev.c       | 2 ++
  drivers/gpu/drm/radeon/radeon_fb.c         | 2 ++
  drivers/gpu/drm/tegra/fb.c                 | 1 +
  10 files changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/armada/armada_fbdev.c +3 -0
index 07e410c62b7a..0e44f53e9fa4 100644
@@ -147,6 +147,7 @@ int armada_fbdev_init(struct drm_device *dev)
   err_fb_setup:
  	drm_fb_helper_fini(fbh);
   err_fb_helper:
+	drm_fb_helper_unprepare(fbh);
  	priv->fbdev = NULL;
  	return ret;
  }
@@ -164,6 +165,8 @@ void armada_fbdev_fini(struct drm_device *dev)
  		if (fbh->fb)
  			fbh->fb->funcs->destroy(fbh->fb);
 
+		drm_fb_helper_unprepare(fbh);
+
  		priv->fbdev = NULL;
  	}
  }
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 28c428e9c530..a39998047f8a 100644
@@ -590,8 +590,6 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)

I think it would be good to update the kerneldoc of _init() and _fini() here to mention each another like we usually do with these pairs. Same with prepare/unprepare() although the latter rerfences _prepare() already.

Quoted 140 lines
drivers/gpu/drm/drm_fb_helper.c +0 -2
  	}
  	mutex_unlock(&kernel_fb_helper_lock);
 
-	drm_fb_helper_unprepare(fb_helper);
-
  	if (!fb_helper->client.funcs)
  		drm_client_release(&fb_helper->client);
  }
drivers/gpu/drm/drm_fbdev_generic.c +2 -0
index 365f80717fa1..4d6325e91565 100644
@@ -65,6 +65,8 @@ static void drm_fbdev_fb_destroy(struct fb_info *info)
 
  	drm_client_framebuffer_delete(fb_helper->buffer);
  	drm_client_release(&fb_helper->client);
+
+	drm_fb_helper_unprepare(fb_helper);
  	kfree(fb_helper);
  }
 
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +2 -1
index b89e33af8da8..4929ffe5a09a 100644
@@ -183,8 +183,8 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
 
  err_setup:
  	drm_fb_helper_fini(helper);
-
  err_init:
+	drm_fb_helper_unprepare(helper);
  	private->fb_helper = NULL;
  	kfree(fbdev);
 
@@ -219,6 +219,7 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
  	fbdev = to_exynos_fbdev(private->fb_helper);
 
  	exynos_drm_fbdev_destroy(dev, private->fb_helper);
+	drm_fb_helper_unprepare(private->fb_helper);
  	kfree(fbdev);
  	private->fb_helper = NULL;
  }
drivers/gpu/drm/gma500/framebuffer.c +2 -0
index 1f04c07ee180..f471e0cb7298 100644
@@ -427,6 +427,7 @@ int psb_fbdev_init(struct drm_device *dev)
  fini:
  	drm_fb_helper_fini(fb_helper);
  free:
+	drm_fb_helper_unprepare(fb_helper);
  	kfree(fb_helper);
  	return ret;
  }
@@ -439,6 +440,7 @@ static void psb_fbdev_fini(struct drm_device *dev)
  		return;
 
  	psb_fbdev_destroy(dev, dev_priv->fb_helper);
+	drm_fb_helper_unprepare(dev_priv->fb_helper);
  	kfree(dev_priv->fb_helper);
  	dev_priv->fb_helper = NULL;
  }
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -0
index 6113d7627d45..98029059f701 100644
@@ -352,6 +352,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
  	if (ifbdev->fb)
  		drm_framebuffer_remove(&ifbdev->fb->base);
 
+	drm_fb_helper_unprepare(&ifbdev->helper);
  	kfree(ifbdev);
  }
 
drivers/gpu/drm/msm/msm_fbdev.c +2 -0
index 915b213f3a5c..c804e5ba682a 100644
@@ -170,6 +170,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
  fini:
  	drm_fb_helper_fini(helper);
  fail:
+	drm_fb_helper_unprepare(helper);
  	kfree(fbdev);
  	return NULL;
  }
@@ -196,6 +197,7 @@ void msm_fbdev_free(struct drm_device *dev)
  		drm_framebuffer_remove(fbdev->fb);
  	}
 
+	drm_fb_helper_unprepare(helper);
  	kfree(fbdev);
 
  	priv->fbdev = NULL;
drivers/gpu/drm/omapdrm/omap_fbdev.c +2 -0
index fc5f52d567c6..84429728347f 100644
@@ -256,6 +256,7 @@ void omap_fbdev_init(struct drm_device *dev)
  fini:
  	drm_fb_helper_fini(helper);
  fail:
+	drm_fb_helper_unprepare(helper);
  	kfree(fbdev);
 
  	dev_warn(dev->dev, "omap_fbdev_init failed\n");
@@ -286,6 +287,7 @@ void omap_fbdev_fini(struct drm_device *dev)
  	if (fbdev->fb)
  		drm_framebuffer_remove(fbdev->fb);
 
+	drm_fb_helper_unprepare(helper);
  	kfree(fbdev);
 
  	priv->fbdev = NULL;
drivers/gpu/drm/radeon/radeon_fb.c +2 -0
index 6e5eed0e157c..c4807f0c43bc 100644
@@ -367,6 +367,7 @@ int radeon_fbdev_init(struct radeon_device *rdev)
  fini:
  	drm_fb_helper_fini(&rfbdev->helper);
  free:
+	drm_fb_helper_unprepare(&rfbdev->helper);
  	kfree(rfbdev);
  	return ret;
  }
@@ -377,6 +378,7 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
  		return;
 
  	radeon_fbdev_destroy(rdev->ddev, rdev->mode_info.rfbdev);
+	drm_fb_helper_unprepare(&rdev->mode_info.rfbdev->helper);
  	kfree(rdev->mode_info.rfbdev);
  	rdev->mode_info.rfbdev = NULL;
  }
drivers/gpu/drm/tegra/fb.c +0 -0
index 153c39c32c71..bfebe2786d61 100644

drivers/gpu/drm/tegra/fb.c static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm) · line 318

Quoted 4 lines
drivers/gpu/drm/tegra/fb.c +1 -0
@@ -315,6 +315,7 @@ static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm)
 
  static void tegra_fbdev_free(struct tegra_fbdev *fbdev)
  {
+	drm_fb_helper_unprepare(&fbdev->base);

Ok this one tegra change was a bit tricky, drivers really should just use drmm_/devm_ for everything :-)

With the kerneldoc augmented:

Quoted 6 lines
drivers/gpu/drm/tegra/fb.c +0 -0
  	kfree(fbdev);
  }
 
Signature · 1 line
2.39.1
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
#4 lore raw
Quoted 39 lines · Thomas Zimmermann

Hi

Am 16.02.23 um 21:11 schrieb Daniel Vetter:

Quoted 36 lines · Thomas Zimmermann
Quoted 29 lines

Move drm_fb_helper_unprepare() from drm_fb_helper_fini() into the calling fbdev implementation. Avoids a possible stale mutex with generic fbdev code.

As indicated by its name, drm_fb_helper_prepare() prepares struct drm_fb_helper before setting up the fbdev support with a call to drm_fb_helper_init(). In legacy fbdev emulation, this happens next to each other. If successful, drm_fb_helper_fini() later tear down the fbdev device and also unprepare via drm_fb_helper_unprepare().

Generic fbdev emulation prepares struct drm_fb_helper immediately after allocating the instance. It only calls drm_fb_helper_init() as part of processing a hotplug event. If the hotplug-handling fails, it runs drm_fb_helper_fini(). This unprepares the fb-helper instance and the next hotplug event runs on stale data.

Solve this by moving drm_fb_helper_unprepare() from drm_fb_helper_fini() into the fbdev implementations. Call it right before freeing the fb-helper instance.

Fixes 4825797c36da ("drm/fb-helper: Introduce drm_fb_helper_unprepare()")
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Quoted 1 line

This reminds me of an old patch I just recently stumbled over again:

https://lore.kernel.org/dri-devel/[email protected]/

Quoted 7 lines
Quoted 2 lines

Should I resurrect that one maybe and send it out? I think that also ties a bit into your story here.

I don't think it will be necessary. I began to convert the existing fbdev emulation to make use of drm_client, which should resove a number of problems. I expect to post this after the various trees have merged the recent changes to fbdev helpers.

The only version the patch is fixing is the client one, the old one is unfixable (I think at least, hence just the comments). Note that the link is pre-splitting, I do have a rebased version here.

I'll just send that out and head into vacations :-) -Daniel

Quoted 198 lines

Best regards
Thomas

Quoted 186 lines

drivers/gpu/drm/drm_fb_helper.c void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)

Quoted 39 lines
---
  drivers/gpu/drm/armada/armada_fbdev.c      | 3 +++
  drivers/gpu/drm/drm_fb_helper.c            | 2 --
  drivers/gpu/drm/drm_fbdev_generic.c        | 2 ++
  drivers/gpu/drm/exynos/exynos_drm_fbdev.c  | 3 ++-
  drivers/gpu/drm/gma500/framebuffer.c       | 2 ++
  drivers/gpu/drm/i915/display/intel_fbdev.c | 1 +
  drivers/gpu/drm/msm/msm_fbdev.c            | 2 ++
  drivers/gpu/drm/omapdrm/omap_fbdev.c       | 2 ++
  drivers/gpu/drm/radeon/radeon_fb.c         | 2 ++
  drivers/gpu/drm/tegra/fb.c                 | 1 +
  10 files changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/armada/armada_fbdev.c +3 -0
index 07e410c62b7a..0e44f53e9fa4 100644
@@ -147,6 +147,7 @@ int armada_fbdev_init(struct drm_device *dev)
   err_fb_setup:
  	drm_fb_helper_fini(fbh);
   err_fb_helper:
+	drm_fb_helper_unprepare(fbh);
  	priv->fbdev = NULL;
  	return ret;
  }
@@ -164,6 +165,8 @@ void armada_fbdev_fini(struct drm_device *dev)
  		if (fbh->fb)
  			fbh->fb->funcs->destroy(fbh->fb);
+		drm_fb_helper_unprepare(fbh);
+
  		priv->fbdev = NULL;
  	}
  }
drivers/gpu/drm/drm_fb_helper.c +0 -0
index 28c428e9c530..a39998047f8a 100644
@@ -590,8 +590,6 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)

I think it would be good to update the kerneldoc of _init() and _fini() here to mention each another like we usually do with these pairs. Same with prepare/unprepare() although the latter rerfences _prepare() already.

Quoted 125 lines
drivers/gpu/drm/drm_fb_helper.c +0 -2
  	}
  	mutex_unlock(&kernel_fb_helper_lock);
-	drm_fb_helper_unprepare(fb_helper);
-
  	if (!fb_helper->client.funcs)
  		drm_client_release(&fb_helper->client);
  }
drivers/gpu/drm/drm_fbdev_generic.c +2 -0
index 365f80717fa1..4d6325e91565 100644
@@ -65,6 +65,8 @@ static void drm_fbdev_fb_destroy(struct fb_info *info)
  	drm_client_framebuffer_delete(fb_helper->buffer);
  	drm_client_release(&fb_helper->client);
+
+	drm_fb_helper_unprepare(fb_helper);
  	kfree(fb_helper);
  }
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +2 -1
index b89e33af8da8..4929ffe5a09a 100644
@@ -183,8 +183,8 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
  err_setup:
  	drm_fb_helper_fini(helper);
-
  err_init:
+	drm_fb_helper_unprepare(helper);
  	private->fb_helper = NULL;
  	kfree(fbdev);
@@ -219,6 +219,7 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
  	fbdev = to_exynos_fbdev(private->fb_helper);
  	exynos_drm_fbdev_destroy(dev, private->fb_helper);
+	drm_fb_helper_unprepare(private->fb_helper);
  	kfree(fbdev);
  	private->fb_helper = NULL;
  }
drivers/gpu/drm/gma500/framebuffer.c +2 -0
index 1f04c07ee180..f471e0cb7298 100644
@@ -427,6 +427,7 @@ int psb_fbdev_init(struct drm_device *dev)
  fini:
  	drm_fb_helper_fini(fb_helper);
  free:
+	drm_fb_helper_unprepare(fb_helper);
  	kfree(fb_helper);
  	return ret;
  }
@@ -439,6 +440,7 @@ static void psb_fbdev_fini(struct drm_device *dev)
  		return;
  	psb_fbdev_destroy(dev, dev_priv->fb_helper);
+	drm_fb_helper_unprepare(dev_priv->fb_helper);
  	kfree(dev_priv->fb_helper);
  	dev_priv->fb_helper = NULL;
  }
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -0
index 6113d7627d45..98029059f701 100644
@@ -352,6 +352,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
  	if (ifbdev->fb)
  		drm_framebuffer_remove(&ifbdev->fb->base);
+	drm_fb_helper_unprepare(&ifbdev->helper);
  	kfree(ifbdev);
  }
drivers/gpu/drm/msm/msm_fbdev.c +2 -0
index 915b213f3a5c..c804e5ba682a 100644
@@ -170,6 +170,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
  fini:
  	drm_fb_helper_fini(helper);
  fail:
+	drm_fb_helper_unprepare(helper);
  	kfree(fbdev);
  	return NULL;
  }
@@ -196,6 +197,7 @@ void msm_fbdev_free(struct drm_device *dev)
  		drm_framebuffer_remove(fbdev->fb);
  	}
+	drm_fb_helper_unprepare(helper);
  	kfree(fbdev);
  	priv->fbdev = NULL;
drivers/gpu/drm/omapdrm/omap_fbdev.c +2 -0
index fc5f52d567c6..84429728347f 100644
@@ -256,6 +256,7 @@ void omap_fbdev_init(struct drm_device *dev)
  fini:
  	drm_fb_helper_fini(helper);
  fail:
+	drm_fb_helper_unprepare(helper);
  	kfree(fbdev);
  	dev_warn(dev->dev, "omap_fbdev_init failed\n");
@@ -286,6 +287,7 @@ void omap_fbdev_fini(struct drm_device *dev)
  	if (fbdev->fb)
  		drm_framebuffer_remove(fbdev->fb);
+	drm_fb_helper_unprepare(helper);
  	kfree(fbdev);
  	priv->fbdev = NULL;
drivers/gpu/drm/radeon/radeon_fb.c +2 -0
index 6e5eed0e157c..c4807f0c43bc 100644
@@ -367,6 +367,7 @@ int radeon_fbdev_init(struct radeon_device *rdev)
  fini:
  	drm_fb_helper_fini(&rfbdev->helper);
  free:
+	drm_fb_helper_unprepare(&rfbdev->helper);
  	kfree(rfbdev);
  	return ret;
  }
@@ -377,6 +378,7 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
  		return;
  	radeon_fbdev_destroy(rdev->ddev, rdev->mode_info.rfbdev);
+	drm_fb_helper_unprepare(&rdev->mode_info.rfbdev->helper);
  	kfree(rdev->mode_info.rfbdev);
  	rdev->mode_info.rfbdev = NULL;
  }
drivers/gpu/drm/tegra/fb.c +0 -0
index 153c39c32c71..bfebe2786d61 100644

drivers/gpu/drm/tegra/fb.c static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm) · line 317

Quoted 3 lines
drivers/gpu/drm/tegra/fb.c +1 -0
@@ -315,6 +315,7 @@ static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm)
  static void tegra_fbdev_free(struct tegra_fbdev *fbdev)
  {
+	drm_fb_helper_unprepare(&fbdev->base);

Ok this one tegra change was a bit tricky, drivers really should just use drmm_/devm_ for everything :-)

With the kerneldoc augmented:

Quoted 5 lines
drivers/gpu/drm/tegra/fb.c +0 -0
  	kfree(fbdev);
  }
Signature · 1 line
2.39.1
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#5 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()

In reply to Thomas Zimmermann
== Series Details ==

== Series Details ==

Series: drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()
URL : https://patchwork.freedesktop.org/series/114106/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12751_full -> Patchwork_114106v1_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Additional (1): shard-rkl0

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_114106v1_full:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@kms_rotation_crc@primary-rotation-270:
- {shard-rkl}: [SKIP][1] ([i915#1845] / [i915#4098]) -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@[email protected]

* {igt@v3d/v3d_submit_csd@valid-submission}:
- {shard-dg1}: NOTRUN -> [SKIP][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-dg1-12/igt@v3d/[email protected]

New tests
---------

New tests have been introduced between CI_DRM_12751_full and Patchwork_114106v1_full:

### New IGT tests (1) ###

* igt@kms_cursor_edge_walk@256x256-left-edge@pipe-b-edp-1:
- Statuses : 1 pass(s)
- Exec time: [0.0] s

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_persistence@engines-hang:
- shard-snb: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#1099])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-snb4/igt@[email protected]

* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-glk: [PASS][5] -> [FAIL][6] ([i915#2842])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-glk6/igt@gem_exec_fair@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-glk7/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-apl: [PASS][7] -> [FAIL][8] ([i915#2842])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-apl1/igt@gem_exec_fair@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-apl1/igt@gem_exec_fair@[email protected]

* igt@gem_pxp@reject-modify-context-protection-off-3:
- shard-snb: NOTRUN -> [SKIP][9] ([fdo#109271]) +112 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-snb4/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible@b-vga1:
- shard-snb: [PASS][10] -> [DMESG-WARN][11] ([i915#5090])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-snb7/igt@kms_flip@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-snb2/igt@kms_flip@[email protected]

* igt@kms_setmode@basic@pipe-a-hdmi-a-1:
- shard-snb: NOTRUN -> [FAIL][12] ([i915#5465]) +1 similar issue
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-snb1/igt@kms_setmode@[email protected]

* igt@perf@stress-open-close:
- shard-glk: [PASS][13] -> [ABORT][14] ([i915#5213])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-glk8/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-glk7/igt@[email protected]

#### Possible fixes ####

* igt@fbdev@read:
- {shard-rkl}: [SKIP][15] ([i915#2582]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-1/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@[email protected]

* igt@gem_bad_reloc@negative-reloc-lut:
- {shard-rkl}: [SKIP][17] ([i915#3281]) -> [PASS][18] +6 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-1/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-5/igt@[email protected]

* igt@gem_ctx_persistence@hang:
- {shard-rkl}: [SKIP][19] ([i915#6252]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-5/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@[email protected]

* igt@gem_ctx_persistence@smoketest:
- {shard-rkl}: [FAIL][21] ([i915#5099]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-5/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-4/igt@[email protected]

* igt@gem_mmap_gtt@fault-concurrent-x:
- shard-snb: [ABORT][23] ([i915#5161]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-snb1/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-snb7/igt@[email protected]

* igt@gem_pwrite@basic-self:
- {shard-rkl}: [SKIP][25] ([i915#3282]) -> [PASS][26] +2 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-3/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-5/igt@[email protected]

* igt@gem_userptr_blits@huge-split:
- shard-snb: [FAIL][27] ([i915#2724]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-snb1/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-snb4/igt@[email protected]

* igt@gen9_exec_parse@bb-secure:
- {shard-rkl}: [SKIP][29] ([i915#2527]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-1/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-5/igt@[email protected]

* igt@i915_hangman@engine-engine-error@bcs0:
- {shard-rkl}: [SKIP][31] ([i915#6258]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-5/igt@i915_hangman@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@i915_hangman@[email protected]

* igt@i915_pm_dc@dc6-dpms:
- {shard-rkl}: [SKIP][33] ([i915#3361]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-5/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-4/igt@[email protected]

* igt@i915_pm_rc6_residency@rc6-idle@vcs0:
- {shard-rkl}: [WARN][35] ([i915#2681]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-5/igt@i915_pm_rc6_residency@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-4/igt@i915_pm_rc6_residency@[email protected]

* igt@i915_pm_rpm@dpms-mode-unset-lpsp:
- {shard-rkl}: [SKIP][37] ([i915#1397]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-2/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@[email protected]

* igt@kms_async_flips@alternate-sync-async-flip@pipe-c-hdmi-a-1:
- shard-glk: [FAIL][39] ([i915#2521]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-glk1/igt@kms_async_flips@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-glk6/igt@kms_async_flips@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor@atomic-transitions-varying-size:
- shard-glk: [FAIL][41] ([i915#2346]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-glk9/igt@kms_cursor_legacy@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-glk2/igt@kms_cursor_legacy@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@b-hdmi-a1:
- shard-glk: [FAIL][43] ([i915#79]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-glk9/igt@kms_flip@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-glk1/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-shrfb-msflip-blt:
- {shard-rkl}: [SKIP][45] ([i915#1849] / [i915#4098]) -> [PASS][46] +20 similar issues
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-1/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@[email protected]

* igt@kms_plane@plane-panning-top-left@pipe-a-planes:
- {shard-rkl}: [SKIP][47] ([i915#1849]) -> [PASS][48] +5 similar issues
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-2/igt@kms_plane@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@kms_plane@[email protected]

* igt@kms_psr@primary_render:
- {shard-rkl}: [SKIP][49] ([i915#1072]) -> [PASS][50] +2 similar issues
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-5/igt@kms_psr@primary_render.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@kms_psr@primary_render.html

* igt@kms_universal_plane@universal-plane-pageflip-windowed-pipe-a:
- {shard-rkl}: [SKIP][51] ([i915#4070] / [i915#4098]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-2/igt@kms_universal_plane@universal-plane-pageflip-windowed-pipe-a.html
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@kms_universal_plane@universal-plane-pageflip-windowed-pipe-a.html

* igt@kms_universal_plane@universal-plane-pipe-b-functional:
- {shard-rkl}: [SKIP][53] ([i915#1845] / [i915#4070] / [i915#4098]) -> [PASS][54] +1 similar issue
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-2/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@[email protected]

* igt@kms_vblank@pipe-b-query-idle:
- {shard-rkl}: [SKIP][55] ([i915#1845] / [i915#4098]) -> [PASS][56] +24 similar issues
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-5/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@[email protected]

* igt@perf@polling-small-buf:
- {shard-rkl}: [FAIL][57] ([i915#1722]) -> [PASS][58]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-rkl-1/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-rkl-6/igt@[email protected]

* igt@perf_pmu@module-unload:
- shard-snb: [ABORT][59] ([i915#4528]) -> [PASS][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/shard-snb4/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114106v1/shard-snb4/igt@[email protected]

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

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109303]: https://bugs.freedesktop.org/show_bug.cgi?id=109303
[fdo#109308]: https://bugs.freedesktop.org/show_bug.cgi?id=109308
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
[fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
[fdo#109314]: https://bugs.freedesktop.org/show_bug.cgi?id=109314
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111644]: https://bugs.freedesktop.org/show_bug.cgi?id=111644
[fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1099]: https://gitlab.freedesktop.org/drm/intel/issues/1099
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1722]: https://gitlab.freedesktop.org/drm/intel/issues/1722
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2521]: https://gitlab.freedesktop.org/drm/intel/issues/2521
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2658]: https://gitlab.freedesktop.org/drm/intel/issues/2658
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
[i915#2724]: https://gitlab.freedesktop.org/drm/intel/issues/2724
[i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
[i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3323]: https://gitlab.freedesktop.org/drm/intel/issues/3323
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3361]: https://gitlab.freedesktop.org/drm/intel/issues/3361
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3547]: https://gitlab.freedesktop.org/drm/intel/issues/3547
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3743]: https://gitlab.freedesktop.org/drm/intel/issues/3743
[i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3966]: https://gitlab.freedesktop.org/drm/intel/issues/3966
[i915#404]: https://gitlab.freedesktop.org/drm/intel/issues/404
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4528]: https://gitlab.freedesktop.org/drm/intel/issues/4528
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#5090]: https://gitlab.freedesktop.org/drm/intel/issues/5090
[i915#5099]: https://gitlab.freedesktop.org/drm/intel/issues/5099
[i915#5161]: https://gitlab.freedesktop.org/drm/intel/issues/5161
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5213]: https://gitlab.freedesktop.org/drm/intel/issues/5213
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
[i915#5465]: https://gitlab.freedesktop.org/drm/intel/issues/5465
[i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6117]: https://gitlab.freedesktop.org/drm/intel/issues/6117
[i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
[i915#6252]: https://gitlab.freedesktop.org/drm/intel/issues/6252
[i915#6258]: https://gitlab.freedesktop.org/drm/intel/issues/6258
[i915#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
[i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
[i915#6412]: https://gitlab.freedesktop.org/drm/intel/issues/6412
[i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
[i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6590]: https://gitlab.freedesktop.org/drm/intel/issues/6590
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#6944]: https://gitlab.freedesktop.org/drm/intel/issues/6944
[i915#6953]: https://gitlab.freedesktop.org/drm/intel/issues/6953
[i915#7037]: https://gitlab.freedesktop.org/drm/intel/issues/7037
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
[i915#7178]: https://gitlab.freedesktop.org/drm/intel/issues/7178
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7651]: https://gitlab.freedesktop.org/drm/intel/issues/7651
[i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#7949]: https://gitlab.freedesktop.org/drm/intel/issues/7949
[i915#7957]: https://gitlab.freedesktop.org/drm/intel/issues/7957
[i915#7975]: https://gitlab.freedesktop.org/drm/intel/issues/7975
[i915#8152]: https://gitlab.freedesktop.org/drm/intel/issues/8152

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

* Linux: CI_DRM_12751 -> Patchwork_114106v1

CI-20190529: 20190529
CI_DRM_12751: b6ba15d59cdc7e7d488646370f9ca6b0a36f9db5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7161: 5574f110ae838031eef6db5236bad02e8c2d2dee @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114106v1: b6ba15d59cdc7e7d488646370f9ca6b0a36f9db5 @ 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_114106v1/index.html

Reviewed-by on v1 1/1
#6 lore raw
In reply to Thomas Zimmermann
Quoted 16 lines · Thomas Zimmermann

Move drm_fb_helper_unprepare() from drm_fb_helper_fini() into the calling fbdev implementation. Avoids a possible stale mutex with generic fbdev code.

As indicated by its name, drm_fb_helper_prepare() prepares struct drm_fb_helper before setting up the fbdev support with a call to drm_fb_helper_init(). In legacy fbdev emulation, this happens next to each other. If successful, drm_fb_helper_fini() later tear down the fbdev device and also unprepare via drm_fb_helper_unprepare().

Generic fbdev emulation prepares struct drm_fb_helper immediately after allocating the instance. It only calls drm_fb_helper_init() as part of processing a hotplug event. If the hotplug-handling fails, it runs drm_fb_helper_fini(). This unprepares the fb-helper instance and the next hotplug event runs on stale data.

Quoted 5 lines

Solve this by moving drm_fb_helper_unprepare() from drm_fb_helper_fini() into the fbdev implementations. Call it right before freeing the fb-helper instance.

Fixes 4825797c36da ("drm/fb-helper: Introduce drm_fb_helper_unprepare()")

I think this should be Fixes: 032116bbe152 ("drm/fbdev-generic: Minimize client unregistering") instead? Because commit 4825797c36da just added a wrapper function for mutex_destroy(&fb_helper->lock), but it was commit 032116bbe152 that made drm_fbdev_cleanup() to call that helper function.

Quoted 10 lines
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

---

The change itself looks good to me.

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat
author maintainer
#7 lore raw

Hi

Am 21.02.23 um 11:27 schrieb Javier Martinez Canillas:

Quoted 22 lines
Quoted 20 lines · Thomas Zimmermann

Move drm_fb_helper_unprepare() from drm_fb_helper_fini() into the calling fbdev implementation. Avoids a possible stale mutex with generic fbdev code.

As indicated by its name, drm_fb_helper_prepare() prepares struct drm_fb_helper before setting up the fbdev support with a call to drm_fb_helper_init(). In legacy fbdev emulation, this happens next to each other. If successful, drm_fb_helper_fini() later tear down the fbdev device and also unprepare via drm_fb_helper_unprepare().

Generic fbdev emulation prepares struct drm_fb_helper immediately after allocating the instance. It only calls drm_fb_helper_init() as part of processing a hotplug event. If the hotplug-handling fails, it runs drm_fb_helper_fini(). This unprepares the fb-helper instance and the next hotplug event runs on stale data.

Solve this by moving drm_fb_helper_unprepare() from drm_fb_helper_fini() into the fbdev implementations. Call it right before freeing the fb-helper instance.

Quoted 6 lines
Quoted 1 line
Fixes 4825797c36da ("drm/fb-helper: Introduce drm_fb_helper_unprepare()")

I think this should be Fixes: 032116bbe152 ("drm/fbdev-generic: Minimize client unregistering") instead? Because commit 4825797c36da just added a wrapper function for mutex_destroy(&fb_helper->lock), but it was commit 032116bbe152 that made drm_fbdev_cleanup() to call that helper function.

Good point. After looking through the recent fbdev commits, I'll use commit 643231b28380 ("drm/fbdev-generic: Minimize hotplug error handling") for the tag. This is the one that added the call to drm_fb_helper_fini() to the client's hotplug handler. And _fini() currently does the _unprepare(), when it shouldn't.

Quoted 9 lines
Quoted 9 lines
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Quoted 7 lines
Quoted 2 lines

---

The change itself looks good to me.

Thanks a lot.

Best regards
Thomas

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
#8 lore raw
Quoted 32 lines · Thomas Zimmermann

Hi

Am 21.02.23 um 11:27 schrieb Javier Martinez Canillas:

Quoted 22 lines
Quoted 20 lines · Thomas Zimmermann

Move drm_fb_helper_unprepare() from drm_fb_helper_fini() into the calling fbdev implementation. Avoids a possible stale mutex with generic fbdev code.

As indicated by its name, drm_fb_helper_prepare() prepares struct drm_fb_helper before setting up the fbdev support with a call to drm_fb_helper_init(). In legacy fbdev emulation, this happens next to each other. If successful, drm_fb_helper_fini() later tear down the fbdev device and also unprepare via drm_fb_helper_unprepare().

Generic fbdev emulation prepares struct drm_fb_helper immediately after allocating the instance. It only calls drm_fb_helper_init() as part of processing a hotplug event. If the hotplug-handling fails, it runs drm_fb_helper_fini(). This unprepares the fb-helper instance and the next hotplug event runs on stale data.

Solve this by moving drm_fb_helper_unprepare() from drm_fb_helper_fini() into the fbdev implementations. Call it right before freeing the fb-helper instance.

Quoted 6 lines
Quoted 1 line
Fixes 4825797c36da ("drm/fb-helper: Introduce drm_fb_helper_unprepare()")

I think this should be Fixes: 032116bbe152 ("drm/fbdev-generic: Minimize client unregistering") instead? Because commit 4825797c36da just added a wrapper function for mutex_destroy(&fb_helper->lock), but it was commit 032116bbe152 that made drm_fbdev_cleanup() to call that helper function.

Quoted 6 lines

Good point. After looking through the recent fbdev commits, I'll use commit 643231b28380 ("drm/fbdev-generic: Minimize hotplug error handling") for the tag. This is the one that added the call to drm_fb_helper_fini() to the client's hotplug handler. And _fini() currently does the _unprepare(), when it shouldn't.

Ah, much better indeed.

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat