mbox series

[v3,00/11] Adjustments for preferred core detection

Message ID 20240905163007.1350840-1-superm1@kernel.org (mailing list archive)
Headers show
Series Adjustments for preferred core detection | expand

Message

Mario Limonciello Sept. 5, 2024, 4:29 p.m. UTC
From: Mario Limonciello <mario.limonciello@amd.com>

Preferred core detection is fragile in that any CPU that reports
less than 255 for any core is assumed to be a preferred core design.
This might not always be true, so it's better to check all CPUs and
see that varying values are actually reported.

Furthermore, preferred core detection isn't used by acpi-cpufreq. So
incorrect frequencies are used unless amd-pstate is active.

This series moves preferred core detection out of amd-pstate in a more
robust fashion.  It also removes some tech debt of hardcoded values for
platforms that are actually preferred core platforms.

This branch is based off v6.11-rc6.

v2->v3:
 * Pick up tags
 * Fix LKP reported issue
Mario Limonciello (11):
  x86/amd: Move amd_get_highest_perf() from amd.c to cppc.c
  ACPI: CPPC: Adjust return code for inline functions in
    !CONFIG_ACPI_CPPC_LIB
  x86/amd: Rename amd_get_highest_perf() to
    amd_get_boost_ratio_numerator()
  ACPI: CPPC: Drop check for non zero perf ratio
  ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn
  x86/amd: Move amd_get_highest_perf() out of amd-pstate
  x86/amd: Detect preferred cores in amd_get_boost_ratio_numerator()
  cpufreq: amd-pstate: Merge amd_pstate_highest_perf_set() into
    amd_get_boost_ratio_numerator()
  cpufreq: amd-pstate: Optimize amd_pstate_update_limits()
  cpufreq: amd-pstate: Add documentation for `amd_pstate_hw_prefcore`
  amd-pstate: Add missing documentation for
    `amd_pstate_prefcore_ranking`

 Documentation/admin-guide/pm/amd-pstate.rst |  15 +-
 arch/x86/include/asm/processor.h            |   3 -
 arch/x86/kernel/acpi/cppc.c                 | 172 ++++++++++++++++++--
 arch/x86/kernel/cpu/amd.c                   |  16 --
 drivers/cpufreq/acpi-cpufreq.c              |  12 +-
 drivers/cpufreq/amd-pstate.c                | 128 ++++-----------
 include/acpi/cppc_acpi.h                    |  41 +++--
 7 files changed, 241 insertions(+), 146 deletions(-)

Comments

Ivan Shapovalov Oct. 16, 2024, 10:03 p.m. UTC | #1
Hi,

On my desktop Zen 3 (Vermeer) system applying this series yields a new
warning message on each boot:

> Oct 16 06:20:41 kernel: Could not retrieve highest performance (-19)

As I see it, this is one of the pr_debug()s newly promoted to warnings.
Is there anything I can provide to help fix this?

Just for completeness:

```
$ cat-files /sys/devices/system/cpu/cpufreq/policy0/*
/sys/devices/system/cpu/cpufreq/policy0/affected_cpus                             0
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf                   231
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_hw_prefcore                    enabled
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_lowest_nonlinear_freq          1746000
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_max_freq                       5274000
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_prefcore_ranking               231
/sys/devices/system/cpu/cpufreq/policy0/boost                                     1
/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq                          5274000
/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_min_freq                          550000
/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_transition_latency                0
/sys/devices/system/cpu/cpufreq/policy0/energy_performance_available_preferences  default performance balance_performance balance_power power
/sys/devices/system/cpu/cpufreq/policy0/energy_performance_preference             balance_performance
/sys/devices/system/cpu/cpufreq/policy0/related_cpus                              0
/sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors               performance powersave
/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq                          1746000
/sys/devices/system/cpu/cpufreq/policy0/scaling_driver                            amd-pstate-epp
/sys/devices/system/cpu/cpufreq/policy0/scaling_governor                          powersave
/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq                          5274000
/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq                          1746000
/sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed                          <unsupported>

$ grep -w cppc /proc/cpuinfo
<empty>
```

Thanks,
Mario Limonciello Oct. 16, 2024, 10:06 p.m. UTC | #2
On 10/16/2024 17:03, Ivan Shapovalov wrote:
> Hi,
> 
> On my desktop Zen 3 (Vermeer) system applying this series yields a new
> warning message on each boot:
> 
>> Oct 16 06:20:41 kernel: Could not retrieve highest performance (-19)
> 
> As I see it, this is one of the pr_debug()s newly promoted to warnings.
> Is there anything I can provide to help fix this?
> 

Open up a kernel Bugzilla and attach a full dmesg and all details.  You 
can CC me directly to it and I'll look into it.

Also ideally; can you please check 6.12-rc3.

> Just for completeness:
> 
> ```
> $ cat-files /sys/devices/system/cpu/cpufreq/policy0/*
> /sys/devices/system/cpu/cpufreq/policy0/affected_cpus                             0
> /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf                   231
> /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_hw_prefcore                    enabled
> /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_lowest_nonlinear_freq          1746000
> /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_max_freq                       5274000
> /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_prefcore_ranking               231
> /sys/devices/system/cpu/cpufreq/policy0/boost                                     1
> /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq                          5274000
> /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_min_freq                          550000
> /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_transition_latency                0
> /sys/devices/system/cpu/cpufreq/policy0/energy_performance_available_preferences  default performance balance_performance balance_power power
> /sys/devices/system/cpu/cpufreq/policy0/energy_performance_preference             balance_performance
> /sys/devices/system/cpu/cpufreq/policy0/related_cpus                              0
> /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors               performance powersave
> /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq                          1746000
> /sys/devices/system/cpu/cpufreq/policy0/scaling_driver                            amd-pstate-epp
> /sys/devices/system/cpu/cpufreq/policy0/scaling_governor                          powersave
> /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq                          5274000
> /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq                          1746000
> /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed                          <unsupported>
> 
> $ grep -w cppc /proc/cpuinfo
> <empty>
> ```
> 
> Thanks,
Ivan Shapovalov Oct. 16, 2024, 10:19 p.m. UTC | #3
On 2024-10-16 at 17:06 -0500, Mario Limonciello wrote:
> On 10/16/2024 17:03, Ivan Shapovalov wrote:
> > Hi,
> > 
> > On my desktop Zen 3 (Vermeer) system applying this series yields a new
> > warning message on each boot:
> > 
> > > Oct 16 06:20:41 kernel: Could not retrieve highest performance (-19)
> > 
> > As I see it, this is one of the pr_debug()s newly promoted to warnings.
> > Is there anything I can provide to help fix this?
> > 
> 
> Open up a kernel Bugzilla and attach a full dmesg and all details.  You 
> can CC me directly to it and I'll look into it.
> 
> Also ideally; can you please check 6.12-rc3.
> 

Alright, I'll do that once I build and test the -rc.

Besides dmesg+config+cpuinfo, are there any other details that you
would like to see there?

Thanks,
>
Mario Limonciello Oct. 17, 2024, 12:18 a.m. UTC | #4
On 10/16/24 17:19, Ivan Shapovalov wrote:
> On 2024-10-16 at 17:06 -0500, Mario Limonciello wrote:
>> On 10/16/2024 17:03, Ivan Shapovalov wrote:
>>> Hi,
>>>
>>> On my desktop Zen 3 (Vermeer) system applying this series yields a new
>>> warning message on each boot:
>>>
>>>> Oct 16 06:20:41 kernel: Could not retrieve highest performance (-19)
>>>
>>> As I see it, this is one of the pr_debug()s newly promoted to warnings.
>>> Is there anything I can provide to help fix this?
>>>
>>
>> Open up a kernel Bugzilla and attach a full dmesg and all details.  You
>> can CC me directly to it and I'll look into it.
>>
>> Also ideally; can you please check 6.12-rc3.
>>
> 
> Alright, I'll do that once I build and test the -rc.
> 
> Besides dmesg+config+cpuinfo, are there any other details that you
> would like to see there?
> 
> Thanks,
>>

That's fine for now.  Depending on what we find we might want to look at 
an acpidump too.