From: "Cédric Bellegarde" <cedric.bellegarde@adishatz.org>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: robin.clark@oss.qualcomm.com, lumag@kernel.org,
abhinav.kumar@linux.dev, jesszhan0024@gmail.com, sean@poorly.run,
marijn.suijten@somainline.org, airlied@gmail.com,
simona@ffwll.ch, antomani103@gmail.com, mitltlatltl@gmail.com,
krzk@kernel.org, linux-arm-msm@vger.kernel.org,
dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/msm/dsi: fix race between cmd transfer and host power off
Date: Thu, 19 Mar 2026 09:52:00 +0100 [thread overview]
Message-ID: <15a76455-d2f4-4ad5-8474-dc29a7ad4099@adishatz.org> (raw)
In-Reply-To: <6wu7eezhtqyatbvoryprfpwkcmofdk4albr2zedfrbnrw37amf@rx4lslum3u6b>
Le 18/03/2026 à 14:57, Dmitry Baryshkov a écrit :
> On Wed, Mar 18, 2026 at 11:56:35AM +0100, Cédric Bellegarde wrote:
>> The transfer function dsi_host_transfer() guards against the DSI host
>> being inactive by checking msm_host->power_on. However, power_on is
>> cleared at the end of msm_dsi_host_power_off(), after clocks have
>> already been disabled. This creates a window where a concurrent DCS
>> command (e.g. a brightness update from the backlight driver) can pass
>> the power_on check, call xfer_prepare()/xfer_restore(), and toggle
>> link clocks that are already being torn down, leaving
>> disp_cc_mdss_byte0_clk stuck in the 'on' state.
>>
>> Checking enabled instead of power_on closes the race by rejecting
>> transfers as soon as the bridge starts tearing down, before any clocks
>> are touched.
> Thanks, but it is not correct. The transfer callback is documented as
> requiring to power up the host if it is not on at the time it is
> called. Could you please implement corresponding logic?
Hi,
Thank you for your review.
Looking at the mipi_dsi_host_ops documentation: "Also note that those
callbacks can be called no matter the state the host is in. Drivers that
need the underlying device to be powered to perform these operations
will first need to make sure it's been properly enabled."
I would argue that this sentence places the responsibility on the caller
to ensure the host is properly enabled before calling transfer(), not on
the transfer() implementation itself to power up the hardware.
In our case, powering up the DSI host from within transfer() is not
trivially achievable. These arguments and steps are owned by
dsi_mgr_bridge_power_on() and are not available at transfer() time
without significant architectural changes that would spread power
management logic outside the manager.
BTW, I'm quite new to kernel dev, my logic may be totally wrong. If that
is indeed the expected behaviour, would a callback mechanism be
acceptable, where the manager registers a power_on callback on the host
at bridge init time, allowing transfer() to trigger the full power
sequence owned by the manager without duplicating it ?
>>
>> Signed-off-by: Cédric Bellegarde <cedric.bellegarde@adishatz.org>
>> ---
>> drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
>> index 4d75529c0e85..f66f138cfba0 100644
>> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
>> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
>> @@ -1652,7 +1652,7 @@ static ssize_t dsi_host_transfer(struct mipi_dsi_host *host,
>> struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
>> int ret;
>>
>> - if (!msg || !msm_host->power_on)
>> + if (!msg || !msm_host->enabled)
>> return -EINVAL;
>>
>> mutex_lock(&msm_host->cmd_mutex);
>> --
>> 2.53.0
>>
Regards,
--
Cédric Bellegarde
next prev parent reply other threads:[~2026-03-19 8:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 10:56 Cédric Bellegarde
2026-03-18 13:57 ` Dmitry Baryshkov
2026-03-19 8:52 ` Cédric Bellegarde [this message]
2026-03-25 20:24 ` Cédric Bellegarde
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=15a76455-d2f4-4ad5-8474-dc29a7ad4099@adishatz.org \
--to=cedric.bellegarde@adishatz.org \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=antomani103@gmail.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=krzk@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=mitltlatltl@gmail.com \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®