drm/msm/dp: fix runtime PM leaks on hotplug
Subsystems (4)
cover drm/msm/dp: fix runtime PM leaks on hotplug
As I've reported elsewhere, I've been hitting runtime PM usage count leaks when investigated a DisplayPort hotplug regression on the Lenovo ThinkPad X13s. [1]
This series addresses two obvious leaks on disconnect and on connect failures, respectively.
Johan
[1] https://lore.kernel.org/lkml/[email protected]/
Johan Hovold (2):
drm/msm/dp: fix runtime PM leak on disconnect drm/msm/dp: fix runtime PM leak on connect failure
drivers/gpu/drm/msm/dp/dp_display.c | 2 ++ 1 file changed, 2 insertions(+)
Signature · 1 line
2.43.2
PATCH 1/2 drm/msm/dp: fix runtime PM leak on disconnect
Make sure to put the runtime PM usage count (and suspend) also when receiving a disconnect event while in the ST_MAINLINK_READY state.
This specifically avoids leaking a runtime PM usage count on every disconnect with display servers that do not automatically enable external displays when receiving a hotplug notification.
--- drivers/gpu/drm/msm/dp/dp_display.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/dp/dp_display.c +1 -0
@@ -655,6 +655,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)dp_display_host_phy_exit (dp); dp->hpd_state =ST_DISCONNECTED ;dp_display_notify_disconnect (&dp->dp_display.pdev->dev); +pm_runtime_put_sync (&pdev->dev);mutex_unlock (&dp->event_mutex);return 0 ; }
Signature · 1 line
2.43.2
PATCH 2/2 drm/msm/dp: fix runtime PM leak on connect failure
In reply to Johan HovoldMake sure to balance the runtime PM usage counter (and suspend) before returning on connect failures (e.g. DPCD read failures after a spurious connect event or if link training fails).
--- drivers/gpu/drm/msm/dp/dp_display.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/dp/dp_display.c +1 -0
@@ -598,6 +598,7 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data) ret =dp_display_usbpd_configure_cb (&pdev->dev);if (ret) {/* link train failed */ dp->hpd_state =ST_DISCONNECTED ; +pm_runtime_put_sync (&pdev->dev); }else { dp->hpd_state =ST_MAINLINK_READY ; }
Signature · 1 line
2.43.2
Re: [PATCH 2/2] drm/msm/dp: fix runtime PM leak on connect failure
Quoted 8 lines · Johan Hovold
Make sure to balance the runtime PM usage counter (and suspend) before returning on connect failures (e.g. DPCD read failures after a spurious connect event or if link training fails).
Fixes 5814b8bf086a ("drm/msm/dp: incorporate pm_runtime framework into DP driver")Cc [email protected] # 6.8Cc Kuogee Hsieh <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Re: [PATCH 1/2] drm/msm/dp: fix runtime PM leak on disconnect
In reply to Johan HovoldQuoted 7 lines · Johan Hovold
Make sure to put the runtime PM usage count (and suspend) also when receiving a disconnect event while in the
ST_MAINLINK_READYstate.This specifically avoids leaking a runtime PM usage count on every disconnect with display servers that do not automatically enable external displays when receiving a hotplug notification.
Thanks for the fixes. Both look right to me.
I will pick up both of them for -fixes
Quoted 20 lines
Fixes 5814b8bf086a ("drm/msm/dp: incorporate pm_runtime framework into DP driver")Cc [email protected] # 6.8Cc Kuogee Hsieh <[email protected]>Signed-off-by Johan Hovold <[email protected]>--- drivers/gpu/drm/msm/dp/dp_display.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/msm/dp/dp_display.c +1
-0@@ -655,6 +655,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)dp_display_host_phy_exit (dp); dp->hpd_state =ST_DISCONNECTED ;dp_display_notify_disconnect (&dp->dp_display.pdev->dev); +pm_runtime_put_sync (&pdev->dev);mutex_unlock (&dp->event_mutex);return 0 ; }
Abhinav Kumar
AppliedQuoted 8 lines · Johan Hovold
As I've reported elsewhere, I've been hitting runtime PM usage count leaks when investigated a DisplayPort hotplug regression on the Lenovo ThinkPad X13s. [1]
This series addresses two obvious leaks on disconnect and on connect failures, respectively.
[...]
Applied, thanks!
[1/2] drm/msm/dp: fix runtime PM leak on disconnect
https://gitlab.freedesktop.org/drm/msm/-/commit/0640f47b7426 [2/2] drm/msm/dp: fix runtime PM leak on connect failure https://gitlab.freedesktop.org/drm/msm/-/commit/e86750b01a15
Best regards,
Signature · 1 line
Abhinav Kumar <[email protected]>