Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andre Przywara" <andre.przywara@arm.com>
Cc: devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev,
	robh@kernel.org, conor+dt@kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH v3 3/4] clk: sunxi-ng: add support for the A523/T527 CPU CCU
Date: Fri, 25 Sep 2026 23:06:06 +0000	[thread overview]
Message-ID: <20260925230607.343D71F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260925225112.14081-4-andre.przywara@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] clk: sunxi-ng: race condition exposes clock provider before notifiers are active
--

commit a788d9f9856e477a2e6af810c839fb77ae3d033e
Author: Andre Przywara <andre.przywara@arm.com>

clk: sunxi-ng: add support for the A523/T527 CPU CCU
    
The A523 contains a separate CCU block for the CPU PLLs. This includes
one CPU clock per cluster, plus the DSU PLL, which clocks the part that
connects the two clusters. There is also a "backup" PLL, which can be used
to clock the cores when the main PLLs are reprogrammed.
Those PLLs are then connected via MUXes to the two clusters and the DSU.

Describe those clocks and their relationship, to allow the kernel to
adjust the core frequency.

> diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.c b/drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.c
> new file mode 100644
> index 0000000000000..ef1b05b2a9b58
> --- /dev/null
> +++ b/drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.c
> @@ -0,0 +1,378 @@

[ ... ]

> +static int sun55i_a523_cpu_ccu_probe(struct platform_device *pdev)
> +{
> +	const struct sunxi_ccu_desc *desc;
> +	void __iomem *reg;
> +	int i, ret;

[ ... ]

> +	ret = devm_sunxi_ccu_probe(&pdev->dev, reg, desc);
> +	if (ret)
> +		return ret;
> +
> +	/* Reparent CPUs/DSU during PLL rate changes */
> +	ccu_mux_notifier_register(pll_cpu_l_clk.common.hw.clk,
> +				  &sun55i_a523_cpu_l_nb);

[Severity: Medium]
Could this expose the clock provider before the notifiers are registered?

If devm_sunxi_ccu_probe() publishes the clock provider globally, and the
thread is preempted immediately after it returns, could deferred probe
workqueues run asynchronously and probe a consumer?

If a consumer like cpufreq then calls clk_set_rate() before the subsequent
ccu_mux_notifier_register() calls are executed, would the PLL relock
without reparenting the CPU, potentially leading to a system crash?

> +	ccu_mux_notifier_register(pll_cpu_b_clk.common.hw.clk,
> +				  &sun55i_a523_cpu_b_nb);
> +	ccu_mux_notifier_register(pll_cpu_dsu_clk.common.hw.clk,
> +				  &sun55i_a523_cpu_dsu_nb);
> +
> +	return ret;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925225112.14081-1-andre.przywara@arm.com?part=3

  reply	other threads:[~2026-09-25 23:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 22:51 [PATCH v3 0/4] arm64: allwinner: a523: Enable CPU clocks Andre Przywara
2026-09-25 22:51 ` [PATCH v3 1/4] clk: sunxi-ng: generalise update bit Andre Przywara
2026-09-25 22:51 ` [PATCH v3 2/4] dt-bindings: clock: sun55i-a523-ccu: Add A523 CPU CCU clock controller Andre Przywara
2026-09-29  8:42   ` Krzysztof Kozlowski
2026-10-04 22:50     ` Andre Przywara
2026-10-06 16:03       ` Krzysztof Kozlowski
2026-09-25 22:51 ` [PATCH v3 3/4] clk: sunxi-ng: add support for the A523/T527 CPU CCU Andre Przywara
2026-09-25 23:06   ` sashiko-bot [this message]
2026-09-25 22:51 ` [PATCH v3 4/4] arm64: dts: allwinner: a523: add CPU clocks Andre Przywara

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=20260925230607.343D71F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=andre.przywara@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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