From: Frank Li <Frank.li@oss.nxp.com>
To: Joy Zou <joy.zou@oss.nxp.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>, Ye Li <ye.li@nxp.com>,
Jacky Bai <ping.bai@nxp.com>, Peng Fan <peng.fan@nxp.com>,
Dong Aisheng <aisheng.dong@nxp.com>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] regulator: core: use system_freezable_wq for init complete work
Date: Thu, 16 Jul 2026 09:27:25 -0500 [thread overview]
Message-ID: <aljqTb1SGP487wJz@SMW015318> (raw)
In-Reply-To: <20260716-b4-regulator-pf01-v1-1-8c1519d54bd4@oss.nxp.com>
On Thu, Jul 16, 2026 at 11:50:53AM +0800, Joy Zou wrote:
> schedule_delayed_work() uses system_wq, which is non-freezable, allowing
> regulator_init_complete_work to run concurrently with system suspend. This
> work fires ~30s after boot to disable unused regulators via I2C. When it
> races with PM suspend, the I2C adapter may already be suspended, triggering
> a -ESHUTDOWN warning dump.
>
> [ 33.707233] pc : __i2c_transfer+0x36c/0x3c8
> [ 33.707240] lr : __i2c_transfer+0x36c/0x3c8
> [ 33.707246] sp : ffff80008239ba50
> [ 33.707249] x29: ffff80008239ba50 x28: 0000000000000001 x27: 0000000000000000
> [ 33.707259] x26: 0000000000000000 x25: 0000000000000001 x24: ffff0000c025c0e0
> [ 33.707268] x23: 0000000000000000 x22: ffff0000c025c0e1 x21: 0000000000000001
> [ 33.707277] x20: ffff80008239bae8 x19: ffff0000c0f54880 x18: fffffffffffeb320
> [ 33.707287] x17: 000000040044ffff x16: 0000000000000000 x15: ffff800082086fd8
> [ 33.707296] x14: 0000000000000000 x13: 0a6465646e657073 x12: 757320656c696877
> [ 33.707305] x11: 0000000000000058 x10: 0000000000000018 x9 : ffff800082087060
> [ 33.707314] x8 : 0000000000057fa8 x7 : 000000000000027d x6 : 0000000000000000
> [ 33.707323] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 00000000ffffffff
> [ 33.707333] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0000c0123480
> [ 33.707343] Call trace:
> [ 33.707346] __i2c_transfer+0x36c/0x3c8 (P)
> [ 33.707356] i2c_transfer+0x6c/0xf8
> [ 33.707364] i2c_transfer_buffer_flags+0x5c/0xa0
> [ 33.707372] regmap_i2c_write+0x20/0x60
> [ 33.707382] _regmap_raw_write_impl+0x5cc/0x660
> [ 33.707389] _regmap_bus_raw_write+0x60/0x80
> [ 33.707396] _regmap_write+0x58/0xc0
> [ 33.707403] _regmap_update_bits+0x11c/0x140
> [ 33.707409] regmap_update_bits_base+0x54/0x80
> [ 33.707416] regulator_disable_regmap+0x40/0x5c
> [ 33.707424] _regulator_do_disable+0x94/0xbc
> [ 33.707435] CPU2 is up
> [ 33.707433] regulator_late_cleanup+0xe0/0x1e8
> [ 33.707442] class_for_each_device+0x104/0x13c
> [ 33.707450] regulator_init_complete_work_function+0x54/0x80
> [ 33.707458] process_one_work+0x150/0x290
> [ 33.707467] worker_thread+0x180/0x2f4
> [ 33.707473] kthread+0x12c/0x204
> [ 33.707484] ret_from_fork+0x10/0x20
> [ 33.707493] ---[ end trace 0000000000000000 ]---
>
> Switch to system_freezable_wq so the work is frozen before any device
> is suspended, eliminating the race.
>
> Fixes: 55576cf18537 ("regulator: Defer init completion for a while after late_initcall")
> Signed-off-by: Joy Zou <joy.zou@oss.nxp.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/regulator/core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 1797929dfe56..d5d24a940f31 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -27,6 +27,7 @@
> #include <linux/regulator/driver.h>
> #include <linux/regulator/machine.h>
> #include <linux/module.h>
> +#include <linux/workqueue.h>
>
> #define CREATE_TRACE_POINTS
> #include <trace/events/regulator.h>
> @@ -6882,8 +6883,9 @@ static int __init regulator_init_complete(void)
> * we'd only do this on systems that need it, and a kernel
> * command line option might be useful.
> */
> - schedule_delayed_work(®ulator_init_complete_work,
> - msecs_to_jiffies(30000));
> + queue_delayed_work(system_freezable_wq,
> + ®ulator_init_complete_work,
> + msecs_to_jiffies(30000));
>
> return 0;
> }
>
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2026-07-16 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 3:50 [PATCH 0/3] regulator: handle regulator late cleanup race with PM suspend Joy Zou
2026-07-16 3:50 ` [PATCH 1/3] regulator: core: use system_freezable_wq for init complete work Joy Zou
2026-07-16 14:27 ` Frank Li [this message]
2026-07-16 3:50 ` [PATCH 2/3] regulator: pfuze100: add set_suspend_disable for LDO ops Joy Zou
2026-07-16 14:28 ` Frank Li
2026-07-16 3:50 ` [PATCH 3/3] arm64: dts: imx8mq-evk: add regulator-off-in-suspend for VGEN1/VGEN6 Joy Zou
2026-07-16 14:31 ` Frank Li
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=aljqTb1SGP487wJz@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=joy.zou@oss.nxp.com \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=ping.bai@nxp.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=ye.li@nxp.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