From: Beata Michalska <beata.michalska@arm.com>
To: Prashant Malani <pmalani@google.com>
Cc: Jie Zhan <zhanjie9@hisilicon.com>,
Ionela Voinescu <ionela.voinescu@arm.com>,
Ben Segall <bsegall@google.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
open list <linux-kernel@vger.kernel.org>,
"open list:CPU FREQUENCY SCALING FRAMEWORK"
<linux-pm@vger.kernel.org>, Mel Gorman <mgorman@suse.de>,
Peter Zijlstra <peterz@infradead.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Valentin Schneider <vschneid@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
z00813676 <zhenglifeng1@huawei.com>
Subject: Re: [PATCH v2 2/2] cpufreq: CPPC: Dont read counters for idle CPUs
Date: Mon, 14 Jul 2025 11:30:51 +0200 [thread overview]
Message-ID: <aHTOSyhwIAaW_1m1@arm.com> (raw)
In-Reply-To: <CAFivqmKBgYVa6JUh82TS2pO915PUDYZMH+k-5=-0u1-K9-gMMw@mail.gmail.com>
On Wed, Jul 09, 2025 at 03:49:03PM -0700, Prashant Malani wrote:
> On Wed, 9 Jul 2025 at 10:25, Prashant Malani <pmalani@google.com> wrote:
> >
> > Hi Beata,
> >
> > Thanks for taking a look.
> >
> > On Mon, 7 Jul 2025 at 01:33, Beata Michalska <beata.michalska@arm.com> wrote:
> > >
> > > Hi Prashant,
> > >
> > > On Wed, Jul 02, 2025 at 11:38:11AM -0700, Prashant Malani wrote:
> > > > Hi All,
> > > >
> > > > Ionela, Beata, could you kindly review ?
> > > >
> > > > On Fri, 27 Jun 2025 at 10:07, Prashant Malani <pmalani@google.com> wrote:
> > > > >
> > > >
> > > > I think it is pertinent to note: the actual act of reading the CPPC counters
> > > > will (at least for ACPI_ADR_SPACE_FIXED_HARDWARE counters)
> > > > wake the CPU up, so even if a CPU *was* idle, the reading of the counters
> > > > calls cpc_read_ffh() [1] which does an IPI on the target CPU [2] thus waking
> > > > it up from WFI.
> > > >
> > > > And that brings us back to the original assertion made in this patch:
> > > > the counter values are quite unreliable when the CPU is in this
> > > > idle (or rather I should correct that to, waking from WFI) state.
> > > >
> > > I'd say that's very platform specific, and as such playing with the delay makes
> > > little sense. I'd need to do more deliberate testing, but I haven't noticed
> > > (yet) any discrepancies in AMU counters on waking up.
> > > Aside, you have mentioned that you've observed the frequency reported to be
> > > above max one (4GHz vs 3.5HZ if I recall correctly) - shouldn't that be clamped
> > > by the driver if the values are outside of supported range ?
> > >
> > > Verifying whether the CPU is idle before poking it just to get a counters
> > > reading to derive current frequency from those does feel rather like an
> > > appealing idea.
> >
> > That's good to hear. What can we do to refine this series further?
So I believe this should be handled in CPUFreq core, if at all.
Would be good to get an input/opinion from the maintainers: Viresh and Rafael.
> >
> > > Narrowing the scope for ACPI_ADR_SPACE_FIXED_HARDWARE cases
> > > could be solved by providing a query for the address space. Though I am not an
> > > expert here so would be good to get some input from someone who is
> > > (on both).
> >
> > Who would be the expert here (are they on this mailing list)?
Probably as above + Sudeep Holla
> >
> > Could you point me to an example for the query for the address space? Then
> > I can respin this series to use that query and narrow the scope.
>
Actually was suggesting adding one.
> Actually, if the idea of this optimization (the idle_cpu check) sounds
> good to you,
> I don't see why we should limit it to ACPI_ADR_SPACE_FIXED_HARDWARE.
> IOW, the patch can remain in its current form.
>
Right, that does need though verifying against all users.
In the meantime ....
It seems that the issue of getting counters on a CPU that is idle is not
in the counters themselves, but in the way how they are being read - at least
from what I can observe.
The first read experience longer delay between reading core and const counters,
and as const one is read as a second one, it misses some increments (within
calculated delta). So, what we could do within the driver is either:
- Add a way to request reading both counters in a single cpc_read (preferable
I guess, though I would have to have a closer look at that)
- Add some logic that would make sure the reads are not far apart
Would you be able to verify that on your end?
---
BR
Beata
> Best regards,
>
> --
> -Prashant
next prev parent reply other threads:[~2025-07-14 9:31 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 0:09 [PATCH v2 0/2] cpufreq: CPPC: idle cpu perf handling Prashant Malani
2025-06-19 0:09 ` [PATCH v2 1/2] sched: Expose idle_cpu() to modules Prashant Malani
2025-06-19 0:09 ` [PATCH v2 2/2] cpufreq: CPPC: Dont read counters for idle CPUs Prashant Malani
2025-06-20 3:53 ` Jie Zhan
2025-06-20 5:07 ` Prashant Malani
2025-06-26 18:42 ` Prashant Malani
2025-06-27 7:54 ` Jie Zhan
2025-06-27 17:07 ` Prashant Malani
2025-07-02 18:38 ` Prashant Malani
2025-07-03 9:29 ` Beata Michalska
2025-07-07 8:32 ` Beata Michalska
2025-07-09 17:25 ` Prashant Malani
2025-07-09 22:49 ` Prashant Malani
2025-07-14 9:30 ` Beata Michalska [this message]
2025-07-15 6:28 ` Prashant Malani
2025-07-21 17:00 ` Rafael J. Wysocki
2025-07-21 19:40 ` Prashant Malani
2025-07-22 3:27 ` Viresh Kumar
2025-07-22 6:02 ` Prashant Malani
2025-07-30 7:31 ` Prashant Malani
2025-07-31 8:27 ` Beata Michalska
2025-07-31 11:13 ` Viresh Kumar
2025-07-31 20:23 ` Beata Michalska
2025-08-01 4:43 ` Viresh Kumar
2025-08-07 0:19 ` Prashant Malani
2025-08-11 6:05 ` Viresh Kumar
2025-08-11 18:43 ` Prashant Malani
2025-08-11 19:19 ` Rafael J. Wysocki
2025-08-11 20:01 ` Prashant Malani
2025-08-14 11:48 ` Rafael J. Wysocki
2025-08-15 5:12 ` Prashant Malani
2025-08-16 8:25 ` Prashant Malani
2025-08-13 10:12 ` Beata Michalska
2025-07-31 16:51 ` Prashant Malani
2025-07-31 20:30 ` Beata Michalska
2025-08-01 9:16 ` Prashant Malani
2025-08-04 20:55 ` Prashant Malani
2025-08-06 7:21 ` Beata Michalska
2025-08-07 0:01 ` Prashant Malani
2025-08-07 10:24 ` Beata Michalska
2025-08-08 2:14 ` Prashant Malani
2025-08-13 10:15 ` Beata Michalska
2025-08-13 22:25 ` Prashant Malani
2025-07-07 8:35 ` Beata Michalska
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=aHTOSyhwIAaW_1m1@arm.com \
--to=beata.michalska@arm.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=ionela.voinescu@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pmalani@google.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=vschneid@redhat.com \
--cc=zhanjie9@hisilicon.com \
--cc=zhenglifeng1@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.