Linux Documentation
 help / color / mirror / Atom feed
* [PATCH v2] powerpc: Enable generic cpu idle-loop
@ 2023-08-21  4:59 Vaibhav Jain
  2023-10-20 12:26 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Vaibhav Jain @ 2023-08-21  4:59 UTC (permalink / raw)
  To: linux-doc, linux-kernel, linuxppc-dev
  Cc: Vaibhav Jain, Jonathan Corbet, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Paul E. McKenney, Catalin Marinas, Randy Dunlap,
	Peter Zijlstra, Steven Rostedt (Google), Daniel Sneddon,
	Vaidyanathan Srinivasan

This minor patch enables config option GENERIC_IDLE_POLL_SETUP for arch
powerpc. This should add support for kernel param 'nohlt'.

Powerpc kernel also supports another kernel boot-time param called
'powersave' which can also be used to disable all cpu idle-states and
forces CPU to an idle-loop similar to what cpu_idle_poll() does. Hence this
patch  also updates the handling of 'powersave=off' kernel param to enable
generic cpu idle-loop if its enabled.

Signed-off-by: Vaibhav Jain<vaibhav@linux.ibm.com>
---
Changelog:

Since v1:
https://lore.kernel.org/all/20230818050739.827851-1-vaibhav@linux.ibm.com
* Updated powersave_off() to enable generic cpu idle-loop if
'powersave=off' kernel arg is given. [Mpe]
* Update patch description
---
 Documentation/admin-guide/kernel-parameters.txt | 2 +-
 arch/powerpc/Kconfig                            | 1 +
 arch/powerpc/kernel/idle.c                      | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 722b6eca2e93..6b657ebafcfb 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3738,7 +3738,7 @@
 
 	nohibernate	[HIBERNATION] Disable hibernation and resume.
 
-	nohlt		[ARM,ARM64,MICROBLAZE,MIPS,SH] Forces the kernel to
+	nohlt		[ARM,ARM64,MICROBLAZE,MIPS,PPC,SH] Forces the kernel to
 			busy wait in do_idle() and not use the arch_cpu_idle()
 			implementation; requires CONFIG_GENERIC_IDLE_POLL_SETUP
 			to be effective. This is useful on platforms where the
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 0b1172cbeccb..574661403800 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -193,6 +193,7 @@ config PPC
 	select GENERIC_CPU_VULNERABILITIES	if PPC_BARRIER_NOSPEC
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_GETTIMEOFDAY
+	select GENERIC_IDLE_POLL_SETUP
 	select GENERIC_IRQ_SHOW
 	select GENERIC_IRQ_SHOW_LEVEL
 	select GENERIC_PCI_IOMAP		if PCI
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index b1c0418b25c8..7367a0698459 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -21,6 +21,7 @@
 #include <linux/cpu.h>
 #include <linux/sysctl.h>
 #include <linux/tick.h>
+#include <linux/cpu.h>
 
 #include <asm/processor.h>
 #include <asm/cputable.h>
@@ -35,6 +36,8 @@ EXPORT_SYMBOL(cpuidle_disable);
 
 static int __init powersave_off(char *arg)
 {
+	/* Use generic idle loop if thats available */
+	cpu_idle_poll_ctrl(true);
 	ppc_md.power_save = NULL;
 	cpuidle_disable = IDLE_POWERSAVE_OFF;
 	return 1;
-- 
2.41.0


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

* Re: [PATCH v2] powerpc: Enable generic cpu idle-loop
  2023-08-21  4:59 [PATCH v2] powerpc: Enable generic cpu idle-loop Vaibhav Jain
@ 2023-10-20 12:26 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2023-10-20 12:26 UTC (permalink / raw)
  To: Vaibhav Jain, linux-doc, linux-kernel, linuxppc-dev
  Cc: Vaibhav Jain, Jonathan Corbet, Nicholas Piggin, Christophe Leroy,
	Paul E. McKenney, Catalin Marinas, Randy Dunlap, Peter Zijlstra,
	Steven Rostedt (Google), Daniel Sneddon, Vaidyanathan Srinivasan

Hi Vaibhav,

Vaibhav Jain <vaibhav@linux.ibm.com> writes:
> This minor patch enables config option GENERIC_IDLE_POLL_SETUP for arch
> powerpc. This should add support for kernel param 'nohlt'.
>
> Powerpc kernel also supports another kernel boot-time param called
> 'powersave' which can also be used to disable all cpu idle-states and
> forces CPU to an idle-loop similar to what cpu_idle_poll() does. Hence this
> patch  also updates the handling of 'powersave=off' kernel param to enable
> generic cpu idle-loop if its enabled.
>
> Signed-off-by: Vaibhav Jain<vaibhav@linux.ibm.com>
> ---
> Changelog:
>
> Since v1:
> https://lore.kernel.org/all/20230818050739.827851-1-vaibhav@linux.ibm.com
> * Updated powersave_off() to enable generic cpu idle-loop if
> 'powersave=off' kernel arg is given. [Mpe]
> * Update patch description

I had already merged the v1 when I saw this, and ...

> diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
> index b1c0418b25c8..7367a0698459 100644
> --- a/arch/powerpc/kernel/idle.c
> +++ b/arch/powerpc/kernel/idle.c
> @@ -35,6 +36,8 @@ EXPORT_SYMBOL(cpuidle_disable);
>  
>  static int __init powersave_off(char *arg)
>  {
> +	/* Use generic idle loop if thats available */
> +	cpu_idle_poll_ctrl(true);
>  	ppc_md.power_save = NULL;
>  	cpuidle_disable = IDLE_POWERSAVE_OFF;
>  	return 1;

The hope here would be that we could remove the need for cpuidle_disable.

cheers

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

end of thread, other threads:[~2023-10-20 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-21  4:59 [PATCH v2] powerpc: Enable generic cpu idle-loop Vaibhav Jain
2023-10-20 12:26 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox