From: Andi Shyti <andi.shyti@kernel.org>
To: "H. Nikolaus Schaller" <hns@goldelico.com>
Cc: Paul Cercueil <paul@crapouillou.net>,
linux-mips@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] i2c: jz4780: Cache host clock rate at probe to prevent CCF prepare_lock deadlock
Date: Mon, 27 Jul 2026 22:59:50 +0200 [thread overview]
Message-ID: <amfGZudmo_oNgf04@zenone.zhora.eu> (raw)
In-Reply-To: <2db6fd233aceb7238474e4833f4d25ca681c3ffb.1784492382.git.hns@goldelico.com>
Hi Nikolaus,
On Sun, Jul 19, 2026 at 10:19:43PM +0200, H. Nikolaus Schaller wrote:
> Fix a severe AB/BA deadlock between the Common Clock Framework (CCF)
> and the I2C adapter lock, which triggers when an I2C-controlled clock
> generator client (like the Si5351) is registered or modified under the CCF.
>
> During an i2c client clock (generator) frequency change, the CCF acquires its global
> 'prepare_lock' mutex and the driver calls i2c_transfer() to update the client's
> chip registers, stalling for the adapter's I2C bus lock.
>
> Concurrently, an independent, parallel transfer on the same bus (e.g., a GPIO
> expander handling LEDs) can hold the I2C adapter lock. Inside this parallel
> transfer path, jz4780_i2c_set_speed() calls clk_get_rate() on the host
> controller's input clock to calculate bus timings. This call attempts to acquire
> the blocked CCF 'prepare_lock', creating a circular dependency that freezes
> the system.
>
> The jz4780 host controller clock itself is static and never changes at runtime.
>
> However, calling clk_get_rate() inside the active transfer path introduces
> an unnecessary dependency on the CCF internal locks.
>
> Eliminate this synchronous clk_get_rate() call from the active transfer
> path by caching the static host peripheral clock rate once - inside the private
> jz4780_i2c structure during jz4780_i2c_probe(). Update jz4780_i2c_set_speed()
> to use this cached value, safely decoupling active I2C transactions from the
> CCF internal locks without any risk of stale timings.
>
> Assisted-by web based Google AI (pinpointing the bug and writing the message).
>
> Fixes: ba92222ed63a12 ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780")
> Cc: stable@vger.kernel.org
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
To be clear, I wasn't against the patch itself, I just didn't
like the commit log and I raised questions coming just from
reading the log.
In this v2 you are missing the changelog, please, don't forget
next time to add it.
I merged your patch in i2c/i2c-fixes.
Thanks,
Andi
next prev parent reply other threads:[~2026-07-27 20:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-19 20:19 H. Nikolaus Schaller
2026-07-27 20:59 ` Andi Shyti [this message]
2026-07-31 6:04 ` H. Nikolaus Schaller
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=amfGZudmo_oNgf04@zenone.zhora.eu \
--to=andi.shyti@kernel.org \
--cc=hns@goldelico.com \
--cc=letux-kernel@openphoenux.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=stable@vger.kernel.org \
/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®