* [PATCH v2 RESEND] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue()
@ 2025-04-24 2:55 Haoxiang Li
2025-04-25 20:41 ` ✓ i915.CI.BAT: success for drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() (rev3) Patchwork
2025-05-16 12:21 ` [PATCH v2 RESEND] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Jani Nikula
0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2025-04-24 2:55 UTC (permalink / raw)
To: rodrigo.vivi, joonas.lahtinen, tursulin, airlied, simona,
gustavo.sousa
Cc: intel-gfx, intel-xe, dri-devel, linux-kernel, Haoxiang Li, stable
Add check for the return value of alloc_ordered_workqueue()
and alloc_workqueue(). Furthermore, if some allocations fail,
cleanup works are added to avoid potential memory leak problem.
Fixes: 40053823baad ("drm/i915/display: move modeset probe/remove functions to intel_display_driver.c")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
Changes in v2:
- Split the compound conditional statement into separate
conditional statements to facilitate cleanup works.
- Add cleanup works to destory work queues if allocations fail,
and modify the later goto destination to do the full excercise.
- modify the patch description. Thanks, Jani!
---
.../drm/i915/display/intel_display_driver.c | 30 +++++++++++++++----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
index 31740a677dd8..ac94561715dc 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -241,31 +241,45 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
intel_dmc_init(display);
display->wq.modeset = alloc_ordered_workqueue("i915_modeset", 0);
+ if (!display->wq.modeset) {
+ ret = -ENOMEM;
+ goto cleanup_vga_client_pw_domain_dmc;
+ }
+
display->wq.flip = alloc_workqueue("i915_flip", WQ_HIGHPRI |
WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
+ if (!display->wq.flip) {
+ ret = -ENOMEM;
+ goto cleanup_wq_modeset;
+ }
+
display->wq.cleanup = alloc_workqueue("i915_cleanup", WQ_HIGHPRI, 0);
+ if (!display->wq.cleanup) {
+ ret = -ENOMEM;
+ goto cleanup_wq_flip;
+ }
intel_mode_config_init(display);
ret = intel_cdclk_init(display);
if (ret)
- goto cleanup_vga_client_pw_domain_dmc;
+ goto cleanup_wq_cleanup;
ret = intel_color_init(display);
if (ret)
- goto cleanup_vga_client_pw_domain_dmc;
+ goto cleanup_wq_cleanup;
ret = intel_dbuf_init(i915);
if (ret)
- goto cleanup_vga_client_pw_domain_dmc;
+ goto cleanup_wq_cleanup;
ret = intel_bw_init(i915);
if (ret)
- goto cleanup_vga_client_pw_domain_dmc;
+ goto cleanup_wq_cleanup;
ret = intel_pmdemand_init(display);
if (ret)
- goto cleanup_vga_client_pw_domain_dmc;
+ goto cleanup_wq_cleanup;
intel_init_quirks(display);
@@ -273,6 +287,12 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
return 0;
+cleanup_wq_cleanup:
+ destroy_workqueue(display->wq.cleanup);
+cleanup_wq_flip:
+ destroy_workqueue(display->wq.flip);
+cleanup_wq_modeset:
+ destroy_workqueue(display->wq.modeset);
cleanup_vga_client_pw_domain_dmc:
intel_dmc_fini(display);
intel_power_domains_driver_remove(display);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* ✓ i915.CI.BAT: success for drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() (rev3)
2025-04-24 2:55 [PATCH v2 RESEND] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Haoxiang Li
@ 2025-04-25 20:41 ` Patchwork
2025-05-16 12:21 ` [PATCH v2 RESEND] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Jani Nikula
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2025-04-25 20:41 UTC (permalink / raw)
To: Haoxiang Li; +Cc: intel-gfx
[-- Attachment #1: Type: text/plain, Size: 3127 bytes --]
== Series Details ==
Series: drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() (rev3)
URL : https://patchwork.freedesktop.org/series/145245/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_16465 -> Patchwork_145245v3
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_145245v3/index.html
Participating hosts (42 -> 41)
------------------------------
Missing (1): fi-glk-j4005
Known issues
------------
Here are the changes found in Patchwork_145245v3 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@dmabuf@all-tests:
- bat-apl-1: [PASS][1] -> [INCOMPLETE][2] ([i915#12904]) +1 other test incomplete
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_16465/bat-apl-1/igt@dmabuf@all-tests.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_145245v3/bat-apl-1/igt@dmabuf@all-tests.html
* igt@i915_selftest@live@workarounds:
- bat-arls-6: [PASS][3] -> [DMESG-FAIL][4] ([i915#12061]) +1 other test dmesg-fail
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_16465/bat-arls-6/igt@i915_selftest@live@workarounds.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_145245v3/bat-arls-6/igt@i915_selftest@live@workarounds.html
#### Possible fixes ####
* igt@i915_selftest@live:
- bat-mtlp-8: [DMESG-FAIL][5] ([i915#12061]) -> [PASS][6] +1 other test pass
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_16465/bat-mtlp-8/igt@i915_selftest@live.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_145245v3/bat-mtlp-8/igt@i915_selftest@live.html
* igt@i915_selftest@live@workarounds:
- bat-mtlp-6: [DMESG-FAIL][7] ([i915#12061]) -> [PASS][8] +1 other test pass
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_16465/bat-mtlp-6/igt@i915_selftest@live@workarounds.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_145245v3/bat-mtlp-6/igt@i915_selftest@live@workarounds.html
* igt@kms_hdmi_inject@inject-audio:
- bat-arls-6: [FAIL][9] ([i915#13930]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_16465/bat-arls-6/igt@kms_hdmi_inject@inject-audio.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_145245v3/bat-arls-6/igt@kms_hdmi_inject@inject-audio.html
[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#12904]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12904
[i915#13930]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13930
Build changes
-------------
* Linux: CI_DRM_16465 -> Patchwork_145245v3
CI-20190529: 20190529
CI_DRM_16465: 6e67a7af43567bb9f23fe156fde7efa3d214fd20 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8338: 8338
Patchwork_145245v3: 6e67a7af43567bb9f23fe156fde7efa3d214fd20 @ git://anongit.freedesktop.org/gfx-ci/linux
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_145245v3/index.html
[-- Attachment #2: Type: text/html, Size: 3993 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2 RESEND] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue()
2025-04-24 2:55 [PATCH v2 RESEND] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Haoxiang Li
2025-04-25 20:41 ` ✓ i915.CI.BAT: success for drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() (rev3) Patchwork
@ 2025-05-16 12:21 ` Jani Nikula
1 sibling, 0 replies; 3+ messages in thread
From: Jani Nikula @ 2025-05-16 12:21 UTC (permalink / raw)
To: Haoxiang Li, rodrigo.vivi, joonas.lahtinen, tursulin, airlied,
simona, gustavo.sousa
Cc: intel-gfx, intel-xe, dri-devel, linux-kernel, Haoxiang Li, stable
On Thu, 24 Apr 2025, Haoxiang Li <haoxiang_li2024@163.com> wrote:
> Add check for the return value of alloc_ordered_workqueue()
> and alloc_workqueue(). Furthermore, if some allocations fail,
> cleanup works are added to avoid potential memory leak problem.
>
> Fixes: 40053823baad ("drm/i915/display: move modeset probe/remove functions to intel_display_driver.c")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
This patch seems to have been neglected, apologies.
I've rebased it and included it as part of a bigger series [1].
Thanks for the patch.
BR,
Jani.
[1] https://lore.kernel.org/r/cover.1747397638.git.jani.nikula@intel.com
> ---
> Changes in v2:
> - Split the compound conditional statement into separate
> conditional statements to facilitate cleanup works.
> - Add cleanup works to destory work queues if allocations fail,
> and modify the later goto destination to do the full excercise.
> - modify the patch description. Thanks, Jani!
> ---
> .../drm/i915/display/intel_display_driver.c | 30 +++++++++++++++----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
> index 31740a677dd8..ac94561715dc 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
> @@ -241,31 +241,45 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
> intel_dmc_init(display);
>
> display->wq.modeset = alloc_ordered_workqueue("i915_modeset", 0);
> + if (!display->wq.modeset) {
> + ret = -ENOMEM;
> + goto cleanup_vga_client_pw_domain_dmc;
> + }
> +
> display->wq.flip = alloc_workqueue("i915_flip", WQ_HIGHPRI |
> WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
> + if (!display->wq.flip) {
> + ret = -ENOMEM;
> + goto cleanup_wq_modeset;
> + }
> +
> display->wq.cleanup = alloc_workqueue("i915_cleanup", WQ_HIGHPRI, 0);
> + if (!display->wq.cleanup) {
> + ret = -ENOMEM;
> + goto cleanup_wq_flip;
> + }
>
> intel_mode_config_init(display);
>
> ret = intel_cdclk_init(display);
> if (ret)
> - goto cleanup_vga_client_pw_domain_dmc;
> + goto cleanup_wq_cleanup;
>
> ret = intel_color_init(display);
> if (ret)
> - goto cleanup_vga_client_pw_domain_dmc;
> + goto cleanup_wq_cleanup;
>
> ret = intel_dbuf_init(i915);
> if (ret)
> - goto cleanup_vga_client_pw_domain_dmc;
> + goto cleanup_wq_cleanup;
>
> ret = intel_bw_init(i915);
> if (ret)
> - goto cleanup_vga_client_pw_domain_dmc;
> + goto cleanup_wq_cleanup;
>
> ret = intel_pmdemand_init(display);
> if (ret)
> - goto cleanup_vga_client_pw_domain_dmc;
> + goto cleanup_wq_cleanup;
>
> intel_init_quirks(display);
>
> @@ -273,6 +287,12 @@ int intel_display_driver_probe_noirq(struct intel_display *display)
>
> return 0;
>
> +cleanup_wq_cleanup:
> + destroy_workqueue(display->wq.cleanup);
> +cleanup_wq_flip:
> + destroy_workqueue(display->wq.flip);
> +cleanup_wq_modeset:
> + destroy_workqueue(display->wq.modeset);
> cleanup_vga_client_pw_domain_dmc:
> intel_dmc_fini(display);
> intel_power_domains_driver_remove(display);
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-16 12:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 2:55 [PATCH v2 RESEND] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Haoxiang Li
2025-04-25 20:41 ` ✓ i915.CI.BAT: success for drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() (rev3) Patchwork
2025-05-16 12:21 ` [PATCH v2 RESEND] drm/i915/display: Add check for alloc_ordered_workqueue() and alloc_workqueue() Jani Nikula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox