From: Ghennadi Procopciuc <ghennadi.procopciuc@oss.nxp.com>
To: Brian Masney <bmasney+clk@redhat.com>,
Sudeep Holla <sudeep.holla@kernel.org>,
Stephen Boyd <sboyd@kernel.org>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Cristian Marussi <cristian.marussi@arm.com>
Cc: linux-doc@vger.kernel.org, Alberto Ruiz <aruizrui@redhat.com>,
linux-arm-kernel@lists.infradead.org,
Christophe Lizzi <clizzi@redhat.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
arm-scmi@vger.kernel.org, Eric Chanudet <echanude@redhat.com>,
Enric Balletbo <eballetb@redhat.com>,
NXP S32 Linux Team <s32@nxp.com>,
Jonathan Corbet <corbet@lwn.net>
Subject: [PATCH RFC 0/2] firmware: arm_scmi: clock: stop discovering every clock at boot
Date: Wed, 2 Dec 2026 10:04:15 +0200 [thread overview]
Message-ID: <f04dd615-665c-4b29-bcda-f05a01fa5317@oss.nxp.com> (raw)
In-Reply-To: <20261113-b4-scmi-clk-on-demand-v1-0-7fd162097b57@oss.nxp.com>
On 11/13/2026 3:27 PM, Ghennadi Procopciuc via B4 Relay wrote:
> Hi all,
>
> At probe, the SCMI clock protocol and clk-scmi discover and register
> every clock the platform reports, whether or not a Linux consumer
> references it. On platforms that report hundreds of clocks, this can
> add tens of milliseconds or more to every boot.
>
> This is sent as RFC to get feedback on the direction before a final
> version. The questions are listed at the end.
>
> The problem
> ===========
>
> For each clock, probe sends a fixed number of messages:
>
> - CLOCK_ATTRIBUTES, in scmi_clock_protocol_init()
> - CLOCK_GET_PERMISSIONS, if the platform supports it
> - CLOCK_DESCRIBE_RATES, at least once even with the bounded iterators
> - CLOCK_POSSIBLE_PARENTS_GET and CLOCK_NAME_GET, when applicable
> - CLOCK_RATE_GET, from __clk_core_init() at registration
>
> The total cost is about N_clocks x messages_per_clock x message_latency.
> It grows with the number of clocks the platform reports, not with the
> number of clocks Linux uses. Three properties make it worth addressing:
>
> 1. It is paid on every boot. The result does not change between boots
> with the same firmware, but nothing is cached. Every cold boot, warm
> reboot or kexec pays it again, and so does every VM that has its own
> SCMI clock provider.
>
> 2. It is on the critical path. scmi_clocks_probe() runs synchronously
> and registers the provider only at the end. Every consumer of an SCMI
> clock waits for the whole set to be discovered, and through fw_devlink
> so do the devices that depend on those consumers. A storage controller
> that needs one clock to mount the root filesystem waits for hundreds.
>
> 3. Most of the work is for clocks Linux has no use for. SoCs that run
> several agents or partitions on one SCMI server often report the full
> clock space to every agent. An agent may have only a dozen clocks
> referenced in its device tree, and may not even be allowed to control
> the others, but it still discovers and registers all of them.
>
> clk_disable_unused() adds to this. It walks every registered clock and,
> for clocks with an is_prepared op, sends CLOCK_CONFIG_GET for each one,
> including clocks Linux can never disable.
Hi Sudeep, Cristian, Stephen, Brian,
Gentle ping on this RFC.
Before I invest more time in a v2, I'd like to agree on the direction:
1. Is it acceptable to discover and register only the SCMI clocks
referenced in the device tree, instead of every clock the platform reports?
2. If yes, should this stay in SCMI, or would you prefer a generic
mechanism in the clock framework that other firmware-backed providers
could use?
Sashiko flagged two issues (the -EINVAL lookup being turned into -ENOENT
by clk_get(), and a refcount underflow on the notifier path). Both are
valid and will be fixed in the next version, whichever direction we take.
Thanks,
Ghennadi
prev parent reply other threads:[~2026-12-02 8:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 13:27 Ghennadi Procopciuc via B4 Relay
2026-11-13 13:27 ` [PATCH RFC 1/2] firmware: arm_scmi: clock: discover clock domains on first use Ghennadi Procopciuc via B4 Relay
2026-11-13 13:27 ` [PATCH RFC 2/2] clk: scmi: optionally register only clocks referenced in the device tree Ghennadi Procopciuc via B4 Relay
2026-12-02 8:04 ` Ghennadi Procopciuc [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=f04dd615-665c-4b29-bcda-f05a01fa5317@oss.nxp.com \
--to=ghennadi.procopciuc@oss.nxp.com \
--cc=arm-scmi@vger.kernel.org \
--cc=aruizrui@redhat.com \
--cc=bmasney+clk@redhat.com \
--cc=clizzi@redhat.com \
--cc=corbet@lwn.net \
--cc=cristian.marussi@arm.com \
--cc=eballetb@redhat.com \
--cc=echanude@redhat.com \
--cc=jbrunet+clk@baylibre.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=s32@nxp.com \
--cc=sboyd@kernel.org \
--cc=sudeep.holla@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®