From: Jacob Shin Subject: Re: [PATCH 2/2] cpufreq: fix turbo mode state reporting Date: Thu, 20 Jun 2013 10:26:14 -0500 Message-ID: <20130620152614.GA7239@jshin-Toonie> References: <1371672887-1774-1-git-send-email-jacob.shin@amd.com> <1371672887-1774-2-git-send-email-jacob.shin@amd.com> <51C2D2F202000078000DF3FD@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <51C2D2F202000078000DF3FD@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Liu Jinsong , Suravee Suthikulanit , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, Jun 20, 2013 at 09:01:22AM +0100, Jan Beulich wrote: > >>> On 19.06.13 at 22:14, Jacob Shin wrote: > > Currently we report back 0 or 1, which is broken since xenpm expects > > CPUFREQ_TURBO_DISABLED, CPUFREQ_TURBO_UNSUPPORTED, or > > CPUFREQ_TURBO_ENABLED. Report back actual policy->turbo value instead. > > I think that it's xenpm that's wrong here - the three constants above > aren't exposed in public headers, and hence aren't part of the ABI. > Furthermore the structure member name that the result of this > function gets stored into is "turbo_enabled", which also suggests a > boolean value to me. I.e. if we want to change the value set that > the hypervisor may return here, the field should also get renamed, > and the value set exposed. Okay I'll fix xenpm instead. > > > --- a/xen/drivers/cpufreq/utility.c > > +++ b/xen/drivers/cpufreq/utility.c > > @@ -428,7 +428,10 @@ int cpufreq_get_turbo_status(int cpuid) > > struct cpufreq_policy *policy; > > > > policy = per_cpu(cpufreq_cpu_policy, cpuid); > > - return policy && policy->turbo; > > + if (!policy) > > + return CPUFREQ_TURBO_UNSUPPORTED; > > + > > + return policy->turbo; > > Nevertheless this would need adjustment even for the boolean > value case: > > - return policy && policy->turbo; > + return policy && policy->turbo == CPUFREQ_TURBO_ENABLED; Yup that's correct. Thanks,