mbox series

[v2,0/2] Improvements to the Tegra CPUFREQ driver

Message ID 20230901164113.29139-1-sumitg@nvidia.com
Headers show
Series Improvements to the Tegra CPUFREQ driver | expand

Message

Sumit Gupta Sept. 1, 2023, 4:41 p.m. UTC
This patch set adds below improvements to the Tegra194 CPUFREQ driver.
They are applicable to all the Tegra SoC's supported by the driver.

1) Patch 1: Avoid making SMP call on every frequency request to reduce
   the time for frequency set and get calls.

2) Patch 2: Use reference clock count based loop instead of udelay()
   to improve the accuracy of re-generated CPU frequency.

The patches are not related but have minor conflict. So, need to be
applied in order of patch numbers. If 'Patch 2' is to be applied first
then will rebase that and send separately.

Sumit Gupta (2):
  cpufreq: tegra194: save CPU data to avoid repeated SMP calls
  cpufreq: tegra194: use refclk delta based loop instead of udelay

 drivers/cpufreq/tegra194-cpufreq.c | 151 ++++++++++++++++++++---------
 1 file changed, 106 insertions(+), 45 deletions(-)

Comments

Jon Hunter Sept. 1, 2023, 5:59 p.m. UTC | #1
On 01/09/2023 17:41, Sumit Gupta wrote:
> Use reference clock count based loop instead of "udelay()" for
> sampling of counters to improve the accuracy of re-generated CPU
> frequency. "udelay()" internally calls "WFE" which stops the
> counters and results in bigger delta between the last set freq
> and the re-generated value from counters. The counter sampling
> window used in loop is the minimum number of reference clock
> cycles which is known to give a stable value of CPU frequency.
> The change also helps to reduce the sampling window from "500us"
> to "<50us".
> 
> Suggested-by: Antti Miettinen <amiettinen@nvidia.com>
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---

Same here.

Jon
Sumit Gupta Sept. 1, 2023, 7:53 p.m. UTC | #2
On 01/09/23 23:29, Jon Hunter wrote:
> 
> On 01/09/2023 17:41, Sumit Gupta wrote:
>> Use reference clock count based loop instead of "udelay()" for
>> sampling of counters to improve the accuracy of re-generated CPU
>> frequency. "udelay()" internally calls "WFE" which stops the
>> counters and results in bigger delta between the last set freq
>> and the re-generated value from counters. The counter sampling
>> window used in loop is the minimum number of reference clock
>> cycles which is known to give a stable value of CPU frequency.
>> The change also helps to reduce the sampling window from "500us"
>> to "<50us".
>>
>> Suggested-by: Antti Miettinen <amiettinen@nvidia.com>
>> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
>> ---
> 
> Same here.
> 
> Jon
> 

This patch is newly added in v2.

Thank you,
Sumit Gupta
Sumit Gupta Sept. 19, 2023, 11:28 a.m. UTC | #3
Gentle Ping.

Thank you,
Sumit Gupta


On 01/09/23 22:11, Sumit Gupta wrote:
> This patch set adds below improvements to the Tegra194 CPUFREQ driver.
> They are applicable to all the Tegra SoC's supported by the driver.
> 
> 1) Patch 1: Avoid making SMP call on every frequency request to reduce
>     the time for frequency set and get calls.
> 
> 2) Patch 2: Use reference clock count based loop instead of udelay()
>     to improve the accuracy of re-generated CPU frequency.
> 
> The patches are not related but have minor conflict. So, need to be
> applied in order of patch numbers. If 'Patch 2' is to be applied first
> then will rebase that and send separately.
> 
> Sumit Gupta (2):
>    cpufreq: tegra194: save CPU data to avoid repeated SMP calls
>    cpufreq: tegra194: use refclk delta based loop instead of udelay
> 
>   drivers/cpufreq/tegra194-cpufreq.c | 151 ++++++++++++++++++++---------
>   1 file changed, 106 insertions(+), 45 deletions(-)
>