From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Bjorn Andersson <andersson@kernel.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-remoteproc@vger.kernel.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] remoteproc: mediatek: Break lock dependency to `prepare_lock`
Date: Mon, 12 Jan 2026 11:13:16 +0000 [thread overview]
Message-ID: <aWTXTMTanGj1io3b@google.com> (raw)
In-Reply-To: <kkwqx4h3oqmfimejyy73hreq5pcjwbijwy2chnve5bjmcq4fli@ty4n5adbo5oy>
On Sat, Jan 10, 2026 at 01:10:22PM -0600, Bjorn Andersson wrote:
> On Mon, Dec 29, 2025 at 04:31:46AM +0000, Tzung-Bi Shih wrote:
> > `scp_ipi_send` acquires `prepare_lock` via `clk_prepare_enable` while
>
> Please suffix functions with (), instead of treating it just like any
> other `symbol`, this makes it easier to see what is a function and what
> is an object/variable.
>
> > the caller often holds `ec_dev->lock` (e.g., `cros_ec_cmd_xfer`). The
> > reverse dependency exists where `clk_prepare` can trigger operations
> > that eventually take `ec_dev->lock` (e.g., via sysfs/regulator/genpd).
>
> Can you please expand this explanation slightly. You're hinting that
> there's an ABBA issue, but you're leaving it to the reader to know/guess
> what that issue is.
>
> I believe you have some concrete case where this is a probelm, please
> include this, if nothing else as an example.
>
> >
> > Move clock prepare / unprepare operations to remoteproc prepare() /
> > unprepare() callbacks to break the lock dependency from `ec_dev->lock`
> > to `prepare_lock`.
>
> Please expand this with an argumentation that the prolonged "prepared
> time" will not have any negative impact.
>
> >
> > This breaks the dependency chain in the lockdep report:
> > > WARNING: possible circular locking dependency detected
> > > ...
> > > the existing dependency chain (in reverse order) is:
> > > ...
> > > -> #0 (prepare_lock){+.+.}-{3:3}:
> > > __lock_acquire
> > > lock_acquire
> > > __mutex_lock_common
> > > mutex_lock_nested
> > > clk_prepare
> > > scp_ipi_send [mtk_scp_ipi]
> > > scp_send_ipi [mtk_scp]
> > > mtk_rpmsg_send [mtk_rpmsg]
> > > rpmsg_send [rpmsg_core]
> > > cros_ec_pkt_xfer_rpmsg [cros_ec_rpmsg]
>
> If this is the AB case, can you please include a stack for the BA case
> as well in the commit message?
>
>
> With these things clarified, I expect that your patch is the correct way
> to solve the problem.
An attempt: https://lore.kernel.org/r/20260112110755.2435899-1-tzungbi@kernel.org
prev parent reply other threads:[~2026-01-12 11:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-29 4:31 [PATCH] remoteproc: mediatek: Break lock dependency to `prepare_lock` Tzung-Bi Shih
2026-01-05 22:16 ` Mathieu Poirier
2026-01-06 3:13 ` Tzung-Bi Shih
2026-01-06 17:10 ` Mathieu Poirier
2026-01-07 2:21 ` Tzung-Bi Shih
2026-01-07 15:29 ` Mathieu Poirier
2026-01-10 19:10 ` Bjorn Andersson
2026-01-12 11:13 ` Tzung-Bi Shih [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=aWTXTMTanGj1io3b@google.com \
--to=tzungbi@kernel.org \
--cc=andersson@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=matthias.bgg@gmail.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 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.