mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	Marco Scardovi <scardracs@disroot.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	<perry.yuan@amd.com>, <rafael@kernel.org>, <ray.huang@amd.com>,
	<stuartmeckle@gmail.com>, <viresh.kumar@linaro.org>,
	<wyes.karny@amd.com>
Subject: Re: [PATCH v2 1/2] cpufreq/amd-pstate: Fix EPP initialization for shared memory systems
Date: Thu, 4 Jun 2026 09:26:20 +0530	[thread overview]
Message-ID: <b4e23498-492a-40b2-8517-6d44eaec8502@amd.com> (raw)
In-Reply-To: <2e3a5f9a-69fe-4790-8b8b-2d1622977a2f@amd.com>

Hello Mario,

On 6/4/2026 12:23 AM, Mario Limonciello wrote:
>> --- a/drivers/cpufreq/amd-pstate.h
>> +++ b/drivers/cpufreq/amd-pstate.h
>> @@ -128,6 +128,8 @@ struct amd_cpudata {
>>       u8    epp_default_dc;
>>       bool    dynamic_epp;
>>       bool    raw_epp;
>> +    /* Indicates that EPP has been successfully programmed at least once since boot. */
>> +    bool    epp_hw_programmed;
>>       struct notifier_block power_nb;
>>         /* platform profile */
> 
> I'm having a hard time following why this is needed.  Let me explain my chain of thought.
> 
> We start at amd_pstate_epp_cpu_init().
> * cpudata (and thus cppc_req_cached) is initalized to 0 via kzalloc()
>    - On a server we initialize "epp_default" via a lookup to the HW (amd_pstate_get_epp).
>    - On a non-server we initialize "epp_default" to 0x80.
> * we call amd_pstate_set_epp() with epp_deafult as the argument.
> 
> Now in the shared mem backend (shmem_set_epp) we do a lookup of epp_cached and it should be 0.  We do a comparison of the argument sent to the function, and this should be 0x80.
> 
> So how do we get into a case that amd_pstate_set_epp() is actually called with 0?

This was the path I traced yesterday considering amd_dynamic_epp enabled for
a shared memory system that is plugged into the wall:

  amd_pstate_epp_cpu_init()
    cpudata->epp_default_ac = AMD_CPPC_EPP_PERFORMANCE;
    cpudata->epp_default_dc = AMD_CPPC_EPP_BALANCE_PERFORMANCE;
    cpudata->current_profile = PLATFORM_PROFILE_BALANCED;

    /* cpudata->cppc_req_cached has epp_cached as 0 */

    amd_pstate_set_dynamic_epp(policy)
      epp = amd_pstate_get_balanced_epp(policy); /* returns cpudata->epp_default_ac which is EPP_PERFORMANCE */

      amd_pstate_set_epp(policy, epp /* AMD_CPPC_EPP_PERFORMANCE */)
        if (epp == epp_cached)
          return;

        /*
         * Skips cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1)
         * where the last argument "enable" enables EPP via the
         * AUTO_SEL_ENABLE path.
         */

> 
> There are some trace points specifically for this purpose - you could confirm there really is such a call by using them at bootup (or by starting in passive and with a mode change to active at runtime).

It should show up in the traces yes!

> 
> Then we call amd_pstate_set_epp() with that epp_default value.

I think this patch has some merit, although the second patch, I'm not
too sure of. After some digging, it seems we always had AUTO_SEL_ENABLE
and ENERGY_PERF right from the time CPPC was introduced (including Zen1
systems that had CPPC support).

Marco, do you have actually have a system that neither has
AUTO_SEL_ENABLE, nor ENERGY_PERF? Seems very unlikely a configuration
like that made it out.

-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2026-06-04  3:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  8:19 [PATCH 0/1] cpufreq/amd-pstate: Prevent active mode on systems without EPP support Marco Scardovi
2026-06-03  8:19 ` [PATCH 1/1] " Marco Scardovi
2026-06-03  9:39 ` [PATCH 0/1] " K Prateek Nayak
2026-06-03 11:56   ` [PATCH v2 0/2] cpufreq/amd-pstate: Fix EPP initialization and add capability check Marco Scardovi
2026-06-03 11:56     ` [PATCH v2 1/2] cpufreq/amd-pstate: Fix EPP initialization for shared memory systems Marco Scardovi
2026-06-03 18:53       ` Mario Limonciello
2026-06-04  3:56         ` K Prateek Nayak [this message]
2026-06-04  6:56           ` Marco Scardovi
2026-06-04 18:43             ` Mario Limonciello
2026-06-05  3:41               ` K Prateek Nayak
2026-06-03 11:56     ` [PATCH v2 2/2] cpufreq/amd-pstate: Prevent active mode on systems without EPP support Marco Scardovi
2026-06-03 18:08     ` [PATCH v2 0/2] cpufreq/amd-pstate: Fix EPP initialization and add capability check Mario Limonciello

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=b4e23498-492a-40b2-8517-6d44eaec8502@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=perry.yuan@amd.com \
    --cc=rafael@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=scardracs@disroot.org \
    --cc=stuartmeckle@gmail.com \
    --cc=viresh.kumar@linaro.org \
    --cc=wyes.karny@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome