From: David Vernet <void@manifault.com>
To: Mario Limonciello <mario.limonciello@amd.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
"André Almeida" <andrealmeid@igalia.com>,
"Changwoo Min" <changwoo@igalia.com>
Subject: Re: [RFC PATCH 3/4] cpufreq/amd-pstate: Add per-core EPP boost for recently-busy CPUs
Date: Thu, 30 Jul 2026 03:01:02 -0500 [thread overview]
Message-ID: <amsCcmMflwkjTpCX@maniforge> (raw)
In-Reply-To: <0a8a28c6-8af1-4a6e-82d8-166356455aa9@amd.com>
[-- Attachment #1: Type: text/plain, Size: 4629 bytes --]
On Tue, Jul 28, 2026 at 04:02:34PM -0500, Mario Limonciello wrote:
Hi Mario,
Thanks for reviewing this!
> On 7/28/26 02:31, David Vernet wrote:
> > In active (EPP) mode the platform autonomously picks the operating point
> > between min_perf and max_perf, biased by the EPP hint, and the kernel
> > only rewrites the CPPC request on policy/limit changes. A workload
> > dominated by one mostly-busy thread that takes frequent short sleeps
> > (e.g. a game render thread blocking on a futex waiting for the GPU or a
> > worker thread on every frame) can defeat the platform's utilization
> > tracking. Each sleep decays the hardware's performance signal, so
> > post-wakeup bursts start at a low operating point and the frame-time
> > tail inflates even though the CPU is ~100% busy during the frame itself.
> >
> > This is a common problem in gaming workloads, and is not easy to solve
> > at the cpufreq layer. We have to toe the line between running at a high
> > voltage unnecessarily and draining battery (and potentially contending
> > with e.g. the GPU for power draw), and lowering frequency on the core
> > that's running the game's main and/or render threads (thus materially
> > increasing frame latency and causing a tail increase in stale frames).
>
> I have to question - is this really a good use for active mode? You're
> basically fighting with the hardware and trying to game the behavior.
>
> I wonder if for gaming it would be better to enact guided mode and then let
> userspace limit the range that it can act within.
Yeah I think this is a reasonable callout. This is being discussed in
some of the other threads, so I'll defer to those so we can keep the
discussions in one place.
[...]
> > The mechanism works as follows: When the epp_boost module parameter is
> > enabled, an update-util hook samples each core's C0 residency (delta
> > MPERF over delta TSC) at most once every 10 ms. If a sample shows the
> > core at least 50% busy, the EPP field of its MSR_AMD_CPPC_REQ is set to
> > performance (0) and held there until 300 ms pass without another busy
> > sample. The hook then writes back the request that policy management
> > last stored in cppc_req_cached. Both writes happen only on the busy and
> > idle edges, so the CPPC_REQ write rate matches that of a global
> > EPP=performance setting. min, max and desired perf are never touched.
> > This mirrors intel_pstate's hwp_boost, except that hwp_boost triggers on
> > SCHED_CPUFREQ_IOWAIT, which the waits at issue here (futex waits and
> > amdgpu fence waits) do not set, so a residency trigger is used instead.
>
> I understand using epp_boost in the context of a module parameter to easily
> activate this behavior, but I don't think that's the right way that it
> should be triggered because it's going to end up effective for the entire
> boot even when you're not running games that you want to use this.
>
> I'd think a sysfs knob would be better to activate it if it's going to be
> dynamic
Ack that makes sense, I'll use a sysfs knob in the next version.
> But also - dynamic_epp isn't the default behavior. What if you
> only activate this when dynamic_epp is set? IE when using dynamic EPP you
> use platform power profile, power charger, and this running algorithm.
Sure, that might be an option. I'm planning to rebase onto Prateek's
patch set this weekend to test this out, so let's see how that looks and
then we can evaluate further.
[...]
> > +static void amd_pstate_epp_boost_update_util(struct update_util_data *data,
> > + u64 time, unsigned int flags)
> > +{
> > + struct amd_cpudata *cpudata = container_of(data, struct amd_cpudata,
> > + epp_boost_update_util);
> > + union perf_cached perf;
> > + bool first_sample;
> > + u64 busy_pct;
> > + bool active;
> > +
> > + if (smp_processor_id() != cpudata->cpu)
> > + return;
> > +
> > + first_sample = !cpudata->epp_boost_last_sample;
> > + if (!first_sample &&
> > + time - cpudata->epp_boost_last_sample < AMD_PSTATE_EPP_BOOST_SAMPLE_NS)
> > + return;
> > + cpudata->epp_boost_last_sample = time;
> > +
> > + /*
> > + * Counters can reset across suspend or hotplug (so their values would
> > + * be garbage), so just recalculate baselines.
> > + */
>
> This comment confused me. I at first thought you weren't doing it, but you
> are. Basically on resume you treat it as a fresh startup. I would just
> drop this comment.
Yep, in hindsight I agree this is confusing. I'll drop it from the next
version.
Thanks,
David
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-07-30 8:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 7:31 [RFC PATCH 0/4] cpufreq/amd-pstate: Per-core EPP boost for recently-busy CPUs David Vernet
2026-07-28 7:31 ` [RFC PATCH 1/4] cpufreq/amd-pstate: Document missing kernel-doc members David Vernet
2026-07-28 15:06 ` Mario Limonciello
2026-07-28 7:31 ` [RFC PATCH 2/4] cpufreq/amd-pstate: Update cppc_req_cached before writing the MSR David Vernet
2026-07-28 7:31 ` [RFC PATCH 3/4] cpufreq/amd-pstate: Add per-core EPP boost for recently-busy CPUs David Vernet
2026-07-28 21:02 ` Mario Limonciello
2026-07-30 8:01 ` David Vernet [this message]
2026-07-28 7:31 ` [RFC PATCH 4/4] Documentation: amd-pstate: Document the epp_boost parameter David Vernet
2026-07-28 7:36 ` [RFC PATCH 0/4] cpufreq/amd-pstate: Per-core EPP boost for recently-busy CPUs David Vernet
2026-07-28 14:17 ` Christian Loehle
2026-07-28 19:43 ` Mario Limonciello
2026-07-29 3:12 ` K Prateek Nayak
2026-07-30 7:22 ` David Vernet
2026-07-30 9:36 ` Christian Loehle
2026-07-30 7:49 ` David Vernet
2026-07-30 5:57 ` David Vernet
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=amsCcmMflwkjTpCX@maniforge \
--to=void@manifault.com \
--cc=andrealmeid@igalia.com \
--cc=changwoo@igalia.com \
--cc=gautham.shenoy@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--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