From: Sean Christopherson <seanjc@google.com>
To: "Mi, Dapeng1" <dapeng1.mi@intel.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"zhenyuw@linux.intel.com" <zhenyuw@linux.intel.com>
Subject: Re: [PATCH] KVM: x86: disable halt polling when powersave governor is used
Date: Tue, 25 Oct 2022 17:06:57 +0000 [thread overview]
Message-ID: <Y1gXseyl0f3IUnDh@google.com> (raw)
In-Reply-To: <PH0PR11MB48240C29F1DEBC79EA933285CD5E9@PH0PR11MB4824.namprd11.prod.outlook.com>
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);
}
next prev parent reply other threads:[~2022-10-25 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 7:31 [PATCH] KVM: x86: disable halt polling when powersave governor is used Dapeng Mi
2022-10-07 17:51 ` Sean Christopherson
2022-10-08 9:40 ` Mi, Dapeng1
2022-10-25 17:06 ` Sean Christopherson [this message]
2022-11-15 6:25 ` Mi, Dapeng1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y1gXseyl0f3IUnDh@google.com \
--to=seanjc@google.com \
--cc=dapeng1.mi@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=zhenyuw@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).