Skip to contentSkip to conversation

x86/idle changes for v4.10

GIT PULL Ingo Molnar 1 participant 1 message Dec 12, 2016

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest x86-idle-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-idle-for-linus

# HEAD: 34bc3560c657d3d4fb17367ed9bfda803166dce0 x86: Remove empty idle.h header

There were two bigger changes in this development cycle:

- Remove idle notifiers:

     32 files changed, 74 insertions(+), 803 deletions(-)

These notifiers were of questionable value and the main usecase, the i7300 driver, was essentially unmaintained and can be removed, plus modern power management concepts don't need the callback - so use this golden opportunity and get rid of this opaque and fragile callback from a latency sensitive code path.

(Len Brown, Thomas Gleixner)

- Improve the AMD Erratum 400 workaround that used high overhead MSR polling in the idle loop. (Borisla Petkov, Thomas Gleixner)

out-of-topic modifications in x86-idle-for-linus:
---------------------------------------------------

  MAINTAINERS                        # b65ce83f2a60: i7300_idle: Remove this driv
  drivers/acpi/processor_idle.c      # 07c94a381253: x86/amd: Simplify AMD E400 a
  drivers/dma/ioat/registers.h       # b65ce83f2a60: i7300_idle: Remove this driv
  drivers/idle/Kconfig               # b65ce83f2a60: i7300_idle: Remove this driv
  drivers/idle/Makefile              # b65ce83f2a60: i7300_idle: Remove this driv
  drivers/idle/i7300_idle.c          # b65ce83f2a60: i7300_idle: Remove this driv

drivers/thermal/intel_powerclamp.c # 34bc3560c657: x86: Remove empty idle.h hea

Thanks,

Ingo

------------------>
Borislav Petkov (2):
x86/cpufeature: Provide helper to set bugs bits x86/amd: Simplify AMD E400 aware idle routine

Len Brown (5):
i7300_idle: Remove this driver
x86/idle: Remove idle_notifier
x86/idle: Remove is_idle flag
x86: Remove x86_test_and_clear_bit_percpu()
x86/idle: Remove enter_idle(), exit_idle()

Thomas Gleixner (3):
x86/bugs: Separate AMD E400 erratum and C1E bug x86/amd: Check for the C1E bug post ACPI subsystem init
x86: Remove empty idle.h header

 MAINTAINERS                              |   6 -
 arch/x86/include/asm/acpi.h              |   2 +-
 arch/x86/include/asm/apic.h              |   2 -
 arch/x86/include/asm/cpufeature.h        |   1 +
 arch/x86/include/asm/cpufeatures.h       |   2 +
 arch/x86/include/asm/idle.h              |  22 --
 arch/x86/include/asm/percpu.h            |  11 -
 arch/x86/include/asm/processor.h         |   3 +-
 arch/x86/kernel/apic/apic.c              |   3 +-
 arch/x86/kernel/apic/io_apic.c           |   1 -
 arch/x86/kernel/cpu/amd.c                |  20 +-
 arch/x86/kernel/cpu/common.c             |   1 -
 arch/x86/kernel/cpu/mcheck/mce_amd.c     |   1 -
 arch/x86/kernel/cpu/mcheck/therm_throt.c |   1 -
 arch/x86/kernel/cpu/mcheck/threshold.c   |   1 -
 arch/x86/kernel/cpu/mshyperv.c           |   1 -
 arch/x86/kernel/irq.c                    |   1 -
 arch/x86/kernel/irq_64.c                 |   1 -
 arch/x86/kernel/kvm.c                    |   3 -
 arch/x86/kernel/process.c                | 149 +++-----
 arch/x86/kernel/process_32.c             |   1 -
 arch/x86/kernel/process_64.c             |   1 -
 arch/x86/kernel/smpboot.c                |   2 -
 arch/x86/platform/uv/tlb_uv.c            |   1 -
 drivers/acpi/processor_idle.c            |   2 +-
 drivers/dma/ioat/registers.h             |   2 -
 drivers/idle/Kconfig                     |  17 -
 drivers/idle/Makefile                    |   1 -
 drivers/idle/i7300_idle.c                | 612 -------------------------------
 drivers/thermal/intel_powerclamp.c       |   1 -
 drivers/xen/events/events_base.c         |   2 -
 init/main.c                              |   3 +
 32 files changed, 74 insertions(+), 803 deletions(-)
 delete mode 100644 arch/x86/include/asm/idle.h
 delete mode 100644 drivers/idle/i7300_idle.c
MAINTAINERS +0 -6
index 851b89b9edcb..80db20008488 100644
@@ -6087,12 +6087,6 @@ S:	Maintained
 F:	Documentation/cdrom/ide-cd
 F:	drivers/ide/ide-cd*
 
-IDLE-I7300
-M:	Andy Henroid <[email protected]>
-L:	[email protected]
-S:	Supported
-F:	drivers/idle/i7300_idle.c
-
 IEEE 802.15.4 SUBSYSTEM
 M:	Alexander Aring <[email protected]>
 L:	[email protected]
arch/x86/include/asm/acpi.h +1 -1
index 5391b0ae7cc3..395b69551fce 100644
@@ -94,7 +94,7 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
 	    boot_cpu_data.x86_model <= 0x05 &&
 	    boot_cpu_data.x86_mask < 0x0A)
 		return 1;
-	else if (amd_e400_c1e_detected)
+	else if (boot_cpu_has(X86_BUG_AMD_APIC_C1E))
 		return 1;
 	else
 		return max_cstate;
arch/x86/include/asm/apic.h +0 -2
index f5aaf6c83222..30a5642eb405 100644
@@ -11,7 +11,6 @@
 #include <asm/fixmap.h>
 #include <asm/mpspec.h>
 #include <asm/msr.h>
-#include <asm/idle.h>
 
 #define ARCH_APICTIMER_STOPS_ON_C3	1
 
@@ -639,7 +638,6 @@ extern void irq_exit(void);
 static inline void entering_irq(void)
 {
 	irq_enter();
-	exit_idle();
 }
 
 static inline void entering_ack_irq(void)
arch/x86/include/asm/cpufeature.h +1 -0
index 1d2b69fc0ceb..d59c15c3defd 100644
@@ -204,6 +204,7 @@ static __always_inline __pure bool _static_cpu_has(u16 bit)
 
 #define static_cpu_has_bug(bit)		static_cpu_has((bit))
 #define boot_cpu_has_bug(bit)		cpu_has_bug(&boot_cpu_data, (bit))
+#define boot_cpu_set_bug(bit)		set_cpu_cap(&boot_cpu_data, (bit))
 
 #define MAX_CPU_FEATURES		(NCAPINTS * 32)
 #define cpu_have_feature		boot_cpu_has
arch/x86/include/asm/cpufeatures.h +2 -0
index a39629206864..ed10b5bf9b93 100644
@@ -311,4 +311,6 @@
 #define X86_BUG_NULL_SEG	X86_BUG(10) /* Nulling a selector preserves the base */
 #define X86_BUG_SWAPGS_FENCE	X86_BUG(11) /* SWAPGS without input dep on GS */
 #define X86_BUG_MONITOR		X86_BUG(12) /* IPI required to wake up remote CPU */
+#define X86_BUG_AMD_E400	X86_BUG(13) /* CPU is among the affected by Erratum 400 */
+
 #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/idle.h deleted +0 -22
deleted file mode 100644
index c5d1785373ed..000000000000
@@ -1,22 +0,0 @@
-#ifndef _ASM_X86_IDLE_H
-#define _ASM_X86_IDLE_H
-
-#define IDLE_START 1
-#define IDLE_END 2
-
-struct notifier_block;
-void idle_notifier_register(struct notifier_block *n);
-void idle_notifier_unregister(struct notifier_block *n);
-
-#ifdef CONFIG_X86_64
-void enter_idle(void);
-void exit_idle(void);
-#else /* !CONFIG_X86_64 */
-static inline void enter_idle(void) { }
-static inline void exit_idle(void) { }
-static inline void __exit_idle(void) { }
-#endif /* CONFIG_X86_64 */
-
-void amd_e400_remove_cpu(int cpu);
-
-#endif /* _ASM_X86_IDLE_H */
arch/x86/include/asm/percpu.h +0 -11
index 84f58de08c2b..9fa03604b2b3 100644
@@ -507,17 +507,6 @@ do {									\
 
 #endif
 
-/* This is not atomic against other CPUs -- CPU preemption needs to be off */
-#define x86_test_and_clear_bit_percpu(bit, var)				\
-({									\
-	bool old__;							\
-	asm volatile("btr %2,"__percpu_arg(1)"\n\t"			\
-		     CC_SET(c)						\
-		     : CC_OUT(c) (old__), "+m" (var)			\
-		     : "dIr" (bit));					\
-	old__;								\
-})
-
 static __always_inline bool x86_this_cpu_constant_test_bit(unsigned int nr,
                         const unsigned long __percpu *addr)
 {
arch/x86/include/asm/processor.h +1 -2
index 984a7bf17f6a..fa609c6f6ba9 100644
@@ -621,10 +621,9 @@ static inline void sync_core(void)
 }
 
 extern void select_idle_routine(const struct cpuinfo_x86 *c);
-extern void init_amd_e400_c1e_mask(void);
+extern void amd_e400_c1e_apic_setup(void);
 
 extern unsigned long		boot_option_idle_override;
-extern bool			amd_e400_c1e_detected;
 
 enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_NOMWAIT,
 			 IDLE_POLL};
arch/x86/kernel/apic/apic.c +2 -1
index 88c657b057e2..2ab0ff0f1dbe 100644
@@ -48,7 +48,6 @@
 #include <asm/io_apic.h>
 #include <asm/desc.h>
 #include <asm/hpet.h>
-#include <asm/idle.h>
 #include <asm/mtrr.h>
 #include <asm/time.h>
 #include <asm/smp.h>
@@ -894,11 +893,13 @@ void __init setup_boot_APIC_clock(void)
 
 	/* Setup the lapic or request the broadcast */
 	setup_APIC_timer();
+	amd_e400_c1e_apic_setup();
 }
 
 void setup_secondary_APIC_clock(void)
 {
 	setup_APIC_timer();
+	amd_e400_c1e_apic_setup();
 }
 
 /*
arch/x86/kernel/apic/io_apic.c +0 -1
index 48e6d84f173e..945e512a112a 100644
@@ -48,7 +48,6 @@
 #include <linux/bootmem.h>
 
 #include <asm/irqdomain.h>
-#include <asm/idle.h>
 #include <asm/io.h>
 #include <asm/smp.h>
 #include <asm/cpu.h>
arch/x86/kernel/cpu/amd.c +13 -7
index b81fe2d63e15..ae26c282f5d3 100644
@@ -20,6 +20,10 @@
 
 #include "cpu.h"
 
+static const int amd_erratum_383[];
+static const int amd_erratum_400[];
+static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum);
+
 /*
  * nodes_per_socket: Stores the number of nodes per socket.
  * Refer to Fam15h Models 00-0fh BKDG - CPUID Fn8000_001E_ECX
@@ -589,11 +593,16 @@ static void early_init_amd(struct cpuinfo_x86 *c)
 	/* F16h erratum 793, CVE-2013-6885 */
 	if (c->x86 == 0x16 && c->x86_model <= 0xf)
 		msr_set_bit(MSR_AMD64_LS_CFG, 15);
-}
 
-static const int amd_erratum_383[];
-static const int amd_erratum_400[];
-static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum);
+	/*
+	 * Check whether the machine is affected by erratum 400. This is
+	 * used to select the proper idle routine and to enable the check
+	 * whether the machine is affected in arch_post_acpi_init(), which
+	 * sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check.
+	 */
+	if (cpu_has_amd_erratum(c, amd_erratum_400))
+		set_cpu_bug(c, X86_BUG_AMD_E400);
+}
 
 static void init_amd_k8(struct cpuinfo_x86 *c)
 {
@@ -774,9 +783,6 @@ static void init_amd(struct cpuinfo_x86 *c)
 	if (c->x86 > 0x11)
 		set_cpu_cap(c, X86_FEATURE_ARAT);
 
-	if (cpu_has_amd_erratum(c, amd_erratum_400))
-		set_cpu_bug(c, X86_BUG_AMD_APIC_C1E);
-
 	rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
 
 	/* 3DNow or LM implies PREFETCHW */
arch/x86/kernel/cpu/common.c +0 -1
index 9bd910a7dd0a..e1f98ff9a3f0 100644
@@ -1144,7 +1144,6 @@ void enable_sep_cpu(void)
 void __init identify_boot_cpu(void)
 {
 	identify_cpu(&boot_cpu_data);
-	init_amd_e400_c1e_mask();
 #ifdef CONFIG_X86_32
 	sysenter_setup();
 	enable_sep_cpu();
arch/x86/kernel/cpu/mcheck/mce_amd.c +0 -1
index 9b5403462936..832f634fdf47 100644
@@ -24,7 +24,6 @@
 
 #include <asm/amd_nb.h>
 #include <asm/apic.h>
-#include <asm/idle.h>
 #include <asm/mce.h>
 #include <asm/msr.h>
 #include <asm/trace/irq_vectors.h>
arch/x86/kernel/cpu/mcheck/therm_throt.c +0 -1
index 6b9dc4d18ccc..2f5c3418b18b 100644
@@ -26,7 +26,6 @@
 
 #include <asm/processor.h>
 #include <asm/apic.h>
-#include <asm/idle.h>
 #include <asm/mce.h>
 #include <asm/msr.h>
 #include <asm/trace/irq_vectors.h>
arch/x86/kernel/cpu/mcheck/threshold.c +0 -1
index fcf9ae9384f4..9beb092d68a5 100644
@@ -6,7 +6,6 @@
 
 #include <asm/irq_vectors.h>
 #include <asm/apic.h>
-#include <asm/idle.h>
 #include <asm/mce.h>
 #include <asm/trace/irq_vectors.h>
 
arch/x86/kernel/cpu/mshyperv.c +0 -1
index 8f44c5a50ab8..6c044543545e 100644
@@ -25,7 +25,6 @@
 #include <asm/hyperv.h>
 #include <asm/mshyperv.h>
 #include <asm/desc.h>
-#include <asm/idle.h>
 #include <asm/irq_regs.h>
 #include <asm/i8259.h>
 #include <asm/apic.h>
arch/x86/kernel/irq.c +0 -1
index 9f669fdd2010..7c6e9ffe4424 100644
@@ -14,7 +14,6 @@
 #include <asm/apic.h>
 #include <asm/io_apic.h>
 #include <asm/irq.h>
-#include <asm/idle.h>
 #include <asm/mce.h>
 #include <asm/hw_irq.h>
 #include <asm/desc.h>
arch/x86/kernel/irq_64.c +0 -1
index 9ebd0b0e73d9..6b0678a541e2 100644
@@ -16,7 +16,6 @@
 #include <linux/uaccess.h>
 #include <linux/smp.h>
 #include <asm/io_apic.h>
-#include <asm/idle.h>
 #include <asm/apic.h>
 
 int sysctl_panic_on_stackoverflow;
arch/x86/kernel/kvm.c +0 -3
index edbbfc854e39..05fe50e5f42c 100644
@@ -42,7 +42,6 @@
 #include <asm/traps.h>
 #include <asm/desc.h>
 #include <asm/tlbflush.h>
-#include <asm/idle.h>
 #include <asm/apic.h>
 #include <asm/apicdef.h>
 #include <asm/hypervisor.h>
@@ -267,13 +266,11 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code)
 	case KVM_PV_REASON_PAGE_NOT_PRESENT:
 		/* page is swapped out by the host. */
 		prev_state = exception_enter();
-		exit_idle();
 		kvm_async_pf_task_wait((u32)read_cr2());
 		exception_exit(prev_state);
 		break;
 	case KVM_PV_REASON_PAGE_READY:
 		rcu_irq_enter();
-		exit_idle();
 		kvm_async_pf_task_wake((u32)read_cr2());
 		rcu_irq_exit();
 		break;
arch/x86/kernel/process.c +50 -99

197 lines not on this page · raw message

arch/x86/kernel/process_32.c +0 -1
index bd7be8efdc4c..3e4ff92597ff 100644
@@ -49,7 +49,6 @@
 
 #include <asm/tlbflush.h>
 #include <asm/cpu.h>
-#include <asm/idle.h>
 #include <asm/syscalls.h>
 #include <asm/debugreg.h>
 #include <asm/switch_to.h>
arch/x86/kernel/process_64.c +0 -1
index b3760b3c1ca0..bb1517106ec1 100644
@@ -44,7 +44,6 @@
 #include <asm/desc.h>
 #include <asm/proto.h>
 #include <asm/ia32.h>
-#include <asm/idle.h>
 #include <asm/syscalls.h>
 #include <asm/debugreg.h>
 #include <asm/switch_to.h>
arch/x86/kernel/smpboot.c +0 -2
index 42f5eb7b4f6c..352ddd560d19 100644
@@ -58,7 +58,6 @@
 #include <asm/desc.h>
 #include <asm/nmi.h>
 #include <asm/irq.h>
-#include <asm/idle.h>
 #include <asm/realmode.h>
 #include <asm/cpu.h>
 #include <asm/numa.h>
@@ -1575,7 +1574,6 @@ void play_dead_common(void)
 {
 	idle_task_exit();
 	reset_lazy_tlbstate();
-	amd_e400_remove_cpu(raw_smp_processor_id());
 
 	/* Ack it */
 	(void)cpu_report_death();
arch/x86/platform/uv/tlb_uv.c +0 -1
index 9e42842e924a..766d4d3529a1 100644
@@ -19,7 +19,6 @@
 #include <asm/uv/uv_hub.h>
 #include <asm/uv/uv_bau.h>
 #include <asm/apic.h>
-#include <asm/idle.h>
 #include <asm/tsc.h>
 #include <asm/irq_vectors.h>
 #include <asm/timer.h>
drivers/acpi/processor_idle.c +1 -1
index 2237d3f24f0e..5c8aa9cf62d7 100644
@@ -141,7 +141,7 @@ static void lapic_timer_check_state(int state, struct acpi_processor *pr,
 	if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT))
 		return;
 
-	if (amd_e400_c1e_detected)
+	if (boot_cpu_has_bug(X86_BUG_AMD_APIC_C1E))
 		type = ACPI_STATE_C1;
 
 	/*
drivers/dma/ioat/registers.h +0 -2
index 48fa4cf9f64a..2f3bbc88ff2a 100644
@@ -106,8 +106,6 @@
 #define IOAT_DMA_COMP_V1			0x0001	/* Compatibility with DMA version 1 */
 #define IOAT_DMA_COMP_V2			0x0002	/* Compatibility with DMA version 2 */
 
-/* IOAT1 define left for i7300_idle driver to not fail compiling */
-#define IOAT1_CHANSTS_OFFSET		0x04
 #define IOAT_CHANSTS_OFFSET		0x08	/* 64-bit Channel Status Register */
 #define IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR	(~0x3fULL)
 #define IOAT_CHANSTS_SOFT_ERR			0x10ULL
drivers/idle/Kconfig +0 -17
index 4732dfc15447..55bcf803841e 100644
@@ -8,20 +8,3 @@ config INTEL_IDLE
 	  native Intel hardware idle features.  The acpi_idle driver
 	  can be configured at the same time, in order to handle
 	  processors intel_idle does not support.
-
-menu "Memory power savings"
-depends on X86_64
-
-config I7300_IDLE_IOAT_CHANNEL
-	bool
-
-config I7300_IDLE
-	tristate "Intel chipset idle memory power saving driver"
-	select I7300_IDLE_IOAT_CHANNEL
-	help
-	  Enable memory power savings when idle with certain Intel server
-	  chipsets. The chipset must have I/O AT support, such as the
-	  Intel 7300. The power savings depends on the type and quantity of
-	  DRAM devices.
-
-endmenu
drivers/idle/Makefile +0 -1
index 23d295cf10f2..0007111d73e9 100644
@@ -1,3 +1,2 @@
-obj-$(CONFIG_I7300_IDLE)			+= i7300_idle.o
 obj-$(CONFIG_INTEL_IDLE)			+= intel_idle.o
 
drivers/idle/i7300_idle.c deleted +0 -612

612 lines not on this page · raw message

drivers/thermal/intel_powerclamp.c +0 -1
index 7a223074df3d..bfc5a142667b 100644
@@ -56,7 +56,6 @@
 #include <asm/msr.h>
 #include <asm/mwait.h>
 #include <asm/cpu_device_id.h>
-#include <asm/idle.h>
 #include <asm/hardirq.h>
 
 #define MAX_TARGET_RATIO (50U)
drivers/xen/events/events_base.c +0 -2
index 9ecfcdcdd6d6..adc19ce3cc66 100644
@@ -37,7 +37,6 @@
 #include <asm/desc.h>
 #include <asm/ptrace.h>
 #include <asm/irq.h>
-#include <asm/idle.h>
 #include <asm/io_apic.h>
 #include <asm/i8259.h>
 #include <asm/xen/pci.h>
@@ -1256,7 +1255,6 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
 
 	irq_enter();
 #ifdef CONFIG_X86
-	exit_idle();
 	inc_irq_stat(irq_hv_callback_count);
 #endif
 
init/main.c +3 -0
index 2858be732f6d..1d7038c1ee19 100644
@@ -448,6 +448,8 @@ void __init parse_early_param(void)
 	done = 1;
 }
 
+void __init __weak arch_post_acpi_subsys_init(void) { }
+
 void __init __weak smp_setup_processor_id(void)
 {
 }
@@ -649,6 +651,7 @@ asmlinkage __visible void __init start_kernel(void)
 	check_bugs();
 
 	acpi_subsystem_init();
+	arch_post_acpi_subsys_init();
 	sfi_init_late();
 
 	if (efi_enabled(EFI_RUNTIME_SERVICES)) {