* [PATCH] powerpc: default arch idle could cede processor on pseries
@ 2013-09-04 18:19 Vaidyanathan Srinivasan
0 siblings, 0 replies; only message in thread
From: Vaidyanathan Srinivasan @ 2013-09-04 18:19 UTC (permalink / raw)
To: Paul Mackerras, Benjamin Herrenschmidt; +Cc: Deepthi Dharwar, linuxppc-dev
Hi,
Idle routines on pseries were rearranged so that cpuidle can do
an optimized idle state selection. However, until cpuidle takes
over during boot, the idle loop spins for a short while. This
actually affected bootup time since spinning idle sibling threads
slows down master cpu that executes bootup code.
The following patch enables pseries system to yield to hypervisor and
stop spinning by calling cede_processor() until cpuidle can take over
and do optimal idle state selection.
Bootup time can be reduced to half on small guest where most of the
time is spend before device init.
--Vaidy
powerpc: default arch idle should cede processor on pseries
On IBM POWER platform (pseries), use cede_processor()
in arch idle to save cycles until cpuidle takes over.
This helps speedup boot by having SMT threads stop and yield to
master thread rather than spinning until cpuidle in initialized.
Reported-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Acked-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index c11c823..fd4f995 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -362,10 +362,22 @@ static void pSeries_idle(void)
if (cpuidle_idle_call()) {
/* On error, execute default handler
* to go into low thread priority and possibly
- * low power mode.
+ * low power mode by ceding processor to hypervisor
*/
- HMT_low();
- HMT_very_low();
+
+ /* Indicate to hypervisor that we are idle. */
+ get_lppaca()->idle = 1;
+
+ /*
+ * Yield the processor to the hypervisor. We return if
+ * an external interrupt occurs (which are driven prior
+ * to returning here) or if a prod occurs from another
+ * processor. When returning here, external interrupts
+ * are enabled.
+ */
+ cede_processor();
+
+ get_lppaca()->idle = 0;
}
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-09-04 18:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-04 18:19 [PATCH] powerpc: default arch idle could cede processor on pseries Vaidyanathan Srinivasan
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).