All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Sumit Gupta <sumitg@nvidia.com>
Cc: 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,
	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
Subject: Re: [Patch 1/6] cpufreq: use correct unit when verify cur freq
Date: Tue, 18 Apr 2023 14:57:05 +0200	[thread overview]
Message-ID: <CAJZ5v0iMcVZMd3YpEC++BZzCwOM2ocYQuK98tm9gQq0fjO41gg@mail.gmail.com> (raw)
In-Reply-To: <20230418113459.12860-2-sumitg@nvidia.com>

On Tue, Apr 18, 2023 at 1:35 PM Sumit Gupta <sumitg@nvidia.com> wrote:
>
> 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);
> --

So this is a fix that can be applied separately from the rest of the
series, isn't it?

WARNING: multiple messages have this Message-ID (diff)
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Sumit Gupta <sumitg@nvidia.com>
Cc: 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,
	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
Subject: Re: [Patch 1/6] cpufreq: use correct unit when verify cur freq
Date: Tue, 18 Apr 2023 14:57:05 +0200	[thread overview]
Message-ID: <CAJZ5v0iMcVZMd3YpEC++BZzCwOM2ocYQuK98tm9gQq0fjO41gg@mail.gmail.com> (raw)
In-Reply-To: <20230418113459.12860-2-sumitg@nvidia.com>

On Tue, Apr 18, 2023 at 1:35 PM Sumit Gupta <sumitg@nvidia.com> wrote:
>
> 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);
> --

So this is a fix that can be applied separately from the rest of the
series, isn't it?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-04-18 12:57 UTC|newest]

Thread overview: 26+ 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
2023-04-18 11:34 ` [Patch 1/6] cpufreq: use correct unit when verify cur freq Sumit Gupta
2023-04-18 11:34   ` Sumit Gupta
2023-04-18 12:57   ` Rafael J. Wysocki [this message]
2023-04-18 12:57     ` Rafael J. Wysocki
2023-04-18 13:31     ` Sumit Gupta
2023-04-18 13:31       ` Sumit Gupta
2023-04-18 15:47       ` Rafael J. Wysocki
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   ` Sumit Gupta
2023-04-18 11:34 ` [Patch 3/6] irqchip/gicv3: Export arm_smccc_get_soc_id_xx funcs Sumit Gupta
2023-04-18 11:34   ` Sumit Gupta
2023-04-26 19:33   ` Florian Fainelli
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   ` 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   ` 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-18 11:34   ` Sumit Gupta
2023-04-24  8:32   ` Ionela Voinescu
2023-04-24  8:32     ` Ionela Voinescu
2023-04-26 15:52     ` Sumit Gupta
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=CAJZ5v0iMcVZMd3YpEC++BZzCwOM2ocYQuK98tm9gQq0fjO41gg@mail.gmail.com \
    --to=rafael@kernel.org \
    --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=sanjayc@nvidia.com \
    --cc=sdonthineni@nvidia.com \
    --cc=sudeep.holla@arm.com \
    --cc=sumitg@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.