Skip to contentSkip to conversation

kernel: clean up USE_GENERIC_SMP_HELPERS

PATCH In review Amerigo Wang 2 participants 4 messages Nov 29, 2010 – Dec 23, 2010 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel: clean up USE_GENERIC_SMP_HELPERS

For arch which needs USE_GENERIC_SMP_HELPERS, it has to select USE_GENERIC_SMP_HELPERS, rather than leaving a choice to user, since they don't provide their own implementions.

Also, move on_each_cpu() to kernel/smp.c, it is strange to put it in kernel/softirq.c.

For arch which doesn't use USE_GENERIC_SMP_HELPERS, e.g. blackfin, only on_each_cpu() is compiled.

---
 arch/mn10300/Kconfig |    6 +-----
 arch/x86/Kconfig     |    5 +----
 kernel/Makefile      |    2 +-
 kernel/smp.c         |   20 ++++++++++++++++++++
 kernel/softirq.c     |   19 -------------------
 5 files changed, 23 insertions(+), 29 deletions(-)
arch/mn10300/Kconfig +1 -5
index 41ba385..8ed41cf 100644
@@ -203,6 +203,7 @@ endmenu
 config SMP
 	bool "Symmetric multi-processing support"
 	default y
+	select USE_GENERIC_SMP_HELPERS
 	depends on MN10300_PROC_MN2WS0038 || MN10300_PROC_MN2WS0050
 	---help---
 	  This enables support for systems with more than one CPU. If you have
@@ -226,11 +227,6 @@ config NR_CPUS
 	depends on SMP
 	default "2"
 
-config USE_GENERIC_SMP_HELPERS
-	bool
-	depends on SMP
-	default y
-
 source "kernel/Kconfig.preempt"
 
 config MN10300_CURRENT_IN_E2
arch/x86/Kconfig +1 -4
index e330da2..736beea 100644
@@ -65,6 +65,7 @@ config X86
 	select HAVE_SPARSE_IRQ
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PENDING_IRQ if SMP
+	select USE_GENERIC_SMP_HELPERS if SMP
 
 config INSTRUCTION_DECODER
 	def_bool (KPROBES || PERF_EVENTS)
@@ -203,10 +204,6 @@ config HAVE_INTEL_TXT
 	def_bool y
 	depends on EXPERIMENTAL && DMAR && ACPI
 
-config USE_GENERIC_SMP_HELPERS
-	def_bool y
-	depends on SMP
-
 config X86_32_SMP
 	def_bool y
 	depends on X86_32 && SMP
kernel/Makefile +1 -1
index 0b5ff08..55f2f93 100644
@@ -43,7 +43,7 @@ obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
 obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
 obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
-obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
+obj-$(CONFIG_SMP) += smp.o
 ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
kernel/smp.c +20 -0
index 12ed8b0..708f248 100644
@@ -13,6 +13,7 @@
 #include <linux/smp.h>
 #include <linux/cpu.h>
 
+#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
 static struct {
 	struct list_head	queue;
 	raw_spinlock_t		lock;
@@ -529,3 +530,22 @@ void ipi_call_unlock_irq(void)
 {
 	raw_spin_unlock_irq(&call_function.lock);
 }
+#endif /* USE_GENERIC_SMP_HELPERS */
+
+/*
+ * Call a function on all processors
+ */
+int on_each_cpu(void (*func) (void *info), void *info, int wait)
+{
+	int ret = 0;
+
+	preempt_disable();
+	ret = smp_call_function(func, info, wait);
+	local_irq_disable();
+	func(info);
+	local_irq_enable();
+	preempt_enable();
+	return ret;
+}
+EXPORT_SYMBOL(on_each_cpu);
+
kernel/softirq.c +0 -19
index 18f4be0..0ca9f48 100644
@@ -883,25 +883,6 @@ static __init int spawn_ksoftirqd(void)
 }
 early_initcall(spawn_ksoftirqd);
 
-#ifdef CONFIG_SMP
-/*
- * Call a function on all processors
- */
-int on_each_cpu(void (*func) (void *info), void *info, int wait)
-{
-	int ret = 0;
-
-	preempt_disable();
-	ret = smp_call_function(func, info, wait);
-	local_irq_disable();
-	func(info);
-	local_irq_enable();
-	preempt_enable();
-	return ret;
-}
-EXPORT_SYMBOL(on_each_cpu);
-#endif
-
 /*
  * [ These __weak aliases are kept in a separate compilation unit, so that
  *   GCC does not inline them incorrectly. ]
Signature · 1 line
1.7.1
#1 lore raw
Quoted 19 lines · Amerigo Wang

For arch which needs USE_GENERIC_SMP_HELPERS, it has to select USE_GENERIC_SMP_HELPERS, rather than leaving a choice to user, since they don't provide their own implementions.

config MN10300_CURRENT_IN_E2

arch/x86/Kconfig +1 -0
index e330da2..736beea 100644
@@ -65,6 +65,7 @@ config X86
 	select HAVE_SPARSE_IRQ
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PENDING_IRQ if SMP
+	select USE_GENERIC_SMP_HELPERS if SMP
 
 config INSTRUCTION_DECODER
 	def_bool (KPROBES || PERF_EVENTS)

arch/x86/Kconfig config HAVE_INTEL_TXT · line 209

Quoted 10 lines
arch/x86/Kconfig +0 -4
@@ -203,10 +204,6 @@ config HAVE_INTEL_TXT
 	def_bool y
 	depends on EXPERIMENTAL && DMAR && ACPI
 
-config USE_GENERIC_SMP_HELPERS
-	def_bool y
-	depends on SMP
-
 config X86_32_SMP
 	def_bool y
 	depends on X86_32 && SMP

That changelog and the patch don't match, the patch is a total NOP, users never see that config option.

author
#2 lore raw
Quoted 23 lines · Peter Zijlstra
Quoted 22 lines · Amerigo Wang

For arch which needs USE_GENERIC_SMP_HELPERS, it has to select USE_GENERIC_SMP_HELPERS, rather than leaving a choice to user, since they don't provide their own implementions.

config MN10300_CURRENT_IN_E2

arch/x86/Kconfig +1 -0
index e330da2..736beea 100644
@@ -65,6 +65,7 @@ config X86
  	select HAVE_SPARSE_IRQ
  	select GENERIC_IRQ_PROBE
  	select GENERIC_PENDING_IRQ if SMP
+	select USE_GENERIC_SMP_HELPERS if SMP
 
  config INSTRUCTION_DECODER
  	def_bool (KPROBES || PERF_EVENTS)
@@ -203,10 +204,6 @@ config HAVE_INTEL_TXT
  	def_bool y
  	depends on EXPERIMENTAL&&  DMAR&&  ACPI
 
Quoted 10 lines

arch/x86/Kconfig config HAVE_INTEL_TXT

Quoted 7 lines
arch/x86/Kconfig +0 -4
-config USE_GENERIC_SMP_HELPERS
-	def_bool y
-	depends on SMP
-
  config X86_32_SMP
  	def_bool y
  	depends on X86_32&&  SMP

That changelog and the patch don't match, the patch is a total NOP, users never see that config option.

Ok, but isn't 'select' is supposed to be better to express this here? :) This patch also moves on_each_cpu() to kernel/smp.c, btw.

Thanks.

#3 lore raw
Quoted 35 lines · Cong Wang
Quoted 23 lines · Peter Zijlstra
Quoted 22 lines · Amerigo Wang

For arch which needs USE_GENERIC_SMP_HELPERS, it has to select USE_GENERIC_SMP_HELPERS, rather than leaving a choice to user, since they don't provide their own implementions.

config MN10300_CURRENT_IN_E2

arch/x86/Kconfig +1 -0
index e330da2..736beea 100644
@@ -65,6 +65,7 @@ config X86
  	select HAVE_SPARSE_IRQ
  	select GENERIC_IRQ_PROBE
  	select GENERIC_PENDING_IRQ if SMP
+	select USE_GENERIC_SMP_HELPERS if SMP
 
  config INSTRUCTION_DECODER
  	def_bool (KPROBES || PERF_EVENTS)
@@ -203,10 +204,6 @@ config HAVE_INTEL_TXT
  	def_bool y
  	depends on EXPERIMENTAL&&  DMAR&&  ACPI
 
Quoted 10 lines

arch/x86/Kconfig config HAVE_INTEL_TXT

Quoted 7 lines
arch/x86/Kconfig +0 -4
-config USE_GENERIC_SMP_HELPERS
-	def_bool y
-	depends on SMP
-
  config X86_32_SMP
  	def_bool y
  	depends on X86_32&&  SMP

That changelog and the patch don't match, the patch is a total NOP, users never see that config option.

Quoted 1 line

Ok, but isn't 'select' is supposed to be better to express this here? :)

It sure is shorter, so on that ground one can argue so indeed. Its just that the discrepancy between the Changelog (describing an actual change in semantics) and the patch (being a NOP) bothered me.

Quoted 1 line

This patch also moves on_each_cpu() to kernel/smp.c, btw.

Right, it does that, it would probably have been better if that were a patch on its own, seeing as its a completely orthogonal change.