From d8c6ad3184ca6516a5cf457af1afaa293d8f09c0 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 29 Jan 2014 12:45:10 -0500 Subject: sched/idle, PPC: Remove redundant cpuidle_idle_call() The core idle loop now takes care of it. However a few things need checking: - Invocation of cpuidle_idle_call() in pseries_lpar_idle() happened through arch_cpu_idle() and was therefore always preceded by a call to ppc64_runlatch_off(). To preserve this property now that cpuidle_idle_call() is invoked directly from core code, a call to ppc64_runlatch_off() has been added to idle_loop_prolog() in platforms/pseries/processor_idle.c. - Similarly, cpuidle_idle_call() was followed by ppc64_runlatch_off() so a call to the later has been added to idle_loop_epilog(). - And since arch_cpu_idle() always made sure to re-enable IRQs if they were not enabled, this is now done in idle_loop_epilog() as well. The above was made in order to keep the execution flow close to the original. I don't know if that was strictly necessary. Someone well aquainted with the platform details might find some room for possible optimizations. Signed-off-by: Nicolas Pitre Reviewed-by: Preeti U Murthy Cc: "Rafael J. Wysocki" Cc: Daniel Lezcano Cc: linux-arm-kernel@lists.infradead.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-sh@vger.kernel.org Cc: linux-pm@vger.kernel.org Cc: Russell King Cc: linaro-kernel@lists.linaro.org Cc: Benjamin Herrenschmidt Cc: Paul Mundt Signed-off-by: Peter Zijlstra Link: http://lkml.kernel.org/n/tip-47o4m03citrfg9y1vxic5asb@git.kernel.org Signed-off-by: Ingo Molnar --- drivers/cpuidle/cpuidle-pseries.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers') diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c index 7ab564aa0b1c..d4864892951b 100644 --- a/drivers/cpuidle/cpuidle-pseries.c +++ b/drivers/cpuidle/cpuidle-pseries.c @@ -29,6 +29,7 @@ static struct cpuidle_state *cpuidle_state_table; static inline void idle_loop_prolog(unsigned long *in_purr) { + ppc64_runlatch_off(); *in_purr = mfspr(SPRN_PURR); /* * Indicate to the HV that we are idle. Now would be @@ -45,6 +46,10 @@ static inline void idle_loop_epilog(unsigned long in_purr) wait_cycles += mfspr(SPRN_PURR) - in_purr; get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles); get_lppaca()->idle = 0; + + if (irqs_disabled()) + local_irq_enable(); + ppc64_runlatch_on(); } static int snooze_loop(struct cpuidle_device *dev, -- cgit 1.4.1 From 3f67d962c64d9b6de9dab81bdbe6d5c94c80d9b9 Mon Sep 17 00:00:00 2001 From: Preeti U Murthy Date: Wed, 12 Feb 2014 10:18:45 +0530 Subject: cpuidle/pseries: Fix fallout caused due to cleanup in pseries cpuidle backend driver Commit d8c6ad3184ca651 ("sched/idle, PPC: Remove redundant cpuidle_idle_call()") reintroduced ppc64_runlatch_off/on() in the pseries cpuidle backend driver. Hence the cleanup caused by the commit "c0c4301c54adde05:pseries/cpuidle: Remove redundant call to ppc64_runlatch_off() in cpu idle routines" in conjuction with the commit d8c6ad3184ca651 causes a build failure. Signed-off-by: Preeti U Murthy Cc: Peter Zijlstra Cc: Nicolas Pitre Cc: Stephen Rothwell Link: http://lkml.kernel.org/r/52FAFD2D.2090306@linux.vnet.ibm.com Signed-off-by: Ingo Molnar --- drivers/cpuidle/cpuidle-pseries.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c index d4864892951b..6f7b01956885 100644 --- a/drivers/cpuidle/cpuidle-pseries.c +++ b/drivers/cpuidle/cpuidle-pseries.c @@ -17,6 +17,7 @@ #include #include #include +#include #include struct cpuidle_driver pseries_idle_driver = { -- cgit 1.4.1 From 591ac0cb01ec8d0ff131a318f9b9abf6ecab6225 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Mon, 17 Feb 2014 10:59:29 -0500 Subject: cpuidle/powernv: Remove redundant cpuidle_idle_call() The core idle loop now takes care of it. We need to add the runlatch function calls to the idle routines which was earlier taken care of by the arch specific idle routine. Signed-off-by: Nicolas Pitre Signed-off-by: Preeti U Murthy Reviewed-by: Deepthi Dharwar Signed-off-by: Peter Zijlstra Cc: Paul Burton Cc: "Rafael J. Wysocki" Cc: Daniel Lezcano Cc: linux-pm@vger.kernel.org Cc: linaro-kernel@lists.linaro.org Link: http://lkml.kernel.org/n/tip-nr4mtbkkzf2oomaj85m24o7c@git.kernel.org Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar --- arch/powerpc/platforms/powernv/setup.c | 13 +------------ drivers/cpuidle/cpuidle-powernv.c | 5 +++++ 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index 110f4fbd319f..81a7a0a79be7 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -225,16 +224,6 @@ static int __init pnv_probe(void) return 1; } -void powernv_idle(void) -{ - /* Hook to cpuidle framework if available, else - * call on default platform idle code - */ - if (cpuidle_idle_call()) { - power7_idle(); - } -} - define_machine(powernv) { .name = "PowerNV", .probe = pnv_probe, @@ -244,7 +233,7 @@ define_machine(powernv) { .show_cpuinfo = pnv_show_cpuinfo, .progress = pnv_progress, .machine_shutdown = pnv_shutdown, - .power_save = powernv_idle, + .power_save = power7_idle, .calibrate_decr = generic_calibrate_decr, .dma_set_mask = pnv_dma_set_mask, #ifdef CONFIG_KEXEC diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c index 78fd174c57e8..f48607cd2540 100644 --- a/drivers/cpuidle/cpuidle-powernv.c +++ b/drivers/cpuidle/cpuidle-powernv.c @@ -14,6 +14,7 @@ #include #include +#include struct cpuidle_driver powernv_idle_driver = { .name = "powernv_idle", @@ -30,12 +31,14 @@ static int snooze_loop(struct cpuidle_device *dev, local_irq_enable(); set_thread_flag(TIF_POLLING_NRFLAG); + ppc64_runlatch_off(); while (!need_resched()) { HMT_low(); HMT_very_low(); } HMT_medium(); + ppc64_runlatch_on(); clear_thread_flag(TIF_POLLING_NRFLAG); smp_mb(); return index; @@ -45,7 +48,9 @@ static int nap_loop(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { + ppc64_runlatch_off(); power7_idle(); + ppc64_runlatch_on(); return index; } -- cgit 1.4.1