From: Christian Loehle <christian.loehle@arm.com>
To: "Rafael J. Wysocki (Intel)" <rafael@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@kernel.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] cpuidle: Respect latency constraints when accounting below misses
Date: Tue, 10 Nov 2026 22:33:06 +0000 [thread overview]
Message-ID: <f50285a8-61b6-4173-8f91-6259d3e595e8@arm.com> (raw)
In-Reply-To: <CAJZ5v0g2wqNDxe-R9fSQW4uF5XE1uW+8UP1u2UjnDDEWRO3LpQ@mail.gmail.com>
On 11/10/26 20:13, Rafael J. Wysocki (Intel) wrote:
> On Fri, Oct 30, 2026 at 9:36 AM Christian Loehle
> <christian.loehle@arm.com> wrote:
>>
>> Only count a below miss when an enabled deeper state meets the latency
>> constraint. Save the applicable limit before entry so QoS changes during
>> idle do not affect accounting. Continue checking disable flags on exit.
>>
>> Fixes: 04dab58a39d4 ("cpuidle: Add 'above' and 'below' idle state metrics")
>> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
>> ---
>> drivers/cpuidle/cpuidle.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
>> index faa29f58738e..e9195ea8cfb6 100644
>> --- a/drivers/cpuidle/cpuidle.c
>> +++ b/drivers/cpuidle/cpuidle.c
>> @@ -219,6 +219,7 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
>> int index)
>> {
>> int entered_state;
>> + s64 latency_req;
>>
>> struct cpuidle_state *target_state = &drv->states[index];
>> bool broadcast = !!(target_state->flags & CPUIDLE_FLAG_TIMER_STOP);
>> @@ -244,6 +245,8 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
>> if (target_state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
>> leave_mm();
>>
>> + latency_req = cpuidle_governor_latency_req(dev->cpu);
>> +
>
> What if this is different from what the governor has used? The limits
> may change at any time.
Right, it's just a few cycles after selection, but you're correct.
I will resend with a version that saves the used latency_req in dev.
>
>> /* Take note of the planned idle state. */
>> sched_idle_set_state(target_state);
>>
>> @@ -327,7 +330,8 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
>> }
>> } else if (diff > delay) {
>> for (i = entered_state + 1; i < drv->state_count; i++) {
>> - if (dev->states_usage[i].disable)
>> + if (dev->states_usage[i].disable ||
>> + drv->states[i].exit_latency_ns > latency_req)
>> continue;
>>
>> /*
>> --
>> 2.34.1
>>
next prev parent reply other threads:[~2026-11-10 22:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 8:36 [PATCH 0/2] cpuidle: idle_miss accounting fixes Christian Loehle
2026-10-30 8:36 ` [PATCH 1/2] cpuidle: Skip miss accounting for timer broadcast fallbacks Christian Loehle
2026-11-10 20:16 ` Rafael J. Wysocki (Intel)
2026-11-10 22:25 ` Christian Loehle
2026-10-30 8:36 ` [PATCH 2/2] cpuidle: Respect latency constraints when accounting below misses Christian Loehle
2026-11-10 20:13 ` Rafael J. Wysocki (Intel)
2026-11-10 22:33 ` Christian Loehle [this message]
2026-11-05 8:11 ` [PATCH 0/2] cpuidle: idle_miss accounting fixes Christian Loehle
2026-11-05 12:17 ` Rafael J. Wysocki (Intel)
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=f50285a8-61b6-4173-8f91-6259d3e595e8@arm.com \
--to=christian.loehle@arm.com \
--cc=daniel.lezcano@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@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®