Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1272848
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Viresh Kumar <viresh.kumar@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] cpufreq, intel_pstate.c, Fix rounding errors |
| Date | Thu, 19 Nov 2015 05:50:01 +0100 |
| Message-ID | <qwpkt-4yB-7@gated-at.bofh.it> (permalink) |
| References | <qwdjl-4US-33@gated-at.bofh.it> |
| X-Original-To | Prarit Bhargava <prarit@redhat.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Iaaod61acnSw3VIYcsgksOhyynteK4hklN2RECdVhP8=; b=XGJw42FtHQ5s1cEhMVikyqSb5LZWqi1NFj3X+kebNl7ScaLgNAix4/h2ALhxHUmqW8 70r4p+271agLtoxWX+a8h26APS7b1Z+RcS6pHZAqcepqQ08N6sg1Lo4N5LcAmOSyUO3l HJ+ePoj1jAsF7PL41rSzP+cLZceLlaewiOOKh+vxcHgnA7zPTZTG9LaUt6T+nFl1WU4X k8U8qHDVueIAvg0QIEteZZPpeHViRZX/6/mhy66mVnhtt0pKFoScXejHsGpjMVNNRAUB cwIwlJvKWQVocImAsoUsgEMQy0xarCviWVfEDy12h99g9ZUIXRlilk2WgwNeJ7ZP3/mf NB8A== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=Iaaod61acnSw3VIYcsgksOhyynteK4hklN2RECdVhP8=; b=WnImUbXBa9Qw3U8m2qdRjgRAcR9ifZwBlVeYq4KFIl2R9d0Itf8YuRrRHGmYn1XxIf hL7kLHQWRVXsZFlaRmg/Cd3bSTlAUp3KwdFSBOmMYjrAuHohsMybTbXZOKlefELwC1iV WvH5f/RcbAVRBc3GRtg7/Sg34vaiI43enTfE0blLoBKlcd4sJJCMzb8PSefM6d1fHESU dpIt/chSPTcxYT0OfsuQonhb/pgPu8EQ6j1nI29xssCAnP2/F+Hw9tOI50OKQ+PhJunn uUqb0Jkugkh8uDPih8sUtf63FToxyg98xJbwnmMSzbozE9XuZYEcySX/caR8jTCCnRYf Bxyg== |
| X-Gm-Message-State | ALoCoQkSO5rSJRDvNyjH5CdbWLDsNZBYH8cad2qjUlQCLR8Yebz3dQCu1FzIDNRguj7LFFJxG7fd |
| X-Received | by 10.66.150.5 with SMTP id ue5mr7542046pab.42.1447908404245; Wed, 18 Nov 2015 20:46:44 -0800 (PST) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 46 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, Srinivas Pandruvada <srinivas.pandruvada@intel.com>, Len Brown <len.brown@intel.com>, Alexandra Yates <alexandra.yates@intel.com>, Kristen Carlson Accardi <kristen@linux.intel.com>, "Rafael J. Wysocki" <rjw@rjwysocki.net>, linux-pm@vger.kernel.org |
| X-Original-Date | Thu, 19 Nov 2015 10:16:39 +0530 |
| X-Original-Message-ID | <20151119044639.GD3737@ubuntu> |
| X-Original-References | <1447862144-7188-1-git-send-email-prarit@redhat.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1272848 |
Show key headers only | View raw
On 18-11-15, 10:55, Prarit Bhargava wrote:
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 2e31d09..686f024 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -1233,6 +1233,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
> struct cpudata *cpu;
> int i;
> #endif
> + int max_policy_calc;
> +
> pr_debug("intel_pstate: %s max %u policy->max %u\n", __func__,
> policy->cpuinfo.max_freq, policy->max);
> if (!policy->cpuinfo.max_freq)
> @@ -1249,7 +1251,10 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
> limits = &powersave_limits;
> limits->min_policy_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
> limits->min_policy_pct = clamp_t(int, limits->min_policy_pct, 0 , 100);
> - limits->max_policy_pct = (policy->max * 100) / policy->cpuinfo.max_freq;
> +
> + max_policy_calc = (policy->max * 1000) / policy->cpuinfo.max_freq;
> + limits->max_policy_pct = DIV_ROUND_UP(max_policy_calc, 10);
> +
Nice catch, but why can't we do this instead:
limits->max_policy_pct = DIV_ROUND_UP(policy->max * 100, policy->cpuinfo.max_freq);
> limits->max_policy_pct = clamp_t(int, limits->max_policy_pct, 0 , 100);
>
> /* Normalize user input to [min_policy_pct, max_policy_pct] */
> @@ -1269,6 +1274,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
> int_tofp(100));
> limits->max_perf = div_fp(int_tofp(limits->max_perf_pct),
> int_tofp(100));
> + limits->max_perf = round_up(limits->max_perf, 8);
Perhaps you should fix this in a separate patch.
--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] cpufreq, intel_pstate.c, Fix rounding errors Prarit Bhargava <prarit@redhat.com> - 2015-11-18 17:00 +0100
Re: [PATCH] cpufreq, intel_pstate.c, Fix rounding errors Viresh Kumar <viresh.kumar@linaro.org> - 2015-11-19 05:50 +0100
Re: [PATCH] cpufreq, intel_pstate.c, Fix rounding errors Prarit Bhargava <prarit@redhat.com> - 2015-11-19 20:10 +0100
csiph-web