Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Konrad Dybcio" <konradybcio@kernel.org>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH RFC 01/16] clk: Propagate rate programming failures
Date: Wed, 14 Oct 2026 12:35:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-171286@kernel.org> (raw)
In-Reply-To: <20261014-topic-qc_clk_dvfs-v1-1-3041b788e9f7@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] clk: Undervoltage on partial rate change failure due to ABORT_RATE_CHANGE
--

commit 5ce89a94f0fcfcda3a335ff0e5689b0f216c3fd4
Author: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

clk: Propagate rate programming failures

This patch stops the clock rate-change walk at the first failure and
propagates the error back to the caller. It attempts to keep the topology,
temporary references, and terminal notifications consistent with the outcome.

> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 4d2cc86bfbeb6..95669775f8cd1 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c

[ ... ]

> @@ -2420,13 +2448,20 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core,
>  						  unsigned long event)
>  {
>  	struct clk_core *child, *tmp_clk, *fail_clk = NULL;
> +	unsigned long old_rate = core->rate;
> +	unsigned long new_rate = core->new_rate;
>  	int ret = NOTIFY_DONE;
>  
> -	if (core->rate == core->new_rate)
> +	if (event != PRE_RATE_CHANGE)
> +		old_rate = core->old_rate;
> +	if (event == POST_RATE_CHANGE)
> +		new_rate = core->rate;
> +
> +	if (old_rate == new_rate)
>  		return NULL;
>  
>  	if (core->notifier_count) {
> -		ret = __clk_notify(core, event, core->rate, core->new_rate);
> +		ret = __clk_notify(core, event, old_rate, new_rate);

[Severity: High]
When ABORT_RATE_CHANGE is sent, this uses the original old_rate and new_rate
parameters. Will this cause consumers to revert their changes even if the
hardware rate already changed?

[ ... ]

> @@ -2474,53 +2509,83 @@ static void clk_change_rate(struct clk_core *core)
>  	if (!skip_set_rate && core->ops->set_rate)
> -		core->ops->set_rate(core->hw, core->new_rate, best_parent_rate);
> +		ret = core->ops->set_rate(core->hw, core->new_rate,
> +					  best_parent_rate);

[ ... ]

> -		clk_change_rate(child);
> +		ret = clk_change_rate(child);
> +		if (ret)
> +			goto runtime_put;

[Severity: High]
If the hardware rate is successfully changed for the parent here, but a
subsequent child failure aborts the walk, does the parent remain at the
new rate while the software aborts?

[ ... ]

> @@ -2613,7 +2686,14 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
>  	}
>  
>  	/* change the rates */
> -	clk_change_rate(top);
> +	ret = clk_change_rate(top);
> +	if (ret) {
> +		__clk_recalc_rates(top, true, 0);
> +		clk_propagate_rate_change(top, ABORT_RATE_CHANGE);
> +		goto err;
> +	}

[Severity: High]
If clk_change_rate() fails downstream after the parent hardware rate was
already increased, does broadcasting ABORT_RATE_CHANGE here result in
undervoltage?

For example, consumers like cpufreq or existing device notifiers might
receive the abort and revert their PRE_RATE_CHANGE voltage increases,
leaving the hardware running at the high new rate with the low old voltage.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-topic-qc_clk_dvfs-v1-0-3041b788e9f7@oss.qualcomm.com?part=1

  reply	other threads:[~2026-10-14 12:35 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 12:19 [RFC PATCH 00/16] Centralize the ownership of power rail votes for Qualcomm clocks Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 01/16] clk: Propagate rate programming failures Konrad Dybcio
2026-10-14 12:35   ` sashiko-bot [this message]
2026-10-14 13:25   ` Dmitry Baryshkov
2026-10-14 12:19 ` [PATCH RFC 02/16] clk: Acquire resources for clock transitions Konrad Dybcio
2026-10-14 12:40   ` sashiko-bot
2026-10-14 12:19 ` [PATCH RFC 03/16] OPP: Retry failed default single-clock transitions Konrad Dybcio
2026-10-14 12:34   ` sashiko-bot
2026-10-14 13:35   ` Dmitry Baryshkov
2026-10-14 16:14     ` Konrad Dybcio
2026-10-14 16:32       ` Dmitry Baryshkov
2026-10-14 12:19 ` [PATCH RFC 04/16] pmdomain: core: Support named indexed virtual attachments Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 05/16] pmdomain: core: Support subdomains without pstate propagation Konrad Dybcio
2026-10-14 12:41   ` sashiko-bot
2026-10-14 12:19 ` [PATCH RFC 06/16] pmdomain: core: Support indexed power-domain attachment lists Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 07/16] clk: qcom: Add clock-owned GenPD DVFS aggregation Konrad Dybcio
2026-10-14 12:35   ` sashiko-bot
2026-10-14 14:36   ` Dmitry Baryshkov
2026-10-14 15:26     ` Konrad Dybcio
2026-10-14 16:30       ` Dmitry Baryshkov
2026-10-14 16:45         ` Konrad Dybcio
2026-10-14 17:31           ` Dmitry Baryshkov
2026-10-14 12:19 ` [PATCH RFC 08/16] clk: qcom: dvfs: Add debugfs Konrad Dybcio
2026-10-14 12:37   ` sashiko-bot
2026-10-14 12:19 ` [PATCH RFC 09/16] clk: qcom: clk-alpha-pll: Add DVFS (un)prepare Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 10/16] clk: qcom: clk-alpha-pll: Vote for the PLL calibration frequency Konrad Dybcio
2026-10-14 12:34   ` sashiko-bot
2026-10-14 12:19 ` [PATCH RFC 11/16] clk: qcom: gdsc: Make GDSC parenting optional Konrad Dybcio
2026-10-14 12:30   ` sashiko-bot
2026-10-14 14:17   ` Dmitry Baryshkov
2026-10-14 14:20     ` Konrad Dybcio
2026-10-14 14:34       ` Dmitry Baryshkov
2026-10-14 14:36         ` Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 12/16] clk: qcom: gdsc: Link required power domains Konrad Dybcio
2026-10-14 12:32   ` sashiko-bot
2026-10-14 12:19 ` [PATCH DNM RFC 13/16] arm64: dts: qcom: sm8650: Describe clock controller power rails Konrad Dybcio
2026-10-14 12:41   ` sashiko-bot
2026-10-14 14:19   ` Dmitry Baryshkov
2026-10-14 14:20     ` Konrad Dybcio
2026-10-14 14:33       ` Dmitry Baryshkov
2026-10-14 14:36         ` Konrad Dybcio
2026-10-14 15:01           ` Dmitry Baryshkov
2026-10-14 15:23             ` Konrad Dybcio
2026-10-14 12:19 ` [PATCH DNM RFC 14/16] clk: qcom: Enable clk-dvfs on SM8650 Konrad Dybcio
2026-10-14 12:36   ` sashiko-bot
2026-10-14 14:40   ` Dmitry Baryshkov
2026-10-14 15:22     ` Konrad Dybcio
2026-10-14 16:35       ` Dmitry Baryshkov
2026-10-14 16:42         ` Konrad Dybcio
2026-10-14 12:19 ` [PATCH DNM RFC 15/16] arm64: dts: qcom: sm8650: Drop required-opps Konrad Dybcio
2026-10-14 12:39   ` sashiko-bot
2026-10-14 14:23   ` Dmitry Baryshkov
2026-10-14 14:33     ` Konrad Dybcio
2026-10-14 12:19 ` [PATCH DNM RFC 16/16] pmdomain: qcom: rpmhpd: Stop forwarding MMCX pstate to CX Konrad Dybcio
2026-10-14 12:37   ` sashiko-bot
2026-10-14 14:37 ` [RFC PATCH 00/16] Centralize the ownership of power rail votes for Qualcomm clocks Dmitry Baryshkov
2026-10-14 16:19   ` Konrad Dybcio

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=sashiko-outbox-171286@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --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