[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hXUoqmxwjH0CN8gGDj=qnC3ZWrJc5VarkqRfh=0SCUWw@mail.gmail.com>
Date: Thu, 14 Aug 2025 13:48:29 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Prashant Malani <pmalani@...gle.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Viresh Kumar <viresh.kumar@...aro.org>,
Beata Michalska <beata.michalska@....com>, Jie Zhan <zhanjie9@...ilicon.com>,
Ionela Voinescu <ionela.voinescu@....com>, Ben Segall <bsegall@...gle.com>,
Dietmar Eggemann <dietmar.eggemann@....com>, Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>, open list <linux-kernel@...r.kernel.org>,
"open list:CPU FREQUENCY SCALING FRAMEWORK" <linux-pm@...r.kernel.org>, Mel Gorman <mgorman@...e.de>,
Peter Zijlstra <peterz@...radead.org>, Steven Rostedt <rostedt@...dmis.org>,
Valentin Schneider <vschneid@...hat.com>, Vincent Guittot <vincent.guittot@...aro.org>,
z00813676 <zhenglifeng1@...wei.com>, sudeep.holla@....com
Subject: Re: [PATCH v2 2/2] cpufreq: CPPC: Dont read counters for idle CPUs
On Mon, Aug 11, 2025 at 10:01 PM Prashant Malani <pmalani@...gle.com> wrote:
>
> On Aug 11 21:19, Rafael J. Wysocki wrote:
> > On Mon, Aug 11, 2025 at 8:43 PM Prashant Malani <pmalani@...gle.com> wrote:
> > >
> > > On Aug 11 11:35, Viresh Kumar wrote:
> > > > On 06-08-25, 17:19, Prashant Malani wrote:
> > > > > So, do we have consensus that the idle check is acceptable as proposed?
> > > > > (Just want to make sure this thread doesn't get lost given another thread
> > > > > has forked off in this conversation).
> > > >
> > > > I don't have any objections to this or a better solution to this.
> > >
> > > Thanks Viresh! Beata, can we kindly move ahead with the idle
> > > optimization (which is this series), while we continue discussions for
> > > the "under load" scenarios on the other thread?
> >
> > I need some more time, please?
> >
> > This problem is similar (if not analogous) to what happens on x86 and
> > that is not handled in the cpuidle core.
>
> My apologies! Didn't mean to rush.
No worries.
> Will stand by for updates.
First off, AFAICS, using idle_cpu() for reliable detection of CPU
idleness in a sysfs attribute code path would be at least
questionable, if not outright invalid. By the time you have got a
result from it, there's nothing to prevent the CPU in question from
going idle or waking up from idle. Moreover, the fact that the given
CPU is idle from the scheduler perspective doesn't actually mean that
it is in an idle state and so it has no bearing on whether or not its
performance counters can be accessed etc.
The way x86 deals with this problem is to snapshot the counters in
question periodically (actually, in scheduler ticks) and fall back to
cpu_khz if the interval between the two consecutive updates is too
large (see https://elixir.bootlin.com/linux/v6.16/source/arch/x86/kernel/cpu/aperfmperf.c#L502).
I think that this is the only reliable way to handle it, but I may be
mistaken.
Powered by blists - more mailing lists