linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] cpufreq: pmac64: speed up frequency switch
@ 2013-07-23 20:24 Aaro Koskinen
  2013-07-23 20:24 ` [PATCH 2/3] cpufreq: pmac64: re-estimate G5 cpufreq transition latency Aaro Koskinen
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Aaro Koskinen @ 2013-07-23 20:24 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Benjamin Herrenschmidt,
	Nick Piggin, linux-pm, linuxppc-dev
  Cc: Aaro Koskinen

Some functions on switch path use msleep() which is inaccurate, and
depends on HZ. With HZ=100 msleep(1) takes actually over ten times longer.
Using usleep_range() we get more accurate sleeps.

I measured the "pfunc_slewing_done" polling to take 300us at max (on
2.3GHz dual-processor Xserve G5), so using 500us sleep there should
be fine.

With the patch, g5_switch_freq() duration drops from ~50ms to ~10ms on
Xserve with HZ=100.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 drivers/cpufreq/pmac64-cpufreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/pmac64-cpufreq.c b/drivers/cpufreq/pmac64-cpufreq.c
index 7ba4234..674807d 100644
--- a/drivers/cpufreq/pmac64-cpufreq.c
+++ b/drivers/cpufreq/pmac64-cpufreq.c
@@ -141,7 +141,7 @@ static void g5_vdnap_switch_volt(int speed_mode)
 		pmf_call_one(pfunc_vdnap0_complete, &args);
 		if (done)
 			break;
-		msleep(1);
+		usleep_range(1000, 1000);
 	}
 	if (done == 0)
 		printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
@@ -240,7 +240,7 @@ static void g5_pfunc_switch_volt(int speed_mode)
 		if (pfunc_cpu1_volt_low)
 			pmf_call_one(pfunc_cpu1_volt_low, NULL);
 	}
-	msleep(10); /* should be faster , to fix */
+	usleep_range(10000, 10000); /* should be faster , to fix */
 }
 
 /*
@@ -285,7 +285,7 @@ static int g5_pfunc_switch_freq(int speed_mode)
 		pmf_call_one(pfunc_slewing_done, &args);
 		if (done)
 			break;
-		msleep(1);
+		usleep_range(500, 500);
 	}
 	if (done == 0)
 		printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
-- 
1.8.3.2

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

end of thread, other threads:[~2013-08-15 22:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-23 20:24 [PATCH 1/3] cpufreq: pmac64: speed up frequency switch Aaro Koskinen
2013-07-23 20:24 ` [PATCH 2/3] cpufreq: pmac64: re-estimate G5 cpufreq transition latency Aaro Koskinen
2013-07-24  5:34   ` Viresh Kumar
2013-07-24 10:18     ` Aaro Koskinen
2013-07-24 10:45       ` Viresh Kumar
2013-07-23 20:24 ` [PATCH 3/3] cpufreq: pmac64: enable cpufreq on iMac G5 (iSight) model Aaro Koskinen
2013-07-24  5:34   ` Viresh Kumar
2013-07-23 21:20 ` [PATCH 1/3] cpufreq: pmac64: speed up frequency switch Rafael J. Wysocki
2013-07-23 21:14   ` Benjamin Herrenschmidt
2013-08-12  1:07     ` Benjamin Herrenschmidt
2013-08-15 20:10       ` Aaro Koskinen
2013-08-15 22:14         ` Benjamin Herrenschmidt
2013-07-24  5:32 ` Viresh Kumar

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).