[PATCH v2 0/2] cpuidle: cpu_idle_miss accounting fixes

From: Christian Loehle

Date: Wed Nov 11 2026 - 07:00:58 EST


These two fixes exclude timer-broadcast fallbacks from governor miss
accounting and respect the latency constraint used for selection when
looking for a better deeper state.
No functional change outside of sysfs above/below and tracing.

Patch 1: Exclude timer-broadcast fallbacks

When tick_broadcast_enter() fails, the core forces a shallower state.
Exclude these entries from governor miss accounting while retaining
residency, usage and governor feedback.

On Orion O6, traces with menu and TEO running schbench, tbench and hackbench
recorded 6930 cpu_idle_miss events on 8172 broadcast fallbacks before the
fix, and none on 7763 fallbacks with patch 1. All matched fallbacks entered
WFI; counts cover complete idle episodes within workload markers.

Patch 2: Respect latency constraints for below misses

An enabled deeper state may violate the latency QoS constraint, causing a
false below miss. Sample the latency limit before governor selection and
share it with the governors and miss accounting. Exclude states exceeding
it, without an additional state-table walk. Disable flags continue to be
checked at exit.

Changes since v1:
- Add observed broadcast fallback statistics to patch 1. (Rafael)
- Sample QoS once before governor selection and reuse the same limit
for miss accounting. (Rafael)
I know the broader refactor in v2 makes it less appealling to backport
these to stable, but it massively improves the value of the cpu_idle_miss
trace event, when I have to look at some older stable-based Android traces,
where latency requirements may be set dynamically at runtime.

Christian Loehle (2):
cpuidle: Skip miss accounting for timer broadcast fallbacks
cpuidle: Respect latency constraints when accounting below misses

Documentation/driver-api/pm/cpuidle.rst | 13 ++++++-------
drivers/cpuidle/cpuidle.c | 18 +++++++++++++++++-
drivers/cpuidle/cpuidle.h | 1 +
drivers/cpuidle/governors/haltpoll.c | 2 +-
drivers/cpuidle/governors/ladder.c | 2 +-
drivers/cpuidle/governors/menu.c | 2 +-
drivers/cpuidle/governors/teo.c | 2 +-
include/linux/cpuidle.h | 2 +-
8 files changed, 29 insertions(+), 13 deletions(-)


base-commit: 067c5c24cef23d913b67eaaf71ae67e7169a6620
--
2.34.1