]> Gentwo Git Trees - linux/.git/commitdiff
cpuidle: rename ARCH_HAS_CPU_RELAX to ARCH_HAS_OPTIMIZED_POLL
authorAnkur Arora <ankur.a.arora@oracle.com>
Wed, 25 Sep 2024 23:24:16 +0000 (16:24 -0700)
committerChristoph Lameter <cl@gentwo.org>
Wed, 9 Oct 2024 02:06:42 +0000 (19:06 -0700)
ARCH_HAS_CPU_RELAX is defined on architectures that provide an
primitive (via cpu_relax()) that can be used as part of a polling
mechanism -- one that would be cheaper than spinning in a tight
loop.

However, recent changes in poll_idle() mean that a higher level
primitive -- smp_cond_load_relaxed() is used for polling. This would
in-turn use cpu_relax() or an architecture specific implementation.
On ARM64 in particular this turns into a WFE which waits on a store
to a cacheline instead of a busy poll.

Accordingly condition the polling drivers on ARCH_HAS_OPTIMIZED_POLL
instead of ARCH_HAS_CPU_RELAX. While at it, make both intel-idle
and cpuidle-haltpoll explicitly depend on ARCH_HAS_CPU_RELAX.

Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
Acked-by: Will Deacon <will@kernel.org>
Tested-by: Misono Tomohiro <misono.tomohiro@fujitsu.com>
arch/x86/Kconfig
drivers/acpi/processor_idle.c
drivers/cpuidle/Kconfig
drivers/cpuidle/Makefile
drivers/idle/Kconfig
include/linux/cpuidle.h

index 2852fcd82cbd8c48983c92f0b6634a1c475b9404..555871e7e3b247267e54b4a2fe539352e0678fee 100644 (file)
@@ -378,7 +378,7 @@ config ARCH_MAY_HAVE_PC_FDC
 config GENERIC_CALIBRATE_DELAY
        def_bool y
 
-config ARCH_HAS_CPU_RELAX
+config ARCH_HAS_OPTIMIZED_POLL
        def_bool y
 
 config ARCH_HIBERNATION_POSSIBLE
index 831fa4a121598545749a64b518128ab538834a55..44096406d65de224333f00b39719afc9bb7c6622 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/cpu.h>
 #endif
 
-#define ACPI_IDLE_STATE_START  (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX) ? 1 : 0)
+#define ACPI_IDLE_STATE_START  (IS_ENABLED(CONFIG_ARCH_HAS_OPTIMIZED_POLL) ? 1 : 0)
 
 static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
 module_param(max_cstate, uint, 0400);
@@ -782,7 +782,7 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
        if (max_cstate == 0)
                max_cstate = 1;
 
-       if (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX)) {
+       if (IS_ENABLED(CONFIG_ARCH_HAS_OPTIMIZED_POLL)) {
                cpuidle_poll_state_init(drv);
                count = 1;
        } else {
index cac5997dca505fe70352c0d4134229aca203a871..75f6e176bbc8fb41b58365edc201709178a946b1 100644 (file)
@@ -73,7 +73,7 @@ endmenu
 
 config HALTPOLL_CPUIDLE
        tristate "Halt poll cpuidle driver"
-       depends on X86 && KVM_GUEST
+       depends on X86 && KVM_GUEST && ARCH_HAS_OPTIMIZED_POLL
        select CPU_IDLE_GOV_HALTPOLL
        default y
        help
index d103342b7cfc2120d2981dc1f61be9029aa69c54..f29dfd1525b01b895bf439716d07fef84d3429fe 100644 (file)
@@ -7,7 +7,7 @@ obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
 obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
 obj-$(CONFIG_DT_IDLE_STATES)             += dt_idle_states.o
 obj-$(CONFIG_DT_IDLE_GENPD)              += dt_idle_genpd.o
-obj-$(CONFIG_ARCH_HAS_CPU_RELAX)         += poll_state.o
+obj-$(CONFIG_ARCH_HAS_OPTIMIZED_POLL)    += poll_state.o
 obj-$(CONFIG_HALTPOLL_CPUIDLE)           += cpuidle-haltpoll.o
 
 ##################################################################################
index 6707d2539fc48bf79146efa2d26a3717e299d6b2..6f9b1d48fedeac3d66ed99698d0b4f28e9a06cf2 100644 (file)
@@ -4,6 +4,7 @@ config INTEL_IDLE
        depends on CPU_IDLE
        depends on X86
        depends on CPU_SUP_INTEL
+       depends on ARCH_HAS_OPTIMIZED_POLL
        help
          Enable intel_idle, a cpuidle driver that includes knowledge of
          native Intel hardware idle features.  The acpi_idle driver
index 3183aeb7f5b4238a2b88349ae4bf8c492475460f..7e7e58a17b074072e37582f80c9d46c2da73e17d 100644 (file)
@@ -275,7 +275,7 @@ static inline void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev,
 }
 #endif
 
-#if defined(CONFIG_CPU_IDLE) && defined(CONFIG_ARCH_HAS_CPU_RELAX)
+#if defined(CONFIG_CPU_IDLE) && defined(CONFIG_ARCH_HAS_OPTIMIZED_POLL)
 void cpuidle_poll_state_init(struct cpuidle_driver *drv);
 #else
 static inline void cpuidle_poll_state_init(struct cpuidle_driver *drv) {}