From: Sumit Gupta <sumitg@nvidia.com>
To: <viresh.kumar@linaro.org>, <rafael@kernel.org>,
<ionela.voinescu@arm.com>, <mark.rutland@arm.com>,
<sudeep.holla@arm.com>, <lpieralisi@kernel.org>,
<catalin.marinas@arm.com>, <will@kernel.org>
Cc: <linux-pm@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
<treding@nvidia.com>, <jonathanh@nvidia.com>, <vsethi@nvidia.com>,
<sdonthineni@nvidia.com>, <sanjayc@nvidia.com>,
<ksitaraman@nvidia.com>, <bbasu@nvidia.com>, <sumitg@nvidia.com>
Subject: [Patch 1/6] cpufreq: use correct unit when verify cur freq
Date: Tue, 18 Apr 2023 17:04:54 +0530 [thread overview]
Message-ID: <20230418113459.12860-2-sumitg@nvidia.com> (raw)
In-Reply-To: <20230418113459.12860-1-sumitg@nvidia.com>
From: Sanjay Chandrashekara <sanjayc@nvidia.com>
cpufreq_verify_current_freq checks if the frequency returned by
the hardware has a slight delta with the valid frequency value
last set and returns "policy->cur" if the delta is within "1 MHz".
In the comparison, "policy->cur" is in "kHz" but it's compared
against HZ_PER_MHZ. So, the comparison range becomes "1 GHz".
Fix this by comparing against KHZ_PER_MHZ instead of HZ_PER_MHZ.
Fixes: f55ae08c8987 ("cpufreq: Avoid unnecessary frequency updates due to mismatch")
Signed-off-by: Sanjay Chandrashekara <sanjayc@nvidia.com>
[ sumit gupta: Commit message update ]
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
drivers/cpufreq/cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 8b0509f89f1b..6b52ebe5a890 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1732,7 +1732,7 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, b
* MHz. In such cases it is better to avoid getting into
* unnecessary frequency updates.
*/
- if (abs(policy->cur - new_freq) < HZ_PER_MHZ)
+ if (abs(policy->cur - new_freq) < KHZ_PER_MHZ)
return policy->cur;
cpufreq_out_of_sync(policy, new_freq);
--
2.17.1
next prev parent reply other threads:[~2023-04-18 11:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 11:34 [Patch 0/6] CPPC_CPUFREQ improvements for Tegra241 Sumit Gupta
2023-04-18 11:34 ` Sumit Gupta [this message]
2023-04-18 12:57 ` [Patch 1/6] cpufreq: use correct unit when verify cur freq Rafael J. Wysocki
2023-04-18 13:31 ` Sumit Gupta
2023-04-18 15:47 ` Rafael J. Wysocki
2023-04-18 11:34 ` [Patch 2/6] cpufreq: CPPC: make workaround apply code generic Sumit Gupta
2023-04-18 11:34 ` [Patch 3/6] irqchip/gicv3: Export arm_smccc_get_soc_id_xx funcs Sumit Gupta
2023-04-26 19:33 ` Florian Fainelli
2023-04-18 11:34 ` [Patch 4/6] cpufreq: CPPC: update sampling window for Tegra241 Sumit Gupta
2023-04-18 11:34 ` [Patch 5/6] arm64: cpufeature: Export get_cpu_with_amu_feat func Sumit Gupta
2023-04-18 11:34 ` [Patch 6/6] cpufreq: CPPC: use wq to read amu counters on target cpu Sumit Gupta
2023-04-24 8:32 ` Ionela Voinescu
2023-04-26 15:52 ` Sumit Gupta
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=20230418113459.12860-2-sumitg@nvidia.com \
--to=sumitg@nvidia.com \
--cc=bbasu@nvidia.com \
--cc=catalin.marinas@arm.com \
--cc=ionela.voinescu@arm.com \
--cc=jonathanh@nvidia.com \
--cc=ksitaraman@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mark.rutland@arm.com \
--cc=rafael@kernel.org \
--cc=sanjayc@nvidia.com \
--cc=sdonthineni@nvidia.com \
--cc=sudeep.holla@arm.com \
--cc=treding@nvidia.com \
--cc=viresh.kumar@linaro.org \
--cc=vsethi@nvidia.com \
--cc=will@kernel.org \
/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).