From: Stephen Boyd <sboyd@kernel.org>
To: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Cc: "Chen-Yu Tsai" <wenst@google.com>,
kernel@collabora.com,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Hsin-Hsiung Wang" <hsin-hsiung.wang@mediatek.com>,
"James Lo" <james.lo@mediatek.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v3] spmi: mtk-pmif: Serialize PMIF status check and command submission
Date: Mon, 23 Oct 2023 18:59:00 -0700 [thread overview]
Message-ID: <fa60aec390fa463f153ff0d890af075b.sboyd@kernel.org> (raw)
In-Reply-To: <20230724154739.493724-1-nfraprado@collabora.com>
Quoting Nícolas F. R. A. Prado (2023-07-24 08:47:33)
> Before writing the read or write command to the SPMI arbiter through the
> PMIF interface, the current status of the channel is checked to ensure
> it is idle. However, since the status only changes from idle when the
> command is written, it is possible for two concurrent calls to determine
> that the channel is idle and simultaneously send their commands. At this
> point the PMIF interface hangs, with the status register no longer being
> updated, and thus causing all subsequent operations to time out.
>
> This was observed on the mt8195-cherry-tomato-r2 machine, particularly
> after commit 46600ab142f8 ("regulator: Set PROBE_PREFER_ASYNCHRONOUS for
> drivers between 5.10 and 5.15") was applied, since then the two MT6315
> devices present on the SPMI bus would probe assynchronously and
> sometimes (during probe or at a later point) read the bus
> simultaneously, breaking the PMIF interface and consequently slowing
> down the whole system.
>
> To fix the issue at its root cause, introduce locking around the channel
> status check and the command write, so that both become an atomic
> operation, preventing race conditions between two (or more) SPMI bus
> read/write operations. A spinlock is used since this is a fast bus, as
> indicated by the usage of the atomic variant of readl_poll, and
> '.fast_io = true' being used in the mt6315 driver, so spinlocks are
> already used for the regmap access.
>
> Fixes: b45b3ccef8c0 ("spmi: mediatek: Add support for MT6873/8192")
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
>
> ---
Applied to spmi-next
prev parent reply other threads:[~2023-10-24 1:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 15:47 [PATCH v3] spmi: mtk-pmif: Serialize PMIF status check and command submission Nícolas F. R. A. Prado
2023-07-25 6:52 ` AngeloGioacchino Del Regno
2023-08-10 22:03 ` Nícolas F. R. A. Prado
2023-09-19 20:12 ` Nícolas F. R. A. Prado
2023-10-10 8:52 ` AngeloGioacchino Del Regno
2023-08-11 11:09 ` Alexandre Mergnat
2023-10-24 1:59 ` Stephen Boyd [this message]
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=fa60aec390fa463f153ff0d890af075b.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=gregkh@linuxfoundation.org \
--cc=hsin-hsiung.wang@mediatek.com \
--cc=james.lo@mediatek.com \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=nfraprado@collabora.com \
--cc=wenst@google.com \
/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;
as well as URLs for NNTP newsgroup(s).