From: sashiko-bot@kernel.org
To: "Kevin Hilman (TI)" <khilman@baylibre.com>
Cc: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH] cpuidle: psci: Assign domain callbacks to all CPU idle states
Date: Mon, 31 Aug 2026 21:14:09 +0000 [thread overview]
Message-ID: <20260831211410.0117E1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260831-topic-lpm-psci-domain-callbacks-v1-1-4a47d95c9c79@baylibre.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The genpd governor bypasses the cpuidle governor's short-sleep predictions for shallow states, forcing CPUs into deep sleep and violating exit latency requirements.
--
commit 377e8584faa669a41142f336e4973cde237d354b
Author: Kevin Hilman (TI) <khilman@baylibre.com>
cpuidle: psci: Assign domain callbacks to all CPU idle states
This commit assigns domain-aware callbacks to all non-WFI CPU idle states.
This ensures the domain-idle-state logic and cluster-level states can be
triggered regardless of the selected CPU idle state.
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index dcf20ea5ef5e3..db9aa57c51f55 100644
> --- a/drivers/cpuidle/cpuidle-psci.c
> +++ b/drivers/cpuidle/cpuidle-psci.c
[ ... ]
> @@ -261,14 +263,22 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv,
> psci_cpuidle_use_syscore = true;
>
> /*
> - * Using the deepest state for the CPU to trigger a potential selection
> - * of a shared state for the domain, assumes the domain states are all
> - * deeper states. On PREEMPT_RT the hierarchical topology is limited to
> - * s2ram and s2idle.
> + * Assign the domain-aware callbacks to all CPU idle states so that the
> + * domain-idle-state logic is triggered regardless of which CPU idle
> + * state is selected.
> + *
> + * For s2idle, enter_s2idle uses dev_pm_genpd_suspend() which is safe
> + * on PREEMPT_RT. find_deepest_state() will pick the deepest state
> + * whose exit latency fits within the active QoS constraint.
> + *
> + * For the normal idle path, enter uses pm_runtime_put_sync_suspend()
> + * which may sleep and is therefore not used on PREEMPT_RT.
> */
> - drv->states[state_count - 1].enter_s2idle = psci_enter_s2idle_domain_idle_state;
> - if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> - drv->states[state_count - 1].enter = psci_enter_domain_idle_state;
> + for (i = 1; i < state_count; i++) {
> + drv->states[i].enter_s2idle = psci_enter_s2idle_domain_idle_state;
> + if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> + drv->states[i].enter = psci_enter_domain_idle_state;
> + }
[Severity: High]
Does assigning these domain callbacks to shallow states bypass the cpuidle
governor's short-sleep predictions?
If the cpuidle governor predicts a short sleep (such as from frequent
interrupts) and selects a shallow CPU idle state,
psci_enter_domain_idle_state() calls pm_runtime_put_sync_suspend().
This drops the CPU PM domain refcount and triggers the genpd governor.
The genpd governor calculates idle duration strictly based on next_hrtimer,
ignoring the cpuidle governor's statistical short-sleep prediction. If the
next timer is distant, the genpd governor will select a deep cluster state
and update psci_domain_state.state.
When this happens, __psci_enter_domain_idle_state() unconditionally
overrides the CPU's chosen shallow state parameter with the deeper
composite state:
ds = this_cpu_ptr(&psci_domain_state);
if (ds->state)
state = ds->state;
trace_psci_domain_idle_enter(dev->cpu, state, s2idle);
ret = psci_cpu_suspend_enter(state) ? -1 : idx;
Could this force the CPU into deep sleep, causing exit latency constraint
violations when the expected short-term interrupt arrives?
Additionally, since __psci_enter_domain_idle_state() returns the shallow
state idx, will this incorrectly attribute deep-sleep latency and residency
to the shallow state and corrupt cpuidle statistics?
>
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831-topic-lpm-psci-domain-callbacks-v1-1-4a47d95c9c79@baylibre.com?part=1
next prev parent reply other threads:[~2026-08-31 21:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 18:51 Kevin Hilman (TI)
2026-08-31 21:14 ` sashiko-bot [this message]
2026-09-01 11:33 ` Ulf Hansson
2026-09-01 18:46 ` Kevin Hilman
2026-09-03 12:03 ` Ulf Hansson
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=20260831211410.0117E1F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=khilman@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--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
all inboxes | Powered by JetHome®