Skip to contentSkip to conversation

x86: remove idle notifier

PATCH In review Len Brown 5 participants 18 messages Nov 18, 2016 – Dec 8, 2016

Subsystems (5)
lore
Share & tools
lore

Len Brown

author
#0 lore raw

cover x86: remove idle notifier

The return from idle path is latency sensitive, so the less code and fewer data accesses, the better.

Remove the un-maintained i7300_idle driver, the only user of the x86 idle-notifier, and then remove the notifier itself.

author
#1 lore raw

PATCH 1/5 i7300_idle: remove this driver

From: Len Brown <[email protected]>

In preparation for removing the idle_notifier,
remove its only user, the i7300_idle driver.

i7300_idle was deployed in 2008 to reduce idle memory power on systems using the i7300 chipset. The driver worked by throttling the fully-buffered DIMMs during idle periods using the IOAT DMA engine.

The driver ran only on the i7300 chip-set, and no other hardware has used this mechanism. The driver no longer has a maintainer.

Removing this driver will increase idle power on i7300 systems when they run the new kernel without the driver.

---
 MAINTAINERS                  |   6 -
 drivers/dma/ioat/registers.h |   2 -
 drivers/idle/Kconfig         |  17 --
 drivers/idle/Makefile        |   1 -
 drivers/idle/i7300_idle.c    | 612 -------------------------------------------
 5 files changed, 638 deletions(-)
 delete mode 100644 drivers/idle/i7300_idle.c
MAINTAINERS +0 -6
index 2a58eeac9452..3cdccf5b64f3 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]
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

Signature · 1 line
2.11.0.rc1
#2 lore raw

[tip:x86/idle] i7300_idle: Remove this driver

i7300_idle: Remove this driver
Commit-ID:  b65ce83f2a607ad478c5492812f5f218e8d57a6b
Gitweb:     http://git.kernel.org/tip/b65ce83f2a607ad478c5492812f5f218e8d57a6b
Author:     Len Brown <[email protected]>
AuthorDate: Fri, 18 Nov 2016 01:23:17 -0500
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 18 Nov 2016 12:07:56 +0100

i7300_idle: Remove this driver

In preparation for removing the idle_notifier, remove its only user, the i7300_idle driver.

i7300_idle was deployed in 2008 to reduce idle memory power on systems using the i7300 chipset. The driver worked by throttling the fully-buffered DIMMs during idle periods using the IOAT DMA engine.

The driver ran only on the i7300 chip-set, and no other hardware has used this mechanism. The driver no longer has a maintainer.

Removing this driver will increase idle power on i7300 systems when they run the new kernel without the driver.

---
 MAINTAINERS                  |   6 -
 drivers/dma/ioat/registers.h |   2 -
 drivers/idle/Kconfig         |  17 --
 drivers/idle/Makefile        |   1 -
 drivers/idle/i7300_idle.c    | 612 -------------------------------------------
 5 files changed, 638 deletions(-)
MAINTAINERS +0 -6
index 851b89b..80db200 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]
drivers/dma/ioat/registers.h +0 -2
index 48fa4cf..2f3bbc8 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 4732dfc..55bcf80 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 23d295c..0007111 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

author
#3 lore raw

PATCH 2/5 x86: remove idle_notifier

In reply to Len Brown

From: Len Brown <[email protected]>

Upon removal of the i7300_idle driver, the idle_notifer is unused.

---
 arch/x86/include/asm/idle.h |  7 -------
 arch/x86/kernel/process.c   | 15 ---------------
 2 files changed, 22 deletions(-)
arch/x86/include/asm/idle.h +0 -7
index c5d1785373ed..02bab09707f2 100644
@@ -1,13 +1,6 @@
 #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);
arch/x86/kernel/process.c +0 -15
index 0888a879120f..f51950715145 100644
@@ -67,19 +67,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_tss);
 
 #ifdef CONFIG_X86_64
 static DEFINE_PER_CPU(unsigned char, is_idle);
-static ATOMIC_NOTIFIER_HEAD(idle_notifier);
-
-void idle_notifier_register(struct notifier_block *n)
-{
-	atomic_notifier_chain_register(&idle_notifier, n);
-}
-EXPORT_SYMBOL_GPL(idle_notifier_register);
-
-void idle_notifier_unregister(struct notifier_block *n)
-{
-	atomic_notifier_chain_unregister(&idle_notifier, n);
-}
-EXPORT_SYMBOL_GPL(idle_notifier_unregister);
 #endif
 
 /*
@@ -255,14 +242,12 @@ static inline void play_dead(void)
 void enter_idle(void)
 {
 	this_cpu_write(is_idle, 1);
-	atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
 }
 
 static void __exit_idle(void)
 {
 	if (x86_test_and_clear_bit_percpu(0, is_idle) == 0)
 		return;
-	atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
 }
 
 /* Called from interrupts to signify idle end */
Signature · 1 line
2.11.0.rc1
#4 lore raw

[tip:x86/idle] x86/idle: Remove idle_notifier

x86/idle: Remove idle_notifier
Commit-ID:  8e7a7ee9ddd5d4275f1194ef2cc243ea86b0fb6f
Gitweb:     http://git.kernel.org/tip/8e7a7ee9ddd5d4275f1194ef2cc243ea86b0fb6f
Author:     Len Brown <[email protected]>
AuthorDate: Fri, 18 Nov 2016 01:23:18 -0500
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 18 Nov 2016 12:07:56 +0100

x86/idle: Remove idle_notifier

Upon removal of the i7300_idle driver, the idle_notifer is unused.

---
 arch/x86/include/asm/idle.h |  7 -------
 arch/x86/kernel/process.c   | 15 ---------------
 2 files changed, 22 deletions(-)
arch/x86/include/asm/idle.h +0 -7
index c5d1785..02bab09 100644
@@ -1,13 +1,6 @@
 #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);
arch/x86/kernel/process.c +0 -15
index 0888a87..f519507 100644
@@ -67,19 +67,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_tss);
 
 #ifdef CONFIG_X86_64
 static DEFINE_PER_CPU(unsigned char, is_idle);
-static ATOMIC_NOTIFIER_HEAD(idle_notifier);
-
-void idle_notifier_register(struct notifier_block *n)
-{
-	atomic_notifier_chain_register(&idle_notifier, n);
-}
-EXPORT_SYMBOL_GPL(idle_notifier_register);
-
-void idle_notifier_unregister(struct notifier_block *n)
-{
-	atomic_notifier_chain_unregister(&idle_notifier, n);
-}
-EXPORT_SYMBOL_GPL(idle_notifier_unregister);
 #endif
 
 /*
@@ -255,14 +242,12 @@ static inline void play_dead(void)
 void enter_idle(void)
 {
 	this_cpu_write(is_idle, 1);
-	atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
 }
 
 static void __exit_idle(void)
 {
 	if (x86_test_and_clear_bit_percpu(0, is_idle) == 0)
 		return;
-	atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
 }
 
 /* Called from interrupts to signify idle end */
#5 lore raw

Re: [PATCH 2/5] x86: remove idle_notifier

In reply to Len Brown

Hi!

Quoted 3 lines

From: Len Brown <[email protected]>

Upon removal of the i7300_idle driver, the idle_notifer is unused.

Actually... do we want to keep this this one? There's "cpu is loaded" led trigger, which is implemented on arm but not on x86.

I tried to patch process.c, but this would be easier (and does not require new hooks).

Does that make sense?

Best regards,
Pavel

Quoted 2 lines
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#6 lore raw

Re: [PATCH 2/5] x86: remove idle_notifier

Quoted 11 lines · Pavel Machek
Quoted 3 lines

From: Len Brown <[email protected]>

Upon removal of the i7300_idle driver, the idle_notifer is unused.

Actually... do we want to keep this this one? There's "cpu is loaded" led trigger, which is implemented on arm but not on x86.

I tried to patch process.c, but this would be easier (and does not require new hooks).

Does that make sense?

No. Notifiers are crap.

I assume this LED thing is just for entertainment purposes as I cannot figure out why it would be useful. ARM has it does not qualify as useful.

Thanks,

tglx

#7 lore raw

Re: [PATCH 2/5] x86: remove idle_notifier

Quoted 11 lines · Thomas Gleixner
Quoted 10 lines · Pavel Machek
Quoted 3 lines

From: Len Brown <[email protected]>

Upon removal of the i7300_idle driver, the idle_notifer is unused.

Actually... do we want to keep this this one? There's "cpu is loaded" led trigger, which is implemented on arm but not on x86.

I tried to patch process.c, but this would be easier (and does not require new hooks).

Quoted 6 lines
Quoted 1 line

Does that make sense?

No. Notifiers are crap.

I assume this LED thing is just for entertainment purposes as I cannot figure out why it would be useful. ARM has it does not qualify as useful.

Well, on low-speed systems, that led is actually quite important. You know if your keypress was registered, and CPU is just slow, or if you need to press it again.

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#8 lore raw

Re: [PATCH 2/5] x86: remove idle_notifier

Quoted 14 lines · Pavel Machek
Quoted 13 lines · Thomas Gleixner
Quoted 11 lines · Pavel Machek
Quoted 3 lines

From: Len Brown <[email protected]>

Upon removal of the i7300_idle driver, the idle_notifer is unused.

Actually... do we want to keep this this one? There's "cpu is loaded" led trigger, which is implemented on arm but not on x86.

I tried to patch process.c, but this would be easier (and does not require new hooks).

Does that make sense?

Quoted 8 lines
Quoted 4 lines

No. Notifiers are crap.

I assume this LED thing is just for entertainment purposes as I cannot figure out why it would be useful. ARM has it does not qualify as useful.

Well, on low-speed systems, that led is actually quite important. You know if your keypress was registered, and CPU is just slow, or if you need to press it again.

I'm dealing with low-speed systems for 20 years now and that LED was never important for me, quite the contrary, it's annoying to have the extra work in the idle wakeup path which causes extra pointless latency. If you can't figure out your keypress lag without that LED then feel free to patch your own kernel, but stop trying to impose that nonsense on everyone.

Thanks,

tglx

#9 lore raw

Re: [PATCH 2/5] x86: remove idle_notifier

Quoted 24 lines · Thomas Gleixner
Quoted 14 lines · Pavel Machek
Quoted 13 lines · Thomas Gleixner
Quoted 11 lines · Pavel Machek
Quoted 3 lines

From: Len Brown <[email protected]>

Upon removal of the i7300_idle driver, the idle_notifer is unused.

Actually... do we want to keep this this one? There's "cpu is loaded" led trigger, which is implemented on arm but not on x86.

I tried to patch process.c, but this would be easier (and does not require new hooks).

Does that make sense?

Quoted 8 lines
Quoted 4 lines

No. Notifiers are crap.

I assume this LED thing is just for entertainment purposes as I cannot figure out why it would be useful. ARM has it does not qualify as useful.

Well, on low-speed systems, that led is actually quite important. You know if your keypress was registered, and CPU is just slow, or if you need to press it again.

Quoted 5 lines

I'm dealing with low-speed systems for 20 years now and that LED was never important for me, quite the contrary, it's annoying to have the extra work in the idle wakeup path which causes extra pointless latency. If you can't figure out your keypress lag without that LED then feel free to patch your own kernel, but stop trying to impose that nonsense on everyone.

The kernel already has the hooks, and they did not seem to bother anyone. Arm already has the functionality, and it is useful. You may not care, but so what. Leds are broken on x86, plain and simple.

Perhaps that should not be your decision? Feel free to patch it out of your kernel. Or feel free to argue that it needs to be removed from arm. But having unneccessary differences between architectures is just ugly.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#10 lore raw

Re: [PATCH 2/5] x86: remove idle_notifier

Quoted 9 lines · Pavel Machek
Quoted 5 lines · Thomas Gleixner

I'm dealing with low-speed systems for 20 years now and that LED was never important for me, quite the contrary, it's annoying to have the extra work in the idle wakeup path which causes extra pointless latency. If you can't figure out your keypress lag without that LED then feel free to patch your own kernel, but stop trying to impose that nonsense on everyone.

The kernel already has the hooks, and they did not seem to bother anyone.

The have bothered a lot of people up to the point where we could remove them, simply because they are pointless ballast and overhead in the wake from idle path.

Quoted 2 lines

Arm already has the functionality, and it is useful. You may not care, but so what. Leds are broken on x86, plain and simple.

BlinkenLEDs for idle were never available on x86 to begin with, so they can't be broken.

Aisde of that the vast majority of x86 systems simply do not have LEDs which are accessible from that context. So just to support a very questionable use case with a very limited usefulness you want to impose extra code into a code path which is already known to be too heavy weight and people working on it to reduce the overhead.

Quoted 1 line

Perhaps that should not be your decision?

Feel free to complain to Linus. My maintainer decision stands.

Quoted 3 lines

Feel free to patch it out of your kernel. Or feel free to argue that it needs to be removed from arm. But having unneccessary differences between architectures is just ugly.

Following that argumentation would require to add this to the core idle code, so _ALL_ architetures have access to this, but that got turned down by the core maintainers a more than a year ago for the very same reason.

Thanks,

tglx

author
#11 lore raw

PATCH 3/5 x86: remove is_idle flag

In reply to Len Brown

From: Len Brown <[email protected]>

Upon removal of the idle_notifier, all accesses to the "is_idle" flag serve no purpose.

---
 arch/x86/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/x86/kernel/process.c +0 -7
index f51950715145..d8e9d794e114 100644
@@ -65,10 +65,6 @@ __visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss) = {
 };
 EXPORT_PER_CPU_SYMBOL(cpu_tss);
 
-#ifdef CONFIG_X86_64
-static DEFINE_PER_CPU(unsigned char, is_idle);
-#endif
-
 /*
  * this gets called so that we can store lazy state into memory and copy the
  * current task into the new thread.
@@ -241,13 +237,10 @@ static inline void play_dead(void)
 #ifdef CONFIG_X86_64
 void enter_idle(void)
 {
-	this_cpu_write(is_idle, 1);
 }
 
 static void __exit_idle(void)
 {
-	if (x86_test_and_clear_bit_percpu(0, is_idle) == 0)
-		return;
 }
 
 /* Called from interrupts to signify idle end */
Signature · 1 line
2.11.0.rc1
#12 lore raw

[tip:x86/idle] x86/idle: Remove is_idle flag

x86/idle: Remove is_idle flag
Commit-ID:  f08b5fe2d4eeb0a8a6e0e7e71928cf2c7b1b791d
Gitweb:     http://git.kernel.org/tip/f08b5fe2d4eeb0a8a6e0e7e71928cf2c7b1b791d
Author:     Len Brown <[email protected]>
AuthorDate: Fri, 18 Nov 2016 01:23:19 -0500
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 18 Nov 2016 12:07:57 +0100

x86/idle: Remove is_idle flag

Upon removal of the idle_notifier, all accesses to the "is_idle" flag serve no purpose.

---
 arch/x86/kernel/process.c | 7 -------
 1 file changed, 7 deletions(-)
arch/x86/kernel/process.c +0 -7
index f519507..d8e9d79 100644
@@ -65,10 +65,6 @@ __visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss) = {
 };
 EXPORT_PER_CPU_SYMBOL(cpu_tss);
 
-#ifdef CONFIG_X86_64
-static DEFINE_PER_CPU(unsigned char, is_idle);
-#endif
-
 /*
  * this gets called so that we can store lazy state into memory and copy the
  * current task into the new thread.
@@ -241,13 +237,10 @@ static inline void play_dead(void)
 #ifdef CONFIG_X86_64
 void enter_idle(void)
 {
-	this_cpu_write(is_idle, 1);
 }
 
 static void __exit_idle(void)
 {
-	if (x86_test_and_clear_bit_percpu(0, is_idle) == 0)
-		return;
 }
 
 /* Called from interrupts to signify idle end */
author
#13 lore raw

PATCH 4/5 x86: remove x86_test_and_clear_bit_percpu()

In reply to Len Brown

From: Len Brown <[email protected]>

Upon removal of the "is_idle" flag, x86_test_and_clear_bit_percpu() is no longer used.

---
 arch/x86/include/asm/percpu.h | 11 -----------
 1 file changed, 11 deletions(-)
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)
 {
Signature · 1 line
2.11.0.rc1
#14 lore raw

[tip:x86/idle] x86: Remove x86_test_and_clear_bit_percpu()

x86: Remove x86_test_and_clear_bit_percpu()
Commit-ID:  9694be731dc81fec5ad59e863fa6538878ac496a
Gitweb:     http://git.kernel.org/tip/9694be731dc81fec5ad59e863fa6538878ac496a
Author:     Len Brown <[email protected]>
AuthorDate: Fri, 18 Nov 2016 01:23:20 -0500
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 18 Nov 2016 12:07:57 +0100

x86: Remove x86_test_and_clear_bit_percpu()

Upon removal of the "is_idle" flag, x86_test_and_clear_bit_percpu() is no longer used.

---
 arch/x86/include/asm/percpu.h | 11 -----------
 1 file changed, 11 deletions(-)
arch/x86/include/asm/percpu.h +0 -11
index 84f58de..9fa0360 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)
 {
author
#15 lore raw

PATCH 5/5 x86: remove enter_idle(), exit_idle()

In reply to Len Brown

From: Len Brown <[email protected]>

Upon removal of the is_idle flag, these routines became NOPs.

---
 arch/x86/include/asm/apic.h      |  1 -
 arch/x86/include/asm/idle.h      |  9 ---------
 arch/x86/kernel/kvm.c            |  2 --
 arch/x86/kernel/process.c        | 25 -------------------------
 drivers/xen/events/events_base.c |  1 -
 5 files changed, 38 deletions(-)
arch/x86/include/asm/apic.h +0 -1
index f5aaf6c83222..5731274bfdba 100644
@@ -639,7 +639,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/idle.h +0 -9
index 02bab09707f2..dcebb1c634f1 100644
@@ -1,15 +1,6 @@
 #ifndef _ASM_X86_IDLE_H
 #define _ASM_X86_IDLE_H
 
-#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/kernel/kvm.c +0 -2
index edbbfc854e39..093f550f372d 100644
@@ -267,13 +267,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 +0 -25
index d8e9d794e114..ee023919e476 100644
@@ -234,34 +234,9 @@ static inline void play_dead(void)
 }
 #endif
 
-#ifdef CONFIG_X86_64
-void enter_idle(void)
-{
-}
-
-static void __exit_idle(void)
-{
-}
-
-/* Called from interrupts to signify idle end */
-void exit_idle(void)
-{
-	/* idle loop has pid 0 */
-	if (current->pid)
-		return;
-	__exit_idle();
-}
-#endif
-
 void arch_cpu_idle_enter(void)
 {
 	local_touch_nmi();
-	enter_idle();
-}
-
-void arch_cpu_idle_exit(void)
-{
-	__exit_idle();
 }
 
 void arch_cpu_idle_dead(void)
drivers/xen/events/events_base.c +0 -1
index 9ecfcdcdd6d6..9ad622ab05dc 100644
@@ -1256,7 +1256,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
 
Signature · 1 line
2.11.0.rc1
#16 lore raw

[tip:x86/idle] x86/idle: Remove enter_idle(), exit_idle()

x86/idle: Remove enter_idle(), exit_idle()
Commit-ID:  7a3e686e1bb57c34f73d3f19d620fe29035a6c99
Gitweb:     http://git.kernel.org/tip/7a3e686e1bb57c34f73d3f19d620fe29035a6c99
Author:     Len Brown <[email protected]>
AuthorDate: Fri, 18 Nov 2016 01:23:21 -0500
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 18 Nov 2016 12:07:57 +0100

x86/idle: Remove enter_idle(), exit_idle()

Upon removal of the is_idle flag, these routines became NOPs.

---
 arch/x86/include/asm/apic.h      |  1 -
 arch/x86/include/asm/idle.h      |  9 ---------
 arch/x86/kernel/kvm.c            |  2 --
 arch/x86/kernel/process.c        | 25 -------------------------
 drivers/xen/events/events_base.c |  1 -
 5 files changed, 38 deletions(-)
arch/x86/include/asm/apic.h +0 -1
index f5aaf6c..5731274 100644
@@ -639,7 +639,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/idle.h +0 -9
index 02bab09..dcebb1c 100644
@@ -1,15 +1,6 @@
 #ifndef _ASM_X86_IDLE_H
 #define _ASM_X86_IDLE_H
 
-#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/kernel/kvm.c +0 -2
index edbbfc8..093f550 100644
@@ -267,13 +267,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 +0 -25
index d8e9d79..ee023919 100644
@@ -234,34 +234,9 @@ static inline void play_dead(void)
 }
 #endif
 
-#ifdef CONFIG_X86_64
-void enter_idle(void)
-{
-}
-
-static void __exit_idle(void)
-{
-}
-
-/* Called from interrupts to signify idle end */
-void exit_idle(void)
-{
-	/* idle loop has pid 0 */
-	if (current->pid)
-		return;
-	__exit_idle();
-}
-#endif
-
 void arch_cpu_idle_enter(void)
 {
 	local_touch_nmi();
-	enter_idle();
-}
-
-void arch_cpu_idle_exit(void)
-{
-	__exit_idle();
 }
 
 void arch_cpu_idle_dead(void)
drivers/xen/events/events_base.c +0 -1
index 9ecfcdc..9ad622a 100644
@@ -1256,7 +1256,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
 
Acked-by on the v1 series
#17 lore raw
In reply to Len Brown
Quoted 6 lines · Len Brown

The return from idle path is latency sensitive, so the less code and fewer data accesses, the better.

Remove the un-maintained i7300_idle driver, the only user of the x86 idle-notifier, and then remove the notifier itself.

Thanks,

Ingo