All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/msm/dp: fix runtime PM leaks on hotplug
@ 2024-03-13 16:43 Johan Hovold
  2024-03-13 16:43 ` [PATCH 1/2] drm/msm/dp: fix runtime PM leak on disconnect Johan Hovold
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Johan Hovold @ 2024-03-13 16:43 UTC (permalink / raw)
  To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov
  Cc: Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
	Kuogee Hsieh, Bjorn Andersson, linux-arm-msm, dri-devel,
	freedreno, linux-kernel, 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.

Johan


[1] https://lore.kernel.org/lkml/Ze8Ke_M2xHyPYCu-@hovoldconsulting.com/


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(+)

-- 
2.43.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] drm/msm/dp: fix runtime PM leak on disconnect
  2024-03-13 16:43 [PATCH 0/2] drm/msm/dp: fix runtime PM leaks on hotplug Johan Hovold
@ 2024-03-13 16:43 ` Johan Hovold
  2024-03-13 19:48   ` Abhinav Kumar
  2024-03-13 16:43 ` [PATCH 2/2] drm/msm/dp: fix runtime PM leak on connect failure Johan Hovold
  2024-04-05 19:01 ` [PATCH 0/2] drm/msm/dp: fix runtime PM leaks on hotplug Abhinav Kumar
  2 siblings, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2024-03-13 16:43 UTC (permalink / raw)
  To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov
  Cc: Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
	Kuogee Hsieh, Bjorn Andersson, linux-arm-msm, dri-devel,
	freedreno, linux-kernel, Johan Hovold, stable

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.

Fixes: 5814b8bf086a ("drm/msm/dp: incorporate pm_runtime framework into DP driver")
Cc: stable@vger.kernel.org      # 6.8
Cc: Kuogee Hsieh <quic_khsieh@quicinc.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/gpu/drm/msm/dp/dp_display.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 4c72124ffb5d..8e8cf531da45 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -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;
 	}
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] drm/msm/dp: fix runtime PM leak on connect failure
  2024-03-13 16:43 [PATCH 0/2] drm/msm/dp: fix runtime PM leaks on hotplug Johan Hovold
  2024-03-13 16:43 ` [PATCH 1/2] drm/msm/dp: fix runtime PM leak on disconnect Johan Hovold
@ 2024-03-13 16:43 ` Johan Hovold
  2024-03-13 18:16   ` Abhinav Kumar
  2024-04-05 19:01 ` [PATCH 0/2] drm/msm/dp: fix runtime PM leaks on hotplug Abhinav Kumar
  2 siblings, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2024-03-13 16:43 UTC (permalink / raw)
  To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov
  Cc: Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
	Kuogee Hsieh, Bjorn Andersson, linux-arm-msm, dri-devel,
	freedreno, linux-kernel, Johan Hovold, stable

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: stable@vger.kernel.org      # 6.8
Cc: Kuogee Hsieh <quic_khsieh@quicinc.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/gpu/drm/msm/dp/dp_display.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 8e8cf531da45..78464c395c3d 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -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;
 	}
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/msm/dp: fix runtime PM leak on connect failure
  2024-03-13 16:43 ` [PATCH 2/2] drm/msm/dp: fix runtime PM leak on connect failure Johan Hovold
@ 2024-03-13 18:16   ` Abhinav Kumar
  0 siblings, 0 replies; 6+ messages in thread
From: Abhinav Kumar @ 2024-03-13 18:16 UTC (permalink / raw)
  To: Johan Hovold, Rob Clark, Dmitry Baryshkov
  Cc: Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
	Kuogee Hsieh, Bjorn Andersson, linux-arm-msm, dri-devel,
	freedreno, linux-kernel, stable



On 3/13/2024 9:43 AM, Johan Hovold wrote:
> 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: stable@vger.kernel.org      # 6.8
> Cc: Kuogee Hsieh <quic_khsieh@quicinc.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] drm/msm/dp: fix runtime PM leak on disconnect
  2024-03-13 16:43 ` [PATCH 1/2] drm/msm/dp: fix runtime PM leak on disconnect Johan Hovold
@ 2024-03-13 19:48   ` Abhinav Kumar
  0 siblings, 0 replies; 6+ messages in thread
From: Abhinav Kumar @ 2024-03-13 19:48 UTC (permalink / raw)
  To: Johan Hovold, Rob Clark, Dmitry Baryshkov
  Cc: Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
	Kuogee Hsieh, Bjorn Andersson, linux-arm-msm, dri-devel,
	freedreno, linux-kernel, stable



On 3/13/2024 9:43 AM, Johan Hovold wrote:
> 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.
> 

Thanks for the fixes. Both look right to me.

I will pick up both of them for -fixes

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>



> Fixes: 5814b8bf086a ("drm/msm/dp: incorporate pm_runtime framework into DP driver")
> Cc: stable@vger.kernel.org      # 6.8
> Cc: Kuogee Hsieh <quic_khsieh@quicinc.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
>   drivers/gpu/drm/msm/dp/dp_display.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 4c72124ffb5d..8e8cf531da45 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -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;
>   	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] drm/msm/dp: fix runtime PM leaks on hotplug
  2024-03-13 16:43 [PATCH 0/2] drm/msm/dp: fix runtime PM leaks on hotplug Johan Hovold
  2024-03-13 16:43 ` [PATCH 1/2] drm/msm/dp: fix runtime PM leak on disconnect Johan Hovold
  2024-03-13 16:43 ` [PATCH 2/2] drm/msm/dp: fix runtime PM leak on connect failure Johan Hovold
@ 2024-04-05 19:01 ` Abhinav Kumar
  2 siblings, 0 replies; 6+ messages in thread
From: Abhinav Kumar @ 2024-04-05 19:01 UTC (permalink / raw)
  To: Rob Clark, Dmitry Baryshkov, Johan Hovold
  Cc: Abhinav Kumar, Sean Paul, Marijn Suijten, David Airlie,
	Daniel Vetter, Kuogee Hsieh, Bjorn Andersson, linux-arm-msm,
	dri-devel, freedreno, linux-kernel


On Wed, 13 Mar 2024 17:43:04 +0100, Johan Hovold wrote:
> 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,
-- 
Abhinav Kumar <quic_abhinavk@quicinc.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-05 19:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-13 16:43 [PATCH 0/2] drm/msm/dp: fix runtime PM leaks on hotplug Johan Hovold
2024-03-13 16:43 ` [PATCH 1/2] drm/msm/dp: fix runtime PM leak on disconnect Johan Hovold
2024-03-13 19:48   ` Abhinav Kumar
2024-03-13 16:43 ` [PATCH 2/2] drm/msm/dp: fix runtime PM leak on connect failure Johan Hovold
2024-03-13 18:16   ` Abhinav Kumar
2024-04-05 19:01 ` [PATCH 0/2] drm/msm/dp: fix runtime PM leaks on hotplug Abhinav Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.