All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Gianfranco Mariotti" <gianfranco.mariotti94@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 04/10] drm/msm/dp: reinit video_comp and guard stream state on link maintenance
Date: Fri, 27 Nov 2026 10:31:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-237137@kernel.org> (raw)
In-Reply-To: <20261127101417.24303-5-gianfranco.mariotti94@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/msm/dp: race on stream_clks_on and video_comp in link
  maintenance
--

commit 74fb6ec8be236f906bc006dd2cc6f05e8c05939a
Author: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>

drm/msm/dp: reinit video_comp and guard stream state on link maintenance

This commit reinitializes ctrl->video_comp in
msm_dp_ctrl_link_maintenance() and guards msm_dp_ctrl_push_idle() and
the post-training steps on ctrl->stream_clks_on[panel->stream_id].

> diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> index 779f743f94189..7201b7b513a32 100644
> --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
> +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> @@ -2089,13 +2089,16 @@ static int msm_dp_ctrl_link_maintenance(struct msm_dp_ctrl_private *ctrl,
>  	int ret = 0;
>  	int training_step = DP_TRAINING_NONE;
>  
> -	msm_dp_ctrl_push_idle(&ctrl->msm_dp_ctrl);
> +	if (ctrl->stream_clks_on[panel->stream_id])
> +		msm_dp_ctrl_push_idle(&ctrl->msm_dp_ctrl);
>  
>  	ctrl->link->phy_params.p_level = 0;
>  	ctrl->link->phy_params.v_level = 0;
>  
> +	reinit_completion(&ctrl->video_comp);
> +
>  	ret = msm_dp_ctrl_setup_main_link(ctrl, panel, &training_step);
> -	if (ret)
> +	if (ret || !ctrl->stream_clks_on[panel->stream_id])
>  		goto end;
>  
>  	msm_dp_ctrl_clear_training_pattern(ctrl, panel, DP_PHY_DPRX);

[Severity: Medium]
Can msm_dp_ctrl_link_maintenance() race with msm_dp_ctrl_on_stream() on
ctrl->stream_clks_on[panel->stream_id] and ctrl->video_comp?

In msm_dp_display_atomic_enable(), msm_dp_display_prepare_link() is
followed immediately by msm_dp_display_enable() ->
msm_dp_ctrl_on_stream() on the atomic commit thread without holding
dp->plugged_lock.  Because msm_dp_ctrl_setup_main_link() sleeps across
AUX transactions and fsleep() delays, the stream state can change mid-way
through link maintenance:

CPU0 (HPD IRQ thread)                  CPU1 (atomic commit)
msm_dp_irq_hpd_handle()                msm_dp_display_atomic_enable()
  msm_dp_ctrl_link_maintenance()         msm_dp_display_prepare_link()
    stream_clks_on[...] is false
    reinit_completion(&video_comp)
    msm_dp_ctrl_setup_main_link()
      ... (sleeps in AUX / fsleep)       msm_dp_display_enable()
                                           msm_dp_ctrl_on_stream()
                                             msm_dp_ctrl_on_pixel_clk()
                                               stream_clks_on[...] = true
                                             reinit_completion(&video_comp)
                                             write DP_STATE_CTRL_SEND_VIDEO
                                             msm_dp_ctrl_wait4video_ready()
    !stream_clks_on[...] is now false
    msm_dp_ctrl_clear_training_pattern()
    write DP_STATE_CTRL_SEND_VIDEO
    msm_dp_ctrl_wait4video_ready()     <-- both wait on single video_comp

Conversely, if msm_dp_ctrl_link_maintenance() runs
reinit_completion(&ctrl->video_comp) while msm_dp_ctrl_on_stream() is
already waiting in msm_dp_ctrl_wait4video_ready() (or just after
msm_dp_ctrl_isr() completes video_comp), video_comp.done is reset to 0,
causing msm_dp_ctrl_wait4video_ready() to time out with -ETIMEDOUT and
fail display bring-up.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127101417.24303-1-gianfranco.mariotti94@gmail.com?part=4

  reply	other threads:[~2026-11-27 10:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 10:14 [PATCH v2 00/10] drm/msm/dp: fix DisplayPort hotplug, link training, and multi-lane PHY setup Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 01/10] drm/msm/dp: configure voltage swing and pre-emphasis for all active lanes Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 02/10] drm/msm/dp: reset cached link_info before reading DPCD capabilities Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 03/10] drm/msm/dp: keep training pattern active until stream video is ready Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 04/10] drm/msm/dp: reinit video_comp and guard stream state on link maintenance Gianfranco Mariotti
2026-11-27 10:31   ` sashiko-bot [this message]
2026-11-27 10:14 ` [PATCH v2 05/10] drm/msm/dp: avoid synchronous runtime PM put from HPD IRQ thread Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 06/10] drm/msm/dp: track DP_SINK_COUNT capability and sync prev_sink_count Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 07/10] drm/msm/dp: fix HPD plugged, AUX gate, and runtime PM tracking Gianfranco Mariotti
2026-11-27 10:59   ` sashiko-bot
2026-11-27 10:14 ` [PATCH v2 08/10] drm/msm/dp: keep PHY initialized while plugged across link unprepare Gianfranco Mariotti
2026-11-27 11:01   ` sashiko-bot
2026-11-27 10:14 ` [PATCH v2 09/10] drm/msm/dp: re-read EDID on demand in get_modes when blob is missing Gianfranco Mariotti
2026-11-27 10:14 ` [PATCH v2 10/10] drm/msm/dp: dispatch native IRQ_HPD directly to msm_dp_irq_hpd_handle() Gianfranco Mariotti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-237137@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gianfranco.mariotti94@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.