Re: [PATCH v3 5/5] x86/amd: Use heterogeneous core topology for identifying boost numerator

From: Borislav Petkov
Date: Fri Oct 25 2024 - 09:51:41 EST


On Wed, Oct 23, 2024 at 12:43:57PM -0500, Mario Limonciello wrote:
> int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator)
> {
> + enum x86_topology_cpu_type core_type = get_topology_generic_cpu_type(&cpu_data(cpu));
> bool prefcore;
> int ret;
> + u32 tmp;
>
> ret = amd_detect_prefcore(&prefcore);
> if (ret)
> @@ -261,6 +263,27 @@ int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator)
> break;
> }
> }
> +

What's the difference between this case:

> + /* detect if running on heterogeneous design */
> + switch (core_type) {
> + case TOPO_CPU_TYPE_UNKNOWN:
^^^^^^^^^^^^^^^^^^^^^^^

> + break;
> + case TOPO_CPU_TYPE_PERFORMANCE:
> + /* use the max scale for performance cores */
> + *numerator = CPPC_HIGHEST_PERF_PERFORMANCE;
> + return 0;
> + case TOPO_CPU_TYPE_EFFICIENCY:
> + /* use the highest perf value for efficiency cores */
> + ret = amd_get_highest_perf(cpu, &tmp);
> + if (ret)
> + return ret;
> + *numerator = tmp;
> + return 0;
> + default:

... and this case and why aren't you warning if TOPO_CPU_TYPE_UNKNOWN?

I think for that you need to check X86_FEATURE_AMD_HETEROGENEOUS_CORES and
warn if set but still CPU type unknown or?

> + pr_warn("WARNING: Undefined core type %d found\n", core_type);
> + break;
> + }

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette