From: "Heiko Stübner" <heiko@sntech.de>
To: Andi Shyti <andi.shyti@kernel.org>, Wolfram Sang <wsa@kernel.org>,
Jensen Huang <jensenhuang@friendlyarm.com>,
Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-i2c@vger.kernel.org,
kernel@collabora.com, stable@vger.kernel.org,
Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: Re: [PATCH] i2c: rk3x: Do not sleep in atomic polling transfers
Date: Fri, 27 Nov 2026 13:46:55 +0100 [thread overview]
Message-ID: <7m4BPz_aRRWlgAirQmmfoQ@sntech.de> (raw)
In-Reply-To: <20261127-rk3x-atomic-transfer-fix-v1-1-076c94c07241@collabora.com>
Am Freitag, 27. November 2026, 13:33:05 Mitteleuropäische Normalzeit schrieb Sebastian Reichel:
> On the RK3576 Sige5 during shutdown the following trace appears on
> kernels with multi-core support and lockdep enabled:
>
> [ 167.961946] WARNING: kernel/irq_work.c:296 at irq_work_sync
> ...
> [ 167.963902] Hardware name: ArmSoM Sige5 (DT)
> ...
> [ 167.972228] Call trace:
> [ 167.972445] irq_work_sync+0xe8/0xf8 (P)
> [ 167.972796] disable_irq+0x44/0x60
> [ 167.973101] rk3x_i2c_xfer_common.isra.0+0x254/0x708
> [ 167.973544] rk3x_i2c_xfer_polling+0x20/0xa0
> [ 167.973925] __i2c_transfer+0x180/0x9d8
> [ 167.974269] i2c_transfer+0xc4/0x180
> [ 167.974589] regmap_i2c_read+0x64/0xc0
> [ 167.974924] _regmap_raw_read+0x120/0x468
> [ 167.975283] _regmap_bus_read+0x4c/0xa8
> [ 167.975626] _regmap_read+0x6c/0x260
> [ 167.975945] _regmap_update_bits+0x104/0x160
> [ 167.976325] regmap_update_bits_base+0x5c/0x90
> [ 167.976720] rk808_power_off+0x70/0x110
> ...
>
> Avoid waiting for a handler from another CPU to finish to fix the
> problem. At shutdown time this won't happen as the other CPUs are
> already stopped. Apart from that disable_irq_nosync() still prevents new
> invocations of the handler, which is what avoids the spinlock recursion.
> A handler already running on another CPU is serialized against the poll
> loop via i2c->lock.
>
> Cc: stable@vger.kernel.org
> Fixes: 19cde9c92b8d ("i2c: rk3x: fix potential spinlock recursion on poll")
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
With CONFIG_DEBUG_ATOMIC_SLEEP activated, this should also already
already warn from the might_sleep() in disable_irq(), I think.
> ---
> drivers/i2c/busses/i2c-rk3x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index 9ec3beced9f9..a07c60ab07b4 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -1096,7 +1096,7 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap,
> time_left = wait_event_timeout(i2c->wait, !i2c->busy,
> msecs_to_jiffies(WAIT_TIMEOUT));
> } else {
> - disable_irq(i2c->irq);
> + disable_irq_nosync(i2c->irq);
> rk3x_i2c_start(i2c);
>
> time_left = rk3x_i2c_wait_xfer_poll(i2c);
>
> ---
> base-commit: eeb63983deb23d68ddc47e5d1944a7d64acdaf22
> change-id: 20261127-rk3x-atomic-transfer-fix-23f2d43c38b6
>
> Best regards,
> --
> Sebastian Reichel <sebastian.reichel@collabora.com>
>
>
prev parent reply other threads:[~2026-11-27 12:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 12:33 [PATCH] i2c: rk3x: Do not sleep in atomic polling transfers Sebastian Reichel
2026-11-27 12:46 ` Heiko Stübner [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=7m4BPz_aRRWlgAirQmmfoQ@sntech.de \
--to=heiko@sntech.de \
--cc=andi.shyti@kernel.org \
--cc=jensenhuang@friendlyarm.com \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=sebastian.reichel@collabora.com \
--cc=stable@vger.kernel.org \
--cc=wsa@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