All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: CPPC: use 10ms delay instead of 2us to avoid high error
@ 2023-03-28 19:38 Yang Shi
  2023-03-29 18:43 ` Rafael J. Wysocki
  2023-03-30  3:56 ` Viresh Kumar
  0 siblings, 2 replies; 23+ messages in thread
From: Yang Shi @ 2023-03-28 19:38 UTC (permalink / raw)
  To: rafael, viresh.kumar; +Cc: yang, scott, linux-pm, linux-kernel

When testing CPPC cpufreq on our platform, we noticed the error may be quite
high and the high error may happen quite often.  For example, on a platform
with a maximum frequency of 2.8GHz when the CPUs were fully loaded (100% load),
we saw cpuinfo_cur_freq may show 4GHz, it means the error is > 40%.  And the
high error (> 1%) happened 256 times out of 2127 samples (sampled every 3
seconds) in an approximate 2hrs test.

We tried to enlarge the delay, and tested with 100us, 1ms and 10ms.  The
below is the results.

100us:
The highest error is 4GHz, 22 times out of 3623 samples

1ms:
The highest error is 3.3GHz, 3 times out of 2814 samples

10ms:
No high error anymore

Increase the measurement delay in cppc_cpufreq_get_rate to 10ms to avoid
high measurement errors.

Signed-off-by: Yang Shi <yang@os.amperecomputing.com>
---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 022e3555407c..c2bf65448d3d 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -851,7 +851,7 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
 	if (ret)
 		return ret;
 
-	udelay(2); /* 2usec delay between sampling */
+	mdelay(10); /* 10msec delay between sampling */
 
 	ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t1);
 	if (ret)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-04-28 11:03 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 19:38 [PATCH] cpufreq: CPPC: use 10ms delay instead of 2us to avoid high error Yang Shi
2023-03-29 18:43 ` Rafael J. Wysocki
2023-03-29 23:22   ` Yang Shi
2023-04-04 19:07   ` Yang Shi
2023-04-05 17:57     ` Pierre Gondois
2023-04-06 21:52       ` Yang Shi
2023-04-07  8:31         ` Pierre Gondois
2023-04-07 22:19           ` Yang Shi
2023-04-11  8:51             ` Pierre Gondois
2023-04-18 18:24               ` Yang Shi
2023-04-19  9:45                 ` Pierre Gondois
2023-04-19 16:52                   ` Pierre Gondois
2023-04-19 20:40                   ` Yang Shi
2023-04-20 16:01                     ` Pierre Gondois
2023-04-20 20:49                       ` Yang Shi
2023-04-24 11:44                         ` Ionela Voinescu
2023-04-26  1:32                           ` Yang Shi
2023-04-26 19:01                             ` Ionela Voinescu
2023-04-27 20:40                               ` Yang Shi
2023-04-28 11:02                                 ` Sumit Gupta
2023-03-30  3:56 ` Viresh Kumar
2023-03-31  9:53   ` Pierre Gondois
2023-04-04 18:57     ` Yang Shi

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.