Re: [PATCH V1 2/6] cpufreq: amd-pstate: Enable AMD Pstate Preferred Core Supporting.
From: Peter Zijlstra
Date: Tue Aug 08 2023 - 13:30:30 EST
On Tue, Aug 08, 2023 at 04:09:57PM +0800, Meng Li wrote:
> +static int amd_pstate_get_highest_perf(int cpu, u64 *highest_perf)
> +{
> + int ret;
> +
> + if (boot_cpu_has(X86_FEATURE_CPPC)) {
> + u64 cap1;
> +
> + ret = rdmsrl_safe_on_cpu(cpu, MSR_AMD_CPPC_CAP1, &cap1);
> + if (ret)
> + return ret;
> + WRITE_ONCE(*highest_perf, AMD_CPPC_HIGHEST_PERF(cap1));
> + } else {
> + ret = cppc_get_highest_perf(cpu, highest_perf);
> + }
> +
> + return (ret);
> +}
> +
> +static void amd_pstate_init_prefcore(void)
> +{
> + int cpu, ret;
> + u64 highest_perf;
> +
> + if (no_prefcore)
> + return;
> +
> + for_each_possible_cpu(cpu) {
> + ret = amd_pstate_get_highest_perf(cpu, &highest_perf);
> + if (ret)
> + break;
So what is the intended behaviour when online != possible ?
> + sched_set_itmt_core_prio(highest_perf, cpu);
> + }
> +
> + /*
> + * This code can be run during CPU online under the
> + * CPU hotplug locks, so sched_set_amd_prefcore_support()
> + * cannot be called from here. Queue up a work item
> + * to invoke it.
> + */
> + schedule_work(&sched_prefcore_work);
> +}