lkml.org 
[lkml]   [2022]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KVM: x86: disable halt polling when powersave governor is used
On Sat, Oct 08, 2022, Mi, Dapeng1 wrote:
> > > + !strncmp(policy->governor->name,
> > "powersave",
> >
> > KVM should not be comparing magic strings. If the cpufreq subsystem can't get
> > policy->policy right, then that needs to be fixed.
>
> Yeah, using magic strings looks a little bit strange, but this is what is
> cpufreq doing. Currently cpufreq mechanism supports two kinds of drivers,
> one is the driver which has the built-in governor, like intel_pstate driver.
> For this kind of driver, the cpufreq governor is saved in the policy->policy
> field. The other is the traditional driver which is independent with cpufreq
> governor and the cpufreq governor type is saved in the governor->name field.
> For the second kind of cpufreq driver, the policy->policy field is
> meaningless and we have to read the governor name.

That doesn't mean it's ok to bleed those internal details into KVM. I would much
rather cpufreq provide a helper to get the effective policy, e.g.

unsigned int cpufreq_cpu_get_policy(unsigned int cpu)
{
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
unsigned int pol;

if (!policy)
return CPUFREQ_POLICY_UNKNOWN;

pol = policy->policy
if (pol == CPUFREQ_POLICY_UNKNOWN && policy->governor)
pol = cpufreq_parse_policy(policy->governor->name);

cpufreq_cpu_put(policy);
}

\
 
 \ /
  Last update: 2022-10-25 19:08    [W:0.057 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site