RE: [PATCH V8 3/7] cpufreq: amd-pstate: Enable amd-pstate preferred core supporting.

From: Meng, Li (Jassmine)
Date: Tue Oct 10 2023 - 21:02:10 EST


[AMD Official Use Only - General]

Hi Peter:

> -----Original Message-----
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Sent: Tuesday, October 10, 2023 6:36 PM
> To: Meng, Li (Jassmine) <Li.Meng@xxxxxxx>
> Cc: Rafael J . Wysocki <rafael.j.wysocki@xxxxxxxxx>; Huang, Ray
> <Ray.Huang@xxxxxxx>; linux-pm@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; x86@xxxxxxxxxx; linux-acpi@xxxxxxxxxxxxxxx; Shuah
> Khan <skhan@xxxxxxxxxxxxxxxxxxx>; linux-kselftest@xxxxxxxxxxxxxxx;
> Fontenot, Nathan <Nathan.Fontenot@xxxxxxx>; Sharma, Deepak
> <Deepak.Sharma@xxxxxxx>; Deucher, Alexander
> <Alexander.Deucher@xxxxxxx>; Limonciello, Mario
> <Mario.Limonciello@xxxxxxx>; Huang, Shimmer
> <Shimmer.Huang@xxxxxxx>; Yuan, Perry <Perry.Yuan@xxxxxxx>; Du,
> Xiaojian <Xiaojian.Du@xxxxxxx>; Viresh Kumar <viresh.kumar@xxxxxxxxxx>;
> Borislav Petkov <bp@xxxxxxxxx>
> Subject: Re: [PATCH V8 3/7] cpufreq: amd-pstate: Enable amd-pstate
> preferred core supporting.
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> On Mon, Oct 09, 2023 at 10:49:28AM +0800, Meng Li wrote:
>
> > +static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) {
> > + int ret;
> > + u32 highest_perf;
> > + static u32 max_highest_perf = 0, min_highest_perf = U32_MAX;
> > +
> > + ret = amd_pstate_get_highest_perf(cpudata->cpu, &highest_perf);
> > + if (ret)
> > + return;
> > +
> > + cpudata->hw_prefcore = true;
> > + /* check if CPPC preferred core feature is enabled*/
> > + if (highest_perf == AMD_PSTATE_MAX_CPPC_PERF) {
> > + pr_debug("AMD CPPC preferred core is unsupported!\n");
> > + cpudata->hw_prefcore = false;
> > + return;
> > + }
> > +
> > + if (!amd_pstate_prefcore)
> > + return;
> > +
> > + /*
> > + * The priorities can be set regardless of whether or not
> > + * sched_set_itmt_support(true) has been called and it is valid to
> > + * update them at any time after it has been called.
> > + */
> > + sched_set_itmt_core_prio(highest_perf, cpudata->cpu);
>
> You still got the whole u32 vs int thing confused, I've only pointed that out
> *TWICE* before.
>
> Boris, can you pull out the clue hammer please?
>
[Meng, Li (Jassmine)]
I feel very sorry, I will immediately double check and correct all modified data type.
Thanks a lot.

> > +
> > + if (max_highest_perf <= min_highest_perf) {
> > + if (highest_perf > max_highest_perf)
> > + max_highest_perf = highest_perf;
> > +
> > + if (highest_perf < min_highest_perf)
> > + min_highest_perf = highest_perf;
> > +
> > + if (max_highest_perf > min_highest_perf) {
> > + /*
> > + * This code can be run during CPU online under the
> > + * CPU hotplug locks, so sched_set_itmt_support()
> > + * cannot be called from here. Queue up a work item
> > + * to invoke it.
> > + */
> > + schedule_work(&sched_prefcore_work);
> > + }
> > + }
> > +}