mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 1/2] cpuidle: Skip miss accounting for timer broadcast fallbacks
Date: Tue, 10 Nov 2026 22:25:38 +0000	[thread overview]
Message-ID: <77dc00cf-49ce-4f3e-a2fd-32c80f9b8b5a@arm.com> (raw)
In-Reply-To: <CAJZ5v0g7gZH=Eod5xXcP0adN1r=-eLqpKA-CpS+hYXjgndZFHg@mail.gmail.com>

On 11/10/26 20:16, Rafael J. Wysocki (Intel) wrote:
> On Fri, Oct 30, 2026 at 9:36 AM Christian Loehle
> <christian.loehle@arm.com> wrote:
>>
>> A failed tick_broadcast_enter() can force a shallower state than the
>> governor selected. Exclude successful broadcast fallbacks from above/below
>> miss accounting while retaining their usage, residency and governor
>> feedback.
> 
> Is this a theoretical problem, or can it be observed in practice?
> 
> In either case, it would be good to add some information on that here.

It's very much a real problem, see the cover letter, it's about 5% of
the accounted idle_misses on arm64.

> 
>> Fixes: 04dab58a39d4 ("cpuidle: Add 'above' and 'below' idle state metrics")
>> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
>> ---
>>  drivers/cpuidle/cpuidle.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
>> index 2d2f40a2cb81..faa29f58738e 100644
>> --- a/drivers/cpuidle/cpuidle.c
>> +++ b/drivers/cpuidle/cpuidle.c
>> @@ -222,6 +222,7 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
>>
>>         struct cpuidle_state *target_state = &drv->states[index];
>>         bool broadcast = !!(target_state->flags & CPUIDLE_FLAG_TIMER_STOP);
>> +       bool broadcast_failed = false;
>>         ktime_t time_start, time_end;
>>
>>         instrumentation_begin();
>> @@ -232,6 +233,7 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
>>          * CPU as a broadcast timer, this call may fail if it is not available.
>>          */
>>         if (broadcast && tick_broadcast_enter()) {
>> +               broadcast_failed = true;
>>                 index = find_deepest_state(drv, dev, target_state->exit_latency_ns,
>>                                            CPUIDLE_FLAG_TIMER_STOP, false);
>>
>> @@ -306,6 +308,13 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
>>                 dev->states_usage[entered_state].time_ns += diff;
>>                 dev->states_usage[entered_state].usage++;
>>
>> +               /*
>> +                * The broadcast constraint forced a shallower state, do not
>> +                * account for it as a cpu_idle_miss.
>> +                */
>> +               if (broadcast_failed)
>> +                       goto out;
>> +
>>                 if (diff < drv->states[entered_state].target_residency_ns) {
>>                         for (i = entered_state - 1; i >= 0; i--) {
>>                                 if (dev->states_usage[i].disable)
>> @@ -338,6 +347,7 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
>>                 dev->states_usage[index].rejected++;
>>         }
>>
>> +out:
>>         instrumentation_end();
>>
>>         return entered_state;
>> --
>> 2.34.1
>>


  reply	other threads:[~2026-11-10 22:25 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 [this message]
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
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=77dc00cf-49ce-4f3e-a2fd-32c80f9b8b5a@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®