From: "Jan Beulich" Subject: Re: [PATCH v2 8/9] x86/intel_pstate: support the use of intel_pstate in pmstat.c Date: Thu, 04 Jun 2015 20:21:40 +0100 Message-ID: <5570B35402000078000D0EB0@mail.emea.novell.com> References: <1463125889-14458-1-git-send-email-wei.w.wang@intel.com> <55649C23020000780007DF47@mail.emea.novell.com> <286AC319A985734F985F78AFA26841F797AC48@shsmsx102.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <286AC319A985734F985F78AFA26841F797AC48@shsmsx102.ccr.corp.intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: wei.w.wang@intel.com Cc: jinsong.liu@alibaba-inc.com, xen-devel@lists.xen.org, wei.liu2@citrix.com, ian.campbell@citrix.com, andrew.cooper3@citrix.com List-Id: xen-devel@lists.xenproject.org >>> "Wang, Wei W" 06/04/15 4:21 AM >>> >On 26/05/2015 22:16, Jan Beulich wrote >> >>> On 13.05.16 at 09:51, wrote: >> > --- a/xen/drivers/acpi/pmstat.c >> > +++ b/xen/drivers/acpi/pmstat.c >> > @@ -261,29 +272,47 @@ static int get_cpufreq_para(struct >> xen_sysctl_pm_op *op) >> > op->u.get_para.cpuinfo_max_freq = policy->cpuinfo.max_freq; >> > op->u.get_para.cpuinfo_min_freq = policy->cpuinfo.min_freq; >> > op->u.get_para.scaling_cur_freq = policy->cur; >> > - op->u.get_para.scaling_max_freq = policy->max; >> > - op->u.get_para.scaling_min_freq = policy->min; >> > + if (policy->policy) { >> > + op->u.get_para.scaling_max.max_perf_pct = policy->max_perf_pct; >> > + op->u.get_para.scaling_min.min_perf_pct = policy->min_perf_pct; >> > + op->u.get_para.scaling_turbo_pct = policy->turbo_pct; >> > + } else { >> > + op->u.get_para.scaling_max.max_freq = policy->max; >> > + op->u.get_para.scaling_min.min_freq = policy->min; >> > + } >> >> How does the caller then know which of the union member meanings >> apply? > >The end caller is xenpm. It's aware of the running pstate driver, so it knows > the difference between freq and pct. xenpm is one of the possible callers. We don't make hypercalls with just a single consumer in mind, excluding any other potential one(s). And hence a hypercall like this should be kind of self contained, i.e. in the case here the caller ought to be able to know from its result which of the union fields are in use. Jan