2013-09-11 16:08:05

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 00/25] simplify generic cross CPU function call implementation

From: Jiang Liu <[email protected]>

Since commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use
logic similar to smp_call_function_single()", single and multiple
(mask version) cross CPU function calls are handled in the same way,
and generic_smp_call_function_interrupt() becomes an aliases of
generic_smp_call_function_single_interrupt(), so only one interrupt
is needed for arch code to support generic SMP function call interfaces.
This patch series simplifies arch code by killing the redundant
interrupt for cross CPU function calls.

We choose to keep generic_smp_call_function_interrupt() instead of
generic_smp_call_function_single_interrupt() because the former is
more generic.

Jiang Liu (25):
Revert smp: Fix SMP function call empty cpu mask race
smp, alpha: kill SMP single function call interrupt
smp, ARC: kill SMP single function call interrupt
smp, ARM: kill SMP single function call interrupt
smp, ARM64: kill SMP single function call interrupt
smp, blackfin: kill SMP single function call interrupt
smp, hexagon: kill SMP single function call interrupt
smp, IA64: kill SMP single function call interrupt
smp, m32r: kill SMP single function call interrupt
smp, metag: kill SMP single function call interrupt
smp, mips: kill redundant call of
generic_smp_call_function_single_interrupt()
smp, mn10300: kill SMP single function call interrupt
smp, mn10300: enable arch_send_call_function_ipi_mask()
smp, parisc: kill SMP single function call interrupt
smp, ppc: kill SMP single function call interrupt
smp, s390: prepare for killing
generic_smp_call_function_single_interrupt()
smp, sh: kill SMP single function call interrupt
smp, sparc64: kill SMP single function call interrupt
smp, sparc: kill SMP single function call interrupt
smp, tile: kill SMP single function call interrupt
smp, tile: kill SMP single function call interrupt
smp, x86: kill SMP single function call interrupt
smp: cleanup unsued generic_smp_call_function_single_interrupt()
smp: rename call_single_queue as call_function_queue
SMP, trivial: remove unused code from smp_boot.h

arch/alpha/kernel/smp.c | 9 +-------
arch/arc/kernel/smp.c | 7 +-----
arch/arm/include/asm/hardirq.h | 2 +-
arch/arm/kernel/smp.c | 10 +--------
arch/arm64/include/asm/hardirq.h | 2 +-
arch/arm64/kernel/smp.c | 10 +--------
arch/blackfin/mach-common/smp.c | 7 +-----
arch/hexagon/include/asm/smp.h | 1 -
arch/hexagon/kernel/smp.c | 6 +-----
arch/ia64/kernel/smp.c | 8 ++-----
arch/m32r/include/asm/smp.h | 1 -
arch/m32r/kernel/smp.c | 9 +-------
arch/m32r/kernel/traps.c | 3 +--
arch/metag/include/asm/smp.h | 2 --
arch/metag/kernel/smp.c | 6 +-----
arch/mips/kernel/smp.c | 1 -
arch/mn10300/include/asm/smp.h | 2 +-
arch/mn10300/kernel/smp.c | 19 ++++++++--------
arch/parisc/kernel/smp.c | 8 +------
arch/powerpc/include/asm/smp.h | 3 +--
arch/powerpc/kernel/smp.c | 12 +----------
arch/s390/kernel/smp.c | 10 ++++-----
arch/sh/include/asm/smp.h | 1 -
arch/sh/kernel/smp.c | 5 +----
arch/sparc/include/asm/pil.h | 5 ++---
arch/sparc/include/asm/smp_32.h | 4 +---
arch/sparc/kernel/entry.S | 10 ++-------
arch/sparc/kernel/leon_smp.c | 31 ++++++--------------------
arch/sparc/kernel/smp_32.c | 14 ++----------
arch/sparc/kernel/smp_64.c | 11 +---------
arch/sparc/kernel/sun4d_smp.c | 31 ++++++--------------------
arch/sparc/kernel/sun4m_smp.c | 11 ++--------
arch/sparc/kernel/ttable_64.S | 12 ++++-------
arch/sparc/mm/ultra.S | 5 -----
arch/tile/include/asm/smp.h | 7 +++---
arch/tile/kernel/smp.c | 6 +-----
arch/x86/include/asm/entry_arch.h | 1 -
arch/x86/include/asm/hw_irq.h | 3 ---
arch/x86/include/asm/irq_vectors.h | 7 +++---
arch/x86/include/asm/trace/irq_vectors.h | 6 ------
arch/x86/include/asm/xen/events.h | 1 -
arch/x86/kernel/entry_64.S | 2 --
arch/x86/kernel/irqinit.c | 4 ----
arch/x86/kernel/smp.c | 24 +--------------------
arch/x86/xen/smp.c | 37 +-------------------------------
include/linux/smp.h | 4 +---
include/linux/smpboot.h | 1 -
kernel/smp.c | 36 +++++++++++--------------------
48 files changed, 82 insertions(+), 335 deletions(-)

--
1.8.1.2


2013-09-11 16:08:12

by Jiang Liu

[permalink] [raw]
Subject: [PATCH v2 01/25] Revert smp: Fix SMP function call empty cpu mask race

From: Jiang Liu <[email protected]>

Commit f44310b98ddb7 "smp: Fix SMP function call empty cpu mask race"
introduced field call_function_data->cpumask_ipi to resolve a race
condition in smp_call_function_many().

Later commit 9a46ad6d6df3 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" fixed the same issue in another
way when optimizing smp_call_function_many(), which then obsoletes
changes introduced by commit f44310b98ddb7. So revert it.

Signed-off-by: Jiang Liu <[email protected]>
Acked-by: Wang YanQing <[email protected]>
Cc: Jiang Liu <[email protected]>
---
kernel/smp.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index fe9f773..a034712 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -23,7 +23,6 @@ enum {
struct call_function_data {
struct call_single_data __percpu *csd;
cpumask_var_t cpumask;
- cpumask_var_t cpumask_ipi;
};

static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data);
@@ -47,9 +46,6 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
cpu_to_node(cpu)))
return notifier_from_errno(-ENOMEM);
- if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL,
- cpu_to_node(cpu)))
- return notifier_from_errno(-ENOMEM);
cfd->csd = alloc_percpu(struct call_single_data);
if (!cfd->csd) {
free_cpumask_var(cfd->cpumask);
@@ -64,7 +60,6 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
case CPU_DEAD:
case CPU_DEAD_FROZEN:
free_cpumask_var(cfd->cpumask);
- free_cpumask_var(cfd->cpumask_ipi);
free_percpu(cfd->csd);
break;
#endif
@@ -255,9 +250,9 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
csd = &__get_cpu_var(csd_data);

csd_lock(csd);
-
csd->func = func;
csd->info = info;
+
generic_exec_single(cpu, csd, wait);
} else {
err = -ENXIO; /* CPU not online */
@@ -410,13 +405,6 @@ void smp_call_function_many(const struct cpumask *mask,
if (unlikely(!cpumask_weight(cfd->cpumask)))
return;

- /*
- * After we put an entry into the list, cfd->cpumask may be cleared
- * again when another CPU sends another IPI for a SMP function call, so
- * cfd->cpumask will be zero.
- */
- cpumask_copy(cfd->cpumask_ipi, cfd->cpumask);
-
for_each_cpu(cpu, cfd->cpumask) {
struct call_single_data *csd = per_cpu_ptr(cfd->csd, cpu);
struct call_single_queue *dst =
@@ -433,7 +421,7 @@ void smp_call_function_many(const struct cpumask *mask,
}

/* Send a message to all CPUs in the map */
- arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
+ arch_send_call_function_ipi_mask(cfd->cpumask);

if (wait) {
for_each_cpu(cpu, cfd->cpumask) {
--
1.8.1.2

2013-09-11 16:08:20

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 03/25] smp, ARC: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/arc/kernel/smp.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index bca3052..f6a0373 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -210,7 +210,6 @@ enum ipi_msg_type {
IPI_NOP = 0,
IPI_RESCHEDULE = 1,
IPI_CALL_FUNC,
- IPI_CALL_FUNC_SINGLE,
IPI_CPU_STOP
};

@@ -254,7 +253,7 @@ void smp_send_stop(void)

void arch_send_call_function_single_ipi(int cpu)
{
- ipi_send_msg(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
+ ipi_send_msg(cpumask_of(cpu), IPI_CALL_FUNC);
}

void arch_send_call_function_ipi_mask(const struct cpumask *mask)
@@ -286,10 +285,6 @@ static inline void __do_IPI(unsigned long *ops, struct ipi_data *ipi, int cpu)
generic_smp_call_function_interrupt();
break;

- case IPI_CALL_FUNC_SINGLE:
- generic_smp_call_function_single_interrupt();
- break;
-
case IPI_CPU_STOP:
ipi_cpu_stop(cpu);
break;
--
1.8.1.2

2013-09-11 16:08:28

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 04/25] smp, ARM: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
---
arch/arm/include/asm/hardirq.h | 2 +-
arch/arm/kernel/smp.c | 10 +---------
2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h
index 2740c2a..436e60b 100644
--- a/arch/arm/include/asm/hardirq.h
+++ b/arch/arm/include/asm/hardirq.h
@@ -5,7 +5,7 @@
#include <linux/threads.h>
#include <asm/irq.h>

-#define NR_IPI 6
+#define NR_IPI 5

typedef struct {
unsigned int __softirq_pending;
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 2dc1934..4ea5994 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -65,7 +65,6 @@ enum ipi_msg_type {
IPI_TIMER,
IPI_RESCHEDULE,
IPI_CALL_FUNC,
- IPI_CALL_FUNC_SINGLE,
IPI_CPU_STOP,
};

@@ -475,7 +474,7 @@ void arch_send_wakeup_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
- smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
+ smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC);
}

static const char *ipi_types[NR_IPI] = {
@@ -484,7 +483,6 @@ static const char *ipi_types[NR_IPI] = {
S(IPI_TIMER, "Timer broadcast interrupts"),
S(IPI_RESCHEDULE, "Rescheduling interrupts"),
S(IPI_CALL_FUNC, "Function call interrupts"),
- S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"),
S(IPI_CPU_STOP, "CPU stop interrupts"),
};

@@ -649,12 +647,6 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
irq_exit();
break;

- case IPI_CALL_FUNC_SINGLE:
- irq_enter();
- generic_smp_call_function_single_interrupt();
- irq_exit();
- break;
-
case IPI_CPU_STOP:
irq_enter();
ipi_cpu_stop(cpu);
--
1.8.1.2

2013-09-11 16:08:38

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 05/25] smp, ARM64: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/arm64/include/asm/hardirq.h | 2 +-
arch/arm64/kernel/smp.c | 10 +---------
2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/include/asm/hardirq.h b/arch/arm64/include/asm/hardirq.h
index 990c051..3be64c8 100644
--- a/arch/arm64/include/asm/hardirq.h
+++ b/arch/arm64/include/asm/hardirq.h
@@ -20,7 +20,7 @@
#include <linux/threads.h>
#include <asm/irq.h>

-#define NR_IPI 4
+#define NR_IPI 3

typedef struct {
unsigned int __softirq_pending;
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index fee5cce..f9b1044 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -59,7 +59,6 @@ volatile unsigned long secondary_holding_pen_release = INVALID_HWID;
enum ipi_msg_type {
IPI_RESCHEDULE,
IPI_CALL_FUNC,
- IPI_CALL_FUNC_SINGLE,
IPI_CPU_STOP,
};

@@ -437,14 +436,13 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
- smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
+ smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC);
}

static const char *ipi_types[NR_IPI] = {
#define S(x,s) [x - IPI_RESCHEDULE] = s
S(IPI_RESCHEDULE, "Rescheduling interrupts"),
S(IPI_CALL_FUNC, "Function call interrupts"),
- S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"),
S(IPI_CPU_STOP, "CPU stop interrupts"),
};

@@ -519,12 +517,6 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
irq_exit();
break;

- case IPI_CALL_FUNC_SINGLE:
- irq_enter();
- generic_smp_call_function_single_interrupt();
- irq_exit();
- break;
-
case IPI_CPU_STOP:
irq_enter();
ipi_cpu_stop(cpu);
--
1.8.1.2

2013-09-11 16:08:45

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 07/25] smp, hexagon: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Shaohua Li <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Jiri Kosina <[email protected]>
Cc: Richard Kuo <[email protected]>
Cc: [email protected]
---
arch/hexagon/include/asm/smp.h | 1 -
arch/hexagon/kernel/smp.c | 6 +-----
2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/hexagon/include/asm/smp.h b/arch/hexagon/include/asm/smp.h
index 2b9b974..ca171c1 100644
--- a/arch/hexagon/include/asm/smp.h
+++ b/arch/hexagon/include/asm/smp.h
@@ -29,7 +29,6 @@ enum ipi_message_type {
IPI_NOP = 0,
IPI_RESCHEDULE = 1,
IPI_CALL_FUNC,
- IPI_CALL_FUNC_SINGLE,
IPI_CPU_STOP,
IPI_TIMER,
};
diff --git a/arch/hexagon/kernel/smp.c b/arch/hexagon/kernel/smp.c
index 9faaa94..ff759f2 100644
--- a/arch/hexagon/kernel/smp.c
+++ b/arch/hexagon/kernel/smp.c
@@ -64,10 +64,6 @@ static inline void __handle_ipi(unsigned long *ops, struct ipi_data *ipi,
generic_smp_call_function_interrupt();
break;

- case IPI_CALL_FUNC_SINGLE:
- generic_smp_call_function_single_interrupt();
- break;
-
case IPI_CPU_STOP:
/*
* call vmstop()
@@ -248,7 +244,7 @@ void smp_send_stop(void)

void arch_send_call_function_single_ipi(int cpu)
{
- send_ipi(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
+ send_ipi(cpumask_of(cpu), IPI_CALL_FUNC);
}

void arch_send_call_function_ipi_mask(const struct cpumask *mask)
--
1.8.1.2

2013-09-11 16:09:11

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 06/25] smp, blackfin: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/blackfin/mach-common/smp.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 82f301c..463f432 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -53,7 +53,6 @@ enum ipi_message_type {
BFIN_IPI_TIMER,
BFIN_IPI_RESCHEDULE,
BFIN_IPI_CALL_FUNC,
- BFIN_IPI_CALL_FUNC_SINGLE,
BFIN_IPI_CPU_STOP,
};

@@ -162,10 +161,6 @@ static irqreturn_t ipi_handler_int1(int irq, void *dev_instance)
generic_smp_call_function_interrupt();
break;

- case BFIN_IPI_CALL_FUNC_SINGLE:
- generic_smp_call_function_single_interrupt();
- break;
-
case BFIN_IPI_CPU_STOP:
ipi_cpu_stop(cpu);
break;
@@ -206,7 +201,7 @@ void send_ipi(const struct cpumask *cpumask, enum ipi_message_type msg)

void arch_send_call_function_single_ipi(int cpu)
{
- send_ipi(cpumask_of(cpu), BFIN_IPI_CALL_FUNC_SINGLE);
+ send_ipi(cpumask_of(cpu), BFIN_IPI_CALL_FUNC);
}

void arch_send_call_function_ipi_mask(const struct cpumask *mask)
--
1.8.1.2

2013-09-11 16:09:25

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 08/25] smp, IA64: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/ia64/kernel/smp.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index 9fcd4e6..0532909 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -62,8 +62,7 @@ static DEFINE_PER_CPU_SHARED_ALIGNED(unsigned short [NR_CPUS],

#define IPI_CALL_FUNC 0
#define IPI_CPU_STOP 1
-#define IPI_CALL_FUNC_SINGLE 2
-#define IPI_KDUMP_CPU_STOP 3
+#define IPI_KDUMP_CPU_STOP 2

/* This needs to be cacheline aligned because it is written to by *other* CPUs. */
static DEFINE_PER_CPU_SHARED_ALIGNED(unsigned long, ipi_operation);
@@ -116,9 +115,6 @@ handle_IPI (int irq, void *dev_id)
case IPI_CALL_FUNC:
generic_smp_call_function_interrupt();
break;
- case IPI_CALL_FUNC_SINGLE:
- generic_smp_call_function_single_interrupt();
- break;
#ifdef CONFIG_KEXEC
case IPI_KDUMP_CPU_STOP:
unw_init_running(kdump_cpu_freeze, NULL);
@@ -318,7 +314,7 @@ smp_flush_tlb_mm (struct mm_struct *mm)

void arch_send_call_function_single_ipi(int cpu)
{
- send_IPI_single(cpu, IPI_CALL_FUNC_SINGLE);
+ send_IPI_single(cpu, IPI_CALL_FUNC);
}

void arch_send_call_function_ipi_mask(const struct cpumask *mask)
--
1.8.1.2

2013-09-11 16:09:33

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 09/25] smp, m32r: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/m32r/include/asm/smp.h | 1 -
arch/m32r/kernel/smp.c | 9 +--------
arch/m32r/kernel/traps.c | 3 +--
3 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/arch/m32r/include/asm/smp.h b/arch/m32r/include/asm/smp.h
index c689b82..3a502d4 100644
--- a/arch/m32r/include/asm/smp.h
+++ b/arch/m32r/include/asm/smp.h
@@ -98,7 +98,6 @@ extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
#define LOCAL_TIMER_IPI (M32R_IRQ_IPI3-M32R_IRQ_IPI0)
#define INVALIDATE_CACHE_IPI (M32R_IRQ_IPI4-M32R_IRQ_IPI0)
#define CPU_BOOT_IPI (M32R_IRQ_IPI5-M32R_IRQ_IPI0)
-#define CALL_FUNC_SINGLE_IPI (M32R_IRQ_IPI6-M32R_IRQ_IPI0)

#define IPI_SHIFT (0)
#define NR_IPIS (8)
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c
index ce7aea3..c6d0bb9 100644
--- a/arch/m32r/kernel/smp.c
+++ b/arch/m32r/kernel/smp.c
@@ -542,7 +542,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
- send_IPI_mask(cpumask_of(cpu), CALL_FUNC_SINGLE_IPI, 0);
+ send_IPI_mask(cpumask_of(cpu), CALL_FUNCTION_IPI, 0);
}

/*==========================================================================*
@@ -569,13 +569,6 @@ void smp_call_function_interrupt(void)
irq_exit();
}

-void smp_call_function_single_interrupt(void)
-{
- irq_enter();
- generic_smp_call_function_single_interrupt();
- irq_exit();
-}
-
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
/* Timer Routines */
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c
index a7a424f..f5d911d 100644
--- a/arch/m32r/kernel/traps.c
+++ b/arch/m32r/kernel/traps.c
@@ -39,7 +39,6 @@ extern void smp_invalidate_interrupt(void);
extern void smp_call_function_interrupt(void);
extern void smp_ipi_timer_interrupt(void);
extern void smp_flush_cache_all_interrupt(void);
-extern void smp_call_function_single_interrupt(void);

/*
* for Boot AP function
@@ -104,7 +103,7 @@ static void set_eit_vector_entries(void)
eit_vector[187] = (unsigned long)smp_ipi_timer_interrupt;
eit_vector[188] = (unsigned long)smp_flush_cache_all_interrupt;
eit_vector[189] = 0; /* CPU_BOOT_IPI */
- eit_vector[190] = (unsigned long)smp_call_function_single_interrupt;
+ eit_vector[190] = 0;
eit_vector[191] = 0;
#endif
_flush_cache_copyback_all();
--
1.8.1.2

2013-09-11 16:09:38

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 10/25] smp, metag: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/metag/include/asm/smp.h | 2 --
arch/metag/kernel/smp.c | 6 +-----
2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/metag/include/asm/smp.h b/arch/metag/include/asm/smp.h
index e0373f8..1d7e770 100644
--- a/arch/metag/include/asm/smp.h
+++ b/arch/metag/include/asm/smp.h
@@ -7,13 +7,11 @@

enum ipi_msg_type {
IPI_CALL_FUNC,
- IPI_CALL_FUNC_SINGLE,
IPI_RESCHEDULE,
};

extern void arch_send_call_function_single_ipi(int cpu);
extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
-#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask

asmlinkage void secondary_start_kernel(void);

diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c
index 7c01131..5b3933b4 100644
--- a/arch/metag/kernel/smp.c
+++ b/arch/metag/kernel/smp.c
@@ -491,7 +491,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
- send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
+ send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC);
}

void show_ipi_list(struct seq_file *p)
@@ -546,10 +546,6 @@ static int do_IPI(struct pt_regs *regs)
generic_smp_call_function_interrupt();
break;

- case IPI_CALL_FUNC_SINGLE:
- generic_smp_call_function_single_interrupt();
- break;
-
default:
pr_crit("CPU%u: Unknown IPI message 0x%lx\n",
cpu, nextmsg);
--
1.8.1.2

2013-09-11 16:09:43

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 11/25] smp, mips: kill redundant call of generic_smp_call_function_single_interrupt()

From: Jiang Liu <[email protected]>

Since commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use
logic similar to smp_call_function_single()",
generic_smp_call_function_single_interrupt() is an alias of
generic_smp_call_function_interrupt(), so kill the redundant call.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/mips/kernel/smp.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 5c208ed..0a022ee 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -150,7 +150,6 @@ asmlinkage void start_secondary(void)
void __irq_entry smp_call_function_interrupt(void)
{
irq_enter();
- generic_smp_call_function_single_interrupt();
generic_smp_call_function_interrupt();
irq_exit();
}
--
1.8.1.2

2013-09-11 16:09:50

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 12/25] smp, mn10300: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

smp, mn10300: rename CALL_FUNC_SINGLE_IPI as CALL_FUNC_IPI

Rename CALL_FUNC_SINGLE_IPI as CALL_FUNC_IPI to prepare for
killing generic_smp_call_function_single_interrupt().

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/mn10300/include/asm/smp.h | 2 +-
arch/mn10300/kernel/smp.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mn10300/include/asm/smp.h b/arch/mn10300/include/asm/smp.h
index 56c4241..8e689d1 100644
--- a/arch/mn10300/include/asm/smp.h
+++ b/arch/mn10300/include/asm/smp.h
@@ -31,7 +31,7 @@
#include <proc/smp-regs.h>

#define RESCHEDULE_IPI 63
-#define CALL_FUNC_SINGLE_IPI 192
+#define CALL_FUNC_IPI 192
#define LOCAL_TIMER_IPI 193
#define FLUSH_CACHE_IPI 194
#define CALL_FUNCTION_NMI_IPI 195
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c
index a17f9c9..7ae353d 100644
--- a/arch/mn10300/kernel/smp.c
+++ b/arch/mn10300/kernel/smp.c
@@ -164,11 +164,11 @@ static void init_ipi(void)
mn10300_ipi_enable(RESCHEDULE_IPI);

/* set up the call function IPI */
- irq_set_chip_and_handler(CALL_FUNC_SINGLE_IPI, &mn10300_ipi_type,
+ irq_set_chip_and_handler(CALL_FUNC_IPI, &mn10300_ipi_type,
handle_percpu_irq);
- setup_irq(CALL_FUNC_SINGLE_IPI, &call_function_ipi);
- set_intr_level(CALL_FUNC_SINGLE_IPI, CALL_FUNCTION_GxICR_LV);
- mn10300_ipi_enable(CALL_FUNC_SINGLE_IPI);
+ setup_irq(CALL_FUNC_IPI, &call_function_ipi);
+ set_intr_level(CALL_FUNC_IPI, CALL_FUNCTION_GxICR_LV);
+ mn10300_ipi_enable(CALL_FUNC_IPI);

/* set up the local timer IPI */
#if !defined(CONFIG_GENERIC_CLOCKEVENTS) || \
@@ -362,7 +362,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
- send_IPI_mask(cpumask_of(cpu), CALL_FUNC_SINGLE_IPI);
+ send_IPI_mask(cpumask_of(cpu), CALL_FUNC_IPI);
}

/**
@@ -519,7 +519,7 @@ static irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id)
static irqreturn_t smp_call_function_interrupt(int irq, void *dev_id)
{
/* generic_smp_call_function_interrupt(); */
- generic_smp_call_function_single_interrupt();
+ generic_smp_call_function_interrupt();
return IRQ_HANDLED;
}

@@ -598,8 +598,8 @@ static void __init smp_cpu_init(void)
/* Force FPU initialization */
clear_using_fpu(current);

- GxICR(CALL_FUNC_SINGLE_IPI) = CALL_FUNCTION_GxICR_LV | GxICR_DETECT;
- mn10300_ipi_enable(CALL_FUNC_SINGLE_IPI);
+ GxICR(CALL_FUNC_IPI) = CALL_FUNCTION_GxICR_LV | GxICR_DETECT;
+ mn10300_ipi_enable(CALL_FUNC_IPI);

GxICR(LOCAL_TIMER_IPI) = LOCAL_TIMER_GxICR_LV | GxICR_DETECT;
mn10300_ipi_enable(LOCAL_TIMER_IPI);
--
1.8.1.2

2013-09-11 16:10:10

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 15/25] smp, ppc: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/powerpc/include/asm/smp.h | 3 +--
arch/powerpc/kernel/smp.c | 12 +-----------
2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 48cfc85..53faa03 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -119,8 +119,7 @@ extern int cpu_to_core_id(int cpu);
* in /proc/interrupts will be wrong!!! --Troy */
#define PPC_MSG_CALL_FUNCTION 0
#define PPC_MSG_RESCHEDULE 1
-#define PPC_MSG_CALL_FUNC_SINGLE 2
-#define PPC_MSG_DEBUGGER_BREAK 3
+#define PPC_MSG_DEBUGGER_BREAK 2

/* for irq controllers that have dedicated ipis per message (4) */
extern int smp_request_message_ipi(int virq, int message);
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 38b0ba6..0c53b10 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -123,12 +123,6 @@ static irqreturn_t reschedule_action(int irq, void *data)
return IRQ_HANDLED;
}

-static irqreturn_t call_function_single_action(int irq, void *data)
-{
- generic_smp_call_function_single_interrupt();
- return IRQ_HANDLED;
-}
-
static irqreturn_t debug_ipi_action(int irq, void *data)
{
if (crash_ipi_function_ptr) {
@@ -146,14 +140,12 @@ static irqreturn_t debug_ipi_action(int irq, void *data)
static irq_handler_t smp_ipi_action[] = {
[PPC_MSG_CALL_FUNCTION] = call_function_action,
[PPC_MSG_RESCHEDULE] = reschedule_action,
- [PPC_MSG_CALL_FUNC_SINGLE] = call_function_single_action,
[PPC_MSG_DEBUGGER_BREAK] = debug_ipi_action,
};

const char *smp_ipi_name[] = {
[PPC_MSG_CALL_FUNCTION] = "ipi call function",
[PPC_MSG_RESCHEDULE] = "ipi reschedule",
- [PPC_MSG_CALL_FUNC_SINGLE] = "ipi call function single",
[PPC_MSG_DEBUGGER_BREAK] = "ipi debugger",
};

@@ -225,8 +217,6 @@ irqreturn_t smp_ipi_demux(void)
generic_smp_call_function_interrupt();
if (all & (1 << (24 - 8 * PPC_MSG_RESCHEDULE)))
scheduler_ipi();
- if (all & (1 << (24 - 8 * PPC_MSG_CALL_FUNC_SINGLE)))
- generic_smp_call_function_single_interrupt();
if (all & (1 << (24 - 8 * PPC_MSG_DEBUGGER_BREAK)))
debug_ipi_action(0, NULL);
#else
@@ -257,7 +247,7 @@ EXPORT_SYMBOL_GPL(smp_send_reschedule);

void arch_send_call_function_single_ipi(int cpu)
{
- do_message_pass(cpu, PPC_MSG_CALL_FUNC_SINGLE);
+ do_message_pass(cpu, PPC_MSG_CALL_FUNCTION);
}

void arch_send_call_function_ipi_mask(const struct cpumask *mask)
--
1.8.1.2

2013-09-11 16:10:19

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 16/25] smp, s390: prepare for killing generic_smp_call_function_single_interrupt()

From: Jiang Liu <[email protected]>

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/s390/kernel/smp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index d386c4e..81ca42a 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -49,7 +49,7 @@

enum {
ec_schedule = 0,
- ec_call_function_single,
+ ec_call_function,
ec_stop_cpu,
};

@@ -437,8 +437,8 @@ static void smp_handle_ext_call(void)
smp_stop_cpu();
if (test_bit(ec_schedule, &bits))
scheduler_ipi();
- if (test_bit(ec_call_function_single, &bits))
- generic_smp_call_function_single_interrupt();
+ if (test_bit(ec_call_function, &bits))
+ generic_smp_call_function_interrupt();
}

static void do_ext_call_interrupt(struct ext_code ext_code,
@@ -453,12 +453,12 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
int cpu;

for_each_cpu(cpu, mask)
- pcpu_ec_call(pcpu_devices + cpu, ec_call_function_single);
+ pcpu_ec_call(pcpu_devices + cpu, ec_call_function);
}

void arch_send_call_function_single_ipi(int cpu)
{
- pcpu_ec_call(pcpu_devices + cpu, ec_call_function_single);
+ pcpu_ec_call(pcpu_devices + cpu, ec_call_function);
}

#ifndef CONFIG_64BIT
--
1.8.1.2

2013-09-11 16:10:33

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 18/25] smp, sparc64: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/sparc/include/asm/pil.h | 5 ++---
arch/sparc/kernel/smp_64.c | 11 +----------
arch/sparc/kernel/ttable_64.S | 12 ++++--------
arch/sparc/mm/ultra.S | 5 -----
4 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/arch/sparc/include/asm/pil.h b/arch/sparc/include/asm/pil.h
index 2669370..5ffb15d 100644
--- a/arch/sparc/include/asm/pil.h
+++ b/arch/sparc/include/asm/pil.h
@@ -22,9 +22,8 @@
#define PIL_SMP_CAPTURE 3
#define PIL_SMP_CTX_NEW_VERSION 4
#define PIL_DEVICE_IRQ 5
-#define PIL_SMP_CALL_FUNC_SNGL 6
-#define PIL_DEFERRED_PCR_WORK 7
-#define PIL_KGDB_CAPTURE 8
+#define PIL_DEFERRED_PCR_WORK 6
+#define PIL_KGDB_CAPTURE 7
#define PIL_NORMAL_MAX 14
#define PIL_NMI 15

diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index e142545..65338c4 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -811,12 +811,9 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
xcall_deliver((u64) &xcall_call_function, 0, 0, mask);
}

-extern unsigned long xcall_call_function_single;
-
void arch_send_call_function_single_ipi(int cpu)
{
- xcall_deliver((u64) &xcall_call_function_single, 0, 0,
- cpumask_of(cpu));
+ xcall_deliver((u64) &xcall_call_function, 0, 0, cpumask_of(cpu));
}

void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs)
@@ -825,12 +822,6 @@ void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs)
generic_smp_call_function_interrupt();
}

-void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs)
-{
- clear_softint(1 << irq);
- generic_smp_call_function_single_interrupt();
-}
-
static void tsb_sync(void *info)
{
struct trap_per_cpu *tp = &trap_block[raw_smp_processor_id()];
diff --git a/arch/sparc/kernel/ttable_64.S b/arch/sparc/kernel/ttable_64.S
index c6dfdaa..defa2db 100644
--- a/arch/sparc/kernel/ttable_64.S
+++ b/arch/sparc/kernel/ttable_64.S
@@ -58,17 +58,13 @@ tl0_irq3: BTRAP(0x43)
tl0_irq4: BTRAP(0x44)
#endif
tl0_irq5: TRAP_IRQ(handler_irq, 5)
-#ifdef CONFIG_SMP
-tl0_irq6: TRAP_IRQ(smp_call_function_single_client, 6)
-#else
-tl0_irq6: BTRAP(0x46)
-#endif
-tl0_irq7: TRAP_IRQ(deferred_pcr_work_irq, 7)
+tl0_irq6: TRAP_IRQ(deferred_pcr_work_irq, 6)
#if defined(CONFIG_KGDB) && defined(CONFIG_SMP)
-tl0_irq8: TRAP_IRQ(smp_kgdb_capture_client, 8)
+tl0_irq7: TRAP_IRQ(smp_kgdb_capture_client, 7)
#else
-tl0_irq8: BTRAP(0x48)
+tl0_irq7: BTRAP(0x47)
#endif
+tl0_irq8: BTRAP(0x48)
tl0_irq9: BTRAP(0x49)
tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d)
tl0_irq14: TRAP_IRQ(timer_interrupt, 14)
diff --git a/arch/sparc/mm/ultra.S b/arch/sparc/mm/ultra.S
index 432aa0c..9b23d97 100644
--- a/arch/sparc/mm/ultra.S
+++ b/arch/sparc/mm/ultra.S
@@ -780,11 +780,6 @@ xcall_call_function:
wr %g0, (1 << PIL_SMP_CALL_FUNC), %set_softint
retry

- .globl xcall_call_function_single
-xcall_call_function_single:
- wr %g0, (1 << PIL_SMP_CALL_FUNC_SNGL), %set_softint
- retry
-
.globl xcall_receive_signal
xcall_receive_signal:
wr %g0, (1 << PIL_SMP_RECEIVE_SIGNAL), %set_softint
--
1.8.1.2

2013-09-11 16:10:40

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 19/25] smp, sparc: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/sparc/include/asm/smp_32.h | 4 +---
arch/sparc/kernel/entry.S | 10 ++--------
arch/sparc/kernel/leon_smp.c | 31 +++++++------------------------
arch/sparc/kernel/smp_32.c | 14 ++------------
arch/sparc/kernel/sun4d_smp.c | 31 +++++++------------------------
arch/sparc/kernel/sun4m_smp.c | 11 ++---------
6 files changed, 21 insertions(+), 80 deletions(-)

diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h
index 3c8917f..6aec01a 100644
--- a/arch/sparc/include/asm/smp_32.h
+++ b/arch/sparc/include/asm/smp_32.h
@@ -48,7 +48,6 @@ void smp_callin(void);
void smp_store_cpu_info(int);

void smp_resched_interrupt(void);
-void smp_call_function_single_interrupt(void);
void smp_call_function_interrupt(void);

struct seq_file;
@@ -60,8 +59,7 @@ struct sparc32_ipi_ops {
unsigned long arg2, unsigned long arg3,
unsigned long arg4);
void (*resched)(int cpu);
- void (*single)(int cpu);
- void (*mask_one)(int cpu);
+ void (*func_call)(int cpu);
};
extern const struct sparc32_ipi_ops *sparc32_ipi_ops;

diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index e2a0300..80cc772 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -263,7 +263,7 @@ smp4m_ticker:
* on some level other than 15 which is the NMI and only used
* for cross calls. That has a separate entry point below.
*
- * IPIs are sent on Level 12, 13 and 14. See IRQ_IPI_*.
+ * IPIs are sent on Level 13 and 14. See IRQ_IPI_*.
*/
maybe_smp4m_msg:
GET_PROCESSOR4M_ID(o3)
@@ -287,14 +287,8 @@ maybe_smp4m_msg:
wr %l4, PSR_ET, %psr
WRITE_PAUSE
srl %o3, 28, %o2 ! shift for simpler checks below
-maybe_smp4m_msg_check_single:
- andcc %o2, 0x1, %g0
- beq,a maybe_smp4m_msg_check_mask
- andcc %o2, 0x2, %g0
- call smp_call_function_single_interrupt
- nop
- andcc %o2, 0x2, %g0
maybe_smp4m_msg_check_mask:
+ andcc %o2, 0x2, %g0
beq,a maybe_smp4m_msg_check_resched
andcc %o2, 0x4, %g0
call smp_call_function_interrupt
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 6edf955..396b71d 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -271,8 +271,7 @@ void leon_irq_rotate(int cpu)
}

struct leon_ipi_work {
- int single;
- int msk;
+ int func_call;
int resched;
};

@@ -308,7 +307,7 @@ static void __init leon_ipi_init(void)

for_each_possible_cpu(cpu) {
work = &per_cpu(leon_ipi_work, cpu);
- work->single = work->msk = work->resched = 0;
+ work->func_call = work->resched = 0;
}
}

@@ -319,23 +318,12 @@ static void leon_send_ipi(int cpu, int level)
LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask);
}

-static void leon_ipi_single(int cpu)
+static void leon_ipi_func_call(int cpu)
{
struct leon_ipi_work *work = &per_cpu(leon_ipi_work, cpu);

/* Mark work */
- work->single = 1;
-
- /* Generate IRQ on the CPU */
- leon_send_ipi(cpu, leon_ipi_irq);
-}
-
-static void leon_ipi_mask_one(int cpu)
-{
- struct leon_ipi_work *work = &per_cpu(leon_ipi_work, cpu);
-
- /* Mark work */
- work->msk = 1;
+ work->func_call = 1;

/* Generate IRQ on the CPU */
leon_send_ipi(cpu, leon_ipi_irq);
@@ -356,12 +344,8 @@ void leonsmp_ipi_interrupt(void)
{
struct leon_ipi_work *work = &__get_cpu_var(leon_ipi_work);

- if (work->single) {
- work->single = 0;
- smp_call_function_single_interrupt();
- }
- if (work->msk) {
- work->msk = 0;
+ if (work->func_call) {
+ work->func_call = 0;
smp_call_function_interrupt();
}
if (work->resched) {
@@ -467,8 +451,7 @@ void leon_cross_call_irq(void)
static const struct sparc32_ipi_ops leon_ipi_ops = {
.cross_call = leon_cross_call,
.resched = leon_ipi_resched,
- .single = leon_ipi_single,
- .mask_one = leon_ipi_mask_one,
+ .func_call = leon_ipi_func_call,
};

void __init leon_init_smp(void)
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index a102bfb..0530d67 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -138,17 +138,15 @@ void smp_send_stop(void)

void arch_send_call_function_single_ipi(int cpu)
{
- /* trigger one IPI single call on one CPU */
- sparc32_ipi_ops->single(cpu);
+ sparc32_ipi_ops->func_call(cpu);
}

void arch_send_call_function_ipi_mask(const struct cpumask *mask)
{
int cpu;

- /* trigger IPI mask call on each CPU */
for_each_cpu(cpu, mask)
- sparc32_ipi_ops->mask_one(cpu);
+ sparc32_ipi_ops->func_call(cpu);
}

void smp_resched_interrupt(void)
@@ -160,14 +158,6 @@ void smp_resched_interrupt(void)
/* re-schedule routine called by interrupt return code. */
}

-void smp_call_function_single_interrupt(void)
-{
- irq_enter();
- generic_smp_call_function_single_interrupt();
- local_cpu_data().irq_call_count++;
- irq_exit();
-}
-
void smp_call_function_interrupt(void)
{
irq_enter();
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index d5c3195..72f3797 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -181,8 +181,7 @@ void __init smp4d_smp_done(void)

/* Memory structure giving interrupt handler information about IPI generated */
struct sun4d_ipi_work {
- int single;
- int msk;
+ int func_call;
int resched;
};

@@ -198,7 +197,7 @@ static void __init smp4d_ipi_init(void)

for_each_possible_cpu(cpu) {
work = &per_cpu(sun4d_ipi_work, cpu);
- work->single = work->msk = work->resched = 0;
+ work->func_call = work->resched = 0;
}
}

@@ -206,12 +205,8 @@ void sun4d_ipi_interrupt(void)
{
struct sun4d_ipi_work *work = &__get_cpu_var(sun4d_ipi_work);

- if (work->single) {
- work->single = 0;
- smp_call_function_single_interrupt();
- }
- if (work->msk) {
- work->msk = 0;
+ if (work->func_call) {
+ work->func_call = 0;
smp_call_function_interrupt();
}
if (work->resched) {
@@ -233,23 +228,12 @@ static void sun4d_send_ipi(int cpu, int level)
cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1)));
}

-static void sun4d_ipi_single(int cpu)
-{
- struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu);
-
- /* Mark work */
- work->single = 1;
-
- /* Generate IRQ on the CPU */
- sun4d_send_ipi(cpu, SUN4D_IPI_IRQ);
-}
-
-static void sun4d_ipi_mask_one(int cpu)
+static void sun4d_ipi_func_call(int cpu)
{
struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu);

/* Mark work */
- work->msk = 1;
+ work->func_call = 1;

/* Generate IRQ on the CPU */
sun4d_send_ipi(cpu, SUN4D_IPI_IRQ);
@@ -392,8 +376,7 @@ void smp4d_percpu_timer_interrupt(struct pt_regs *regs)
static const struct sparc32_ipi_ops sun4d_ipi_ops = {
.cross_call = sun4d_cross_call,
.resched = sun4d_ipi_resched,
- .single = sun4d_ipi_single,
- .mask_one = sun4d_ipi_mask_one,
+ .func_call = sun4d_ipi_func_call,
};

void __init sun4d_init_smp(void)
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c
index d3408e7..d4b7d01 100644
--- a/arch/sparc/kernel/sun4m_smp.c
+++ b/arch/sparc/kernel/sun4m_smp.c
@@ -20,7 +20,6 @@
#include "irq.h"
#include "kernel.h"

-#define IRQ_IPI_SINGLE 12
#define IRQ_IPI_MASK 13
#define IRQ_IPI_RESCHED 14
#define IRQ_CROSS_CALL 15
@@ -145,12 +144,7 @@ static void sun4m_ipi_resched(int cpu)
sun4m_send_ipi(cpu, IRQ_IPI_RESCHED);
}

-static void sun4m_ipi_single(int cpu)
-{
- sun4m_send_ipi(cpu, IRQ_IPI_SINGLE);
-}
-
-static void sun4m_ipi_mask_one(int cpu)
+static void sun4m_ipi_func_call(int cpu)
{
sun4m_send_ipi(cpu, IRQ_IPI_MASK);
}
@@ -262,8 +256,7 @@ void smp4m_percpu_timer_interrupt(struct pt_regs *regs)
static const struct sparc32_ipi_ops sun4m_ipi_ops = {
.cross_call = sun4m_cross_call,
.resched = sun4m_ipi_resched,
- .single = sun4m_ipi_single,
- .mask_one = sun4m_ipi_mask_one,
+ .func_call = sun4m_ipi_func_call,
};

void __init sun4m_init_smp(void)
--
1.8.1.2

2013-09-11 16:10:22

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 17/25] smp, sh: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/sh/include/asm/smp.h | 1 -
arch/sh/kernel/smp.c | 5 +----
2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/sh/include/asm/smp.h b/arch/sh/include/asm/smp.h
index 78b0d0f4..93ce87b 100644
--- a/arch/sh/include/asm/smp.h
+++ b/arch/sh/include/asm/smp.h
@@ -25,7 +25,6 @@ extern int __cpu_logical_map[NR_CPUS];
enum {
SMP_MSG_FUNCTION,
SMP_MSG_RESCHEDULE,
- SMP_MSG_FUNCTION_SINGLE,
SMP_MSG_TIMER,

SMP_MSG_NR, /* must be last */
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 86a7936..c944d5d 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -282,7 +282,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
- mp_ops->send_ipi(cpu, SMP_MSG_FUNCTION_SINGLE);
+ mp_ops->send_ipi(cpu, SMP_MSG_FUNCTION);
}

void smp_timer_broadcast(const struct cpumask *mask)
@@ -309,9 +309,6 @@ void smp_message_recv(unsigned int msg)
case SMP_MSG_RESCHEDULE:
scheduler_ipi();
break;
- case SMP_MSG_FUNCTION_SINGLE:
- generic_smp_call_function_single_interrupt();
- break;
case SMP_MSG_TIMER:
ipi_timer();
break;
--
1.8.1.2

2013-09-11 16:11:04

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 20/25] smp, tile: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/tile/include/asm/smp.h | 7 +++----
arch/tile/kernel/smp.c | 6 +-----
2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/arch/tile/include/asm/smp.h b/arch/tile/include/asm/smp.h
index 1aa759a..4b39184 100644
--- a/arch/tile/include/asm/smp.h
+++ b/arch/tile/include/asm/smp.h
@@ -67,19 +67,18 @@ static inline int xy_to_cpu(int x, int y)
/* Hypervisor message tags sent via the tile send_IPI*() routines. */
#define MSG_TAG_START_CPU 1
#define MSG_TAG_STOP_CPU 2
-#define MSG_TAG_CALL_FUNCTION_MANY 3
-#define MSG_TAG_CALL_FUNCTION_SINGLE 4
+#define MSG_TAG_CALL_FUNCTION 3

/* Hook for the generic smp_call_function_many() routine. */
static inline void arch_send_call_function_ipi_mask(struct cpumask *mask)
{
- send_IPI_many(mask, MSG_TAG_CALL_FUNCTION_MANY);
+ send_IPI_many(mask, MSG_TAG_CALL_FUNCTION);
}

/* Hook for the generic smp_call_function_single() routine. */
static inline void arch_send_call_function_single_ipi(int cpu)
{
- send_IPI_single(cpu, MSG_TAG_CALL_FUNCTION_SINGLE);
+ send_IPI_single(cpu, MSG_TAG_CALL_FUNCTION);
}

/* Print out the boot string describing which cpus were disabled. */
diff --git a/arch/tile/kernel/smp.c b/arch/tile/kernel/smp.c
index cbc73a8..44d7132 100644
--- a/arch/tile/kernel/smp.c
+++ b/arch/tile/kernel/smp.c
@@ -134,14 +134,10 @@ void evaluate_message(int tag)
smp_stop_cpu_interrupt();
break;

- case MSG_TAG_CALL_FUNCTION_MANY: /* Call function on cpumask */
+ case MSG_TAG_CALL_FUNCTION: /* Call function on cpumask */
generic_smp_call_function_interrupt();
break;

- case MSG_TAG_CALL_FUNCTION_SINGLE: /* Call function on one other CPU */
- generic_smp_call_function_single_interrupt();
- break;
-
default:
panic("Unknown IPI message tag %d", tag);
break;
--
1.8.1.2

2013-09-11 16:11:10

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 21/25] smp, tile: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/x86/include/asm/xen/events.h | 1 -
arch/x86/xen/smp.c | 38 ++------------------------------------
2 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/arch/x86/include/asm/xen/events.h b/arch/x86/include/asm/xen/events.h
index ca842f2..b1ba559 100644
--- a/arch/x86/include/asm/xen/events.h
+++ b/arch/x86/include/asm/xen/events.h
@@ -4,7 +4,6 @@
enum ipi_vector {
XEN_RESCHEDULE_VECTOR,
XEN_CALL_FUNCTION_VECTOR,
- XEN_CALL_FUNCTION_SINGLE_VECTOR,
XEN_SPIN_UNLOCK_VECTOR,
XEN_IRQ_WORK_VECTOR,

diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index ca92754..6a75302 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -46,12 +46,10 @@ struct xen_common_irq {
};
static DEFINE_PER_CPU(struct xen_common_irq, xen_resched_irq) = { .irq = -1 };
static DEFINE_PER_CPU(struct xen_common_irq, xen_callfunc_irq) = { .irq = -1 };
-static DEFINE_PER_CPU(struct xen_common_irq, xen_callfuncsingle_irq) = { .irq = -1 };
static DEFINE_PER_CPU(struct xen_common_irq, xen_irq_work) = { .irq = -1 };
static DEFINE_PER_CPU(struct xen_common_irq, xen_debug_irq) = { .irq = -1 };

static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id);
-static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id);
static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id);

/*
@@ -123,13 +121,6 @@ static void xen_smp_intr_free(unsigned int cpu)
kfree(per_cpu(xen_debug_irq, cpu).name);
per_cpu(xen_debug_irq, cpu).name = NULL;
}
- if (per_cpu(xen_callfuncsingle_irq, cpu).irq >= 0) {
- unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu).irq,
- NULL);
- per_cpu(xen_callfuncsingle_irq, cpu).irq = -1;
- kfree(per_cpu(xen_callfuncsingle_irq, cpu).name);
- per_cpu(xen_callfuncsingle_irq, cpu).name = NULL;
- }
if (xen_hvm_domain())
return;

@@ -178,18 +169,6 @@ static int xen_smp_intr_init(unsigned int cpu)
per_cpu(xen_debug_irq, cpu).irq = rc;
per_cpu(xen_debug_irq, cpu).name = debug_name;

- callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu);
- rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
- cpu,
- xen_call_function_single_interrupt,
- IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING,
- callfunc_name,
- NULL);
- if (rc < 0)
- goto fail;
- per_cpu(xen_callfuncsingle_irq, cpu).irq = rc;
- per_cpu(xen_callfuncsingle_irq, cpu).name = callfunc_name;
-
/*
* The IRQ worker on PVHVM goes through the native path and uses the
* IPI mechanism.
@@ -551,8 +530,7 @@ static void xen_smp_send_call_function_ipi(const struct cpumask *mask)

static void xen_smp_send_call_function_single_ipi(int cpu)
{
- __xen_send_IPI_mask(cpumask_of(cpu),
- XEN_CALL_FUNCTION_SINGLE_VECTOR);
+ __xen_send_IPI_mask(cpumask_of(cpu), XEN_CALL_FUNCTION_VECTOR);
}

static inline int xen_map_vector(int vector)
@@ -564,10 +542,8 @@ static inline int xen_map_vector(int vector)
xen_vector = XEN_RESCHEDULE_VECTOR;
break;
case CALL_FUNCTION_VECTOR:
- xen_vector = XEN_CALL_FUNCTION_VECTOR;
- break;
case CALL_FUNCTION_SINGLE_VECTOR:
- xen_vector = XEN_CALL_FUNCTION_SINGLE_VECTOR;
+ xen_vector = XEN_CALL_FUNCTION_VECTOR;
break;
case IRQ_WORK_VECTOR:
xen_vector = XEN_IRQ_WORK_VECTOR;
@@ -639,16 +615,6 @@ static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}

-static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
-{
- irq_enter();
- generic_smp_call_function_single_interrupt();
- inc_irq_stat(irq_call_count);
- irq_exit();
-
- return IRQ_HANDLED;
-}
-
static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id)
{
irq_enter();
--
1.8.1.2

2013-09-11 16:11:29

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 22/25] smp, x86: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/x86/include/asm/entry_arch.h | 1 -
arch/x86/include/asm/hw_irq.h | 3 ---
arch/x86/include/asm/irq_vectors.h | 7 +++----
arch/x86/include/asm/trace/irq_vectors.h | 6 ------
arch/x86/kernel/entry_64.S | 2 --
arch/x86/kernel/irqinit.c | 4 ----
arch/x86/kernel/smp.c | 24 +-----------------------
arch/x86/xen/smp.c | 1 -
8 files changed, 4 insertions(+), 44 deletions(-)

diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h
index dc5fa66..9670cff 100644
--- a/arch/x86/include/asm/entry_arch.h
+++ b/arch/x86/include/asm/entry_arch.h
@@ -12,7 +12,6 @@
#ifdef CONFIG_SMP
BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR)
BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR)
-BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR)
BUILD_INTERRUPT3(irq_move_cleanup_interrupt, IRQ_MOVE_CLEANUP_VECTOR,
smp_irq_move_cleanup_interrupt)
BUILD_INTERRUPT3(reboot_interrupt, REBOOT_VECTOR, smp_reboot_interrupt)
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index e4ac559..907cffe 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -75,7 +75,6 @@ extern void reboot_interrupt(void);
extern void threshold_interrupt(void);

extern void call_function_interrupt(void);
-extern void call_function_single_interrupt(void);

#ifdef CONFIG_TRACING
/* Interrupt handlers registered during init_IRQ */
@@ -88,7 +87,6 @@ extern void trace_thermal_interrupt(void);
extern void trace_reschedule_interrupt(void);
extern void trace_threshold_interrupt(void);
extern void trace_call_function_interrupt(void);
-extern void trace_call_function_single_interrupt(void);
#define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt
#define trace_reboot_interrupt reboot_interrupt
#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
@@ -182,7 +180,6 @@ extern asmlinkage void smp_irq_move_cleanup_interrupt(void);
#ifdef CONFIG_SMP
extern void smp_reschedule_interrupt(struct pt_regs *);
extern void smp_call_function_interrupt(struct pt_regs *);
-extern void smp_call_function_single_interrupt(struct pt_regs *);
#ifdef CONFIG_X86_32
extern void smp_invalidate_interrupt(struct pt_regs *);
#else
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 5702d7e..98a302d 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -92,10 +92,9 @@
#define ERROR_APIC_VECTOR 0xfe
#define RESCHEDULE_VECTOR 0xfd
#define CALL_FUNCTION_VECTOR 0xfc
-#define CALL_FUNCTION_SINGLE_VECTOR 0xfb
-#define THERMAL_APIC_VECTOR 0xfa
-#define THRESHOLD_APIC_VECTOR 0xf9
-#define REBOOT_VECTOR 0xf8
+#define THERMAL_APIC_VECTOR 0xfb
+#define THRESHOLD_APIC_VECTOR 0xfa
+#define REBOOT_VECTOR 0xf9

/*
* Generic system vector for platform specific use
diff --git a/arch/x86/include/asm/trace/irq_vectors.h b/arch/x86/include/asm/trace/irq_vectors.h
index 2874df2..f96dc1b 100644
--- a/arch/x86/include/asm/trace/irq_vectors.h
+++ b/arch/x86/include/asm/trace/irq_vectors.h
@@ -78,12 +78,6 @@ DEFINE_IRQ_VECTOR_EVENT(irq_work);
DEFINE_IRQ_VECTOR_EVENT(call_function);

/*
- * call_function_single - called when entering/exiting a call function
- * single interrupt vector handler
- */
-DEFINE_IRQ_VECTOR_EVENT(call_function_single);
-
-/*
* threshold_apic - called when entering/exiting a threshold apic interrupt
* vector handler
*/
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 1b69951..6d296f1 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1199,8 +1199,6 @@ apicinterrupt THERMAL_APIC_VECTOR \
#endif

#ifdef CONFIG_SMP
-apicinterrupt CALL_FUNCTION_SINGLE_VECTOR \
- call_function_single_interrupt smp_call_function_single_interrupt
apicinterrupt CALL_FUNCTION_VECTOR \
call_function_interrupt smp_call_function_interrupt
apicinterrupt RESCHEDULE_VECTOR \
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index a2a1fbc..4aa1b8c 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -141,10 +141,6 @@ static void __init smp_intr_init(void)
/* IPI for generic function call */
alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);

- /* IPI for generic single function call */
- alloc_intr_gate(CALL_FUNCTION_SINGLE_VECTOR,
- call_function_single_interrupt);
-
/* Low priority IPI to cleanup after moving an irq */
set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
set_bit(IRQ_MOVE_CLEANUP_VECTOR, used_vectors);
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index cdaa347..b631e72 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -129,7 +129,7 @@ static void native_smp_send_reschedule(int cpu)

void native_send_call_func_single_ipi(int cpu)
{
- apic->send_IPI_mask(cpumask_of(cpu), CALL_FUNCTION_SINGLE_VECTOR);
+ apic->send_IPI_mask(cpumask_of(cpu), CALL_FUNCTION_VECTOR);
}

void native_send_call_func_ipi(const struct cpumask *mask)
@@ -311,28 +311,6 @@ void smp_trace_call_function_interrupt(struct pt_regs *regs)
exiting_irq();
}

-static inline void __smp_call_function_single_interrupt(void)
-{
- generic_smp_call_function_single_interrupt();
- inc_irq_stat(irq_call_count);
-}
-
-void smp_call_function_single_interrupt(struct pt_regs *regs)
-{
- smp_entering_irq();
- __smp_call_function_single_interrupt();
- exiting_irq();
-}
-
-void smp_trace_call_function_single_interrupt(struct pt_regs *regs)
-{
- smp_entering_irq();
- trace_call_function_single_entry(CALL_FUNCTION_SINGLE_VECTOR);
- __smp_call_function_single_interrupt();
- trace_call_function_single_exit(CALL_FUNCTION_SINGLE_VECTOR);
- exiting_irq();
-}
-
static int __init nonmi_ipi_setup(char *str)
{
smp_no_nmi_ipi = true;
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 6a75302..a67b835 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -542,7 +542,6 @@ static inline int xen_map_vector(int vector)
xen_vector = XEN_RESCHEDULE_VECTOR;
break;
case CALL_FUNCTION_VECTOR:
- case CALL_FUNCTION_SINGLE_VECTOR:
xen_vector = XEN_CALL_FUNCTION_VECTOR;
break;
case IRQ_WORK_VECTOR:
--
1.8.1.2

2013-09-11 16:11:34

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 23/25] smp: cleanup unsued generic_smp_call_function_single_interrupt()

From: Jiang Liu <[email protected]>

Now we have killed all usage of generic_smp_call_function_single_interrupt()
from arch code, so kill it.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
include/linux/smp.h | 4 +---
kernel/smp.c | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index c181399..3b6226c 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -87,9 +87,7 @@ void kick_all_cpus_sync(void);
*/
#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
void __init call_function_init(void);
-void generic_smp_call_function_single_interrupt(void);
-#define generic_smp_call_function_interrupt \
- generic_smp_call_function_single_interrupt
+void generic_smp_call_function_interrupt(void);
#else
static inline void call_function_init(void) { }
#endif
diff --git a/kernel/smp.c b/kernel/smp.c
index a034712..9fbf12a 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -165,7 +165,7 @@ void generic_exec_single(int cpu, struct call_single_data *csd, int wait)
* Invoked by arch to handle an IPI for call function single. Must be
* called from the arch with interrupts disabled.
*/
-void generic_smp_call_function_single_interrupt(void)
+void generic_smp_call_function_interrupt(void)
{
struct call_single_queue *q = &__get_cpu_var(call_single_queue);
LIST_HEAD(list);
--
1.8.1.2

2013-09-11 16:11:39

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 24/25] smp: rename call_single_queue as call_function_queue

From: Jiang Liu <[email protected]>

Now the same list is used to serve both single and multiple function
call requests, so rename call_single_queue as call_function_queue.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
kernel/smp.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index 9fbf12a..f4affa4 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -27,12 +27,12 @@ struct call_function_data {

static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data);

-struct call_single_queue {
+struct call_function_queue {
struct list_head list;
raw_spinlock_t lock;
};

-static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_single_queue, call_single_queue);
+static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_queue, call_function_queue);

static int
hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
@@ -75,11 +75,11 @@ static struct notifier_block hotplug_cfd_notifier = {
void __init call_function_init(void)
{
void *cpu = (void *)(long)smp_processor_id();
+ struct call_function_queue *q;
int i;

for_each_possible_cpu(i) {
- struct call_single_queue *q = &per_cpu(call_single_queue, i);
-
+ q = &per_cpu(call_function_queue, i);
raw_spin_lock_init(&q->lock);
INIT_LIST_HEAD(&q->list);
}
@@ -134,7 +134,7 @@ static void csd_unlock(struct call_single_data *csd)
static
void generic_exec_single(int cpu, struct call_single_data *csd, int wait)
{
- struct call_single_queue *dst = &per_cpu(call_single_queue, cpu);
+ struct call_function_queue *dst = &per_cpu(call_function_queue, cpu);
unsigned long flags;
int ipi;

@@ -162,12 +162,12 @@ void generic_exec_single(int cpu, struct call_single_data *csd, int wait)
}

/*
- * Invoked by arch to handle an IPI for call function single. Must be
+ * Invoked by arch to handle an IPI for call function. Must be
* called from the arch with interrupts disabled.
*/
void generic_smp_call_function_interrupt(void)
{
- struct call_single_queue *q = &__get_cpu_var(call_single_queue);
+ struct call_function_queue *q = &__get_cpu_var(call_function_queue);
LIST_HEAD(list);

/*
@@ -407,8 +407,8 @@ void smp_call_function_many(const struct cpumask *mask,

for_each_cpu(cpu, cfd->cpumask) {
struct call_single_data *csd = per_cpu_ptr(cfd->csd, cpu);
- struct call_single_queue *dst =
- &per_cpu(call_single_queue, cpu);
+ struct call_function_queue *dst =
+ &per_cpu(call_function_queue, cpu);
unsigned long flags;

csd_lock(csd);
--
1.8.1.2

2013-09-11 16:11:43

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 25/25] SMP, trivial: remove unused code from smp_boot.h

From: Jiang Liu <[email protected]>

Function smpboot_thread_schedule() is never defined or used,
so remove it from smp_boot.h.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
include/linux/smpboot.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index 13e9296..d600afb 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -47,6 +47,5 @@ struct smp_hotplug_thread {

int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
-int smpboot_thread_schedule(void);

#endif
--
1.8.1.2

2013-09-11 16:10:05

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 14/25] smp, parisc: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/parisc/kernel/smp.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 8a252f2..2b96602 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -72,7 +72,6 @@ enum ipi_message_type {
IPI_NOP=0,
IPI_RESCHEDULE=1,
IPI_CALL_FUNC,
- IPI_CALL_FUNC_SINGLE,
IPI_CPU_START,
IPI_CPU_STOP,
IPI_CPU_TEST
@@ -164,11 +163,6 @@ ipi_interrupt(int irq, void *dev_id)
generic_smp_call_function_interrupt();
break;

- case IPI_CALL_FUNC_SINGLE:
- smp_debug(100, KERN_DEBUG "CPU%d IPI_CALL_FUNC_SINGLE\n", this_cpu);
- generic_smp_call_function_single_interrupt();
- break;
-
case IPI_CPU_START:
smp_debug(100, KERN_DEBUG "CPU%d IPI_CPU_START\n", this_cpu);
break;
@@ -260,7 +254,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
- send_IPI_single(cpu, IPI_CALL_FUNC_SINGLE);
+ send_IPI_single(cpu, IPI_CALL_FUNC);
}

/*
--
1.8.1.2

2013-09-11 16:14:49

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 13/25] smp, mn10300: enable arch_send_call_function_ipi_mask()

From: Jiang Liu <[email protected]>

Enable arch_send_call_function_ipi_mask() on mn10300 to support
smp_call_function_many().

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/mn10300/kernel/smp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c
index 7ae353d..b827b68 100644
--- a/arch/mn10300/kernel/smp.c
+++ b/arch/mn10300/kernel/smp.c
@@ -356,8 +356,7 @@ void send_IPI_allbutself(int irq)

void arch_send_call_function_ipi_mask(const struct cpumask *mask)
{
- BUG();
- /*send_IPI_mask(mask, CALL_FUNCTION_IPI);*/
+ send_IPI_mask(mask, CALL_FUNC_IPI);
}

void arch_send_call_function_single_ipi(int cpu)
--
1.8.1.2

2013-09-11 16:08:17

by Jiang Liu

[permalink] [raw]
Subject: [RFC PATCH v2 02/25] smp, alpha: kill SMP single function call interrupt

From: Jiang Liu <[email protected]>

Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
similar to smp_call_function_single()" has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Jiang Liu <[email protected]>
---
arch/alpha/kernel/smp.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 9dbbcb3..71d5c7d 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -63,7 +63,6 @@ static struct {
enum ipi_message_type {
IPI_RESCHEDULE,
IPI_CALL_FUNC,
- IPI_CALL_FUNC_SINGLE,
IPI_CPU_STOP,
};

@@ -498,7 +497,6 @@ smp_cpus_done(unsigned int max_cpus)
((bogosum + 2500) / (5000/HZ)) % 100);
}

-
void
smp_percpu_timer_interrupt(struct pt_regs *regs)
{
@@ -533,7 +531,6 @@ setup_profiling_timer(unsigned int multiplier)
return -EINVAL;
}

-
static void
send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation)
{
@@ -579,10 +576,6 @@ handle_ipi(struct pt_regs *regs)
generic_smp_call_function_interrupt();
break;

- case IPI_CALL_FUNC_SINGLE:
- generic_smp_call_function_single_interrupt();
- break;
-
case IPI_CPU_STOP:
halt();

@@ -633,7 +626,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
- send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
+ send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC);
}

static void
--
1.8.1.2

2013-09-11 16:52:41

by Chris Metcalf

[permalink] [raw]
Subject: Re: [RFC PATCH v2 20/25] smp, tile: kill SMP single function call interrupt

On 9/11/2013 12:07 PM, Jiang Liu wrote:
> From: Jiang Liu <[email protected]>
>
> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
> similar to smp_call_function_single()" has unified the way to handle
> single and multiple cross-CPU function calls. Now only one interrupt
> is needed for architecture specific code to support generic SMP function
> call interfaces, so kill the redundant single function call interrupt.
>
> Signed-off-by: Jiang Liu <[email protected]>
> Cc: Jiang Liu <[email protected]>

Acked-by: Chris Metcalf <[email protected]>

--
Chris Metcalf, Tilera Corp.
http://www.tilera.com

2013-09-11 20:07:25

by Srivatsa S. Bhat

[permalink] [raw]
Subject: Re: [RFC PATCH v2 15/25] smp, ppc: kill SMP single function call interrupt

On 09/11/2013 09:37 PM, Jiang Liu wrote:
> From: Jiang Liu <[email protected]>
>
> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
> similar to smp_call_function_single()" has unified the way to handle
> single and multiple cross-CPU function calls. Now only one interrupt
> is needed for architecture specific code to support generic SMP function
> call interfaces, so kill the redundant single function call interrupt.
>
> Signed-off-by: Jiang Liu <[email protected]>
> Cc: Jiang Liu <[email protected]>
> ---

It turns out that freeing up the IPI slot in powerpc is very useful, since
we actually wanted a slot for some other use-case (and there are only 4 slots
available on powerpc).

Here are the patches which achieve that:
http://marc.info/?l=linuxppc-embedded&m=137886807502898&w=2
http://marc.info/?l=linuxppc-embedded&m=137886811502909&w=2

So, can you kindly consider dropping the powerpc patch from your series,
if that is OK with you? Thanks!

BTW, after doing the powerpc cleanup, even I had thought about killing one
of the smp-function variants in various architectures, but never got around
to do it. But now that you have posted the series which does that, I'll try
to review them.

Thank you!

Regards,
Srivatsa S. Bhat

> arch/powerpc/include/asm/smp.h | 3 +--
> arch/powerpc/kernel/smp.c | 12 +-----------
> 2 files changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
> index 48cfc85..53faa03 100644
> --- a/arch/powerpc/include/asm/smp.h
> +++ b/arch/powerpc/include/asm/smp.h
> @@ -119,8 +119,7 @@ extern int cpu_to_core_id(int cpu);
> * in /proc/interrupts will be wrong!!! --Troy */
> #define PPC_MSG_CALL_FUNCTION 0
> #define PPC_MSG_RESCHEDULE 1
> -#define PPC_MSG_CALL_FUNC_SINGLE 2
> -#define PPC_MSG_DEBUGGER_BREAK 3
> +#define PPC_MSG_DEBUGGER_BREAK 2
>
> /* for irq controllers that have dedicated ipis per message (4) */
> extern int smp_request_message_ipi(int virq, int message);
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 38b0ba6..0c53b10 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -123,12 +123,6 @@ static irqreturn_t reschedule_action(int irq, void *data)
> return IRQ_HANDLED;
> }
>
> -static irqreturn_t call_function_single_action(int irq, void *data)
> -{
> - generic_smp_call_function_single_interrupt();
> - return IRQ_HANDLED;
> -}
> -
> static irqreturn_t debug_ipi_action(int irq, void *data)
> {
> if (crash_ipi_function_ptr) {
> @@ -146,14 +140,12 @@ static irqreturn_t debug_ipi_action(int irq, void *data)
> static irq_handler_t smp_ipi_action[] = {
> [PPC_MSG_CALL_FUNCTION] = call_function_action,
> [PPC_MSG_RESCHEDULE] = reschedule_action,
> - [PPC_MSG_CALL_FUNC_SINGLE] = call_function_single_action,
> [PPC_MSG_DEBUGGER_BREAK] = debug_ipi_action,
> };
>
> const char *smp_ipi_name[] = {
> [PPC_MSG_CALL_FUNCTION] = "ipi call function",
> [PPC_MSG_RESCHEDULE] = "ipi reschedule",
> - [PPC_MSG_CALL_FUNC_SINGLE] = "ipi call function single",
> [PPC_MSG_DEBUGGER_BREAK] = "ipi debugger",
> };
>
> @@ -225,8 +217,6 @@ irqreturn_t smp_ipi_demux(void)
> generic_smp_call_function_interrupt();
> if (all & (1 << (24 - 8 * PPC_MSG_RESCHEDULE)))
> scheduler_ipi();
> - if (all & (1 << (24 - 8 * PPC_MSG_CALL_FUNC_SINGLE)))
> - generic_smp_call_function_single_interrupt();
> if (all & (1 << (24 - 8 * PPC_MSG_DEBUGGER_BREAK)))
> debug_ipi_action(0, NULL);
> #else
> @@ -257,7 +247,7 @@ EXPORT_SYMBOL_GPL(smp_send_reschedule);
>
> void arch_send_call_function_single_ipi(int cpu)
> {
> - do_message_pass(cpu, PPC_MSG_CALL_FUNC_SINGLE);
> + do_message_pass(cpu, PPC_MSG_CALL_FUNCTION);
> }
>
> void arch_send_call_function_ipi_mask(const struct cpumask *mask)
>

2013-09-12 08:44:24

by Paul Mundt

[permalink] [raw]
Subject: Re: [RFC PATCH v2 17/25] smp, sh: kill SMP single function call interrupt

On Thu, Sep 12, 2013 at 12:07:21AM +0800, Jiang Liu wrote:
> From: Jiang Liu <[email protected]>
>
> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
> similar to smp_call_function_single()" has unified the way to handle
> single and multiple cross-CPU function calls. Now only one interrupt
> is needed for architecture specific code to support generic SMP function
> call interfaces, so kill the redundant single function call interrupt.
>
> Signed-off-by: Jiang Liu <[email protected]>
> Cc: Jiang Liu <[email protected]>

Acked-by: Paul Mundt <[email protected]>

2013-09-12 09:14:17

by Will Deacon

[permalink] [raw]
Subject: Re: [RFC PATCH v2 04/25] smp, ARM: kill SMP single function call interrupt

On Wed, Sep 11, 2013 at 05:07:08PM +0100, Jiang Liu wrote:
> From: Jiang Liu <[email protected]>
>
> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
> similar to smp_call_function_single()" has unified the way to handle
> single and multiple cross-CPU function calls. Now only one interrupt
> is needed for architecture specific code to support generic SMP function
> call interfaces, so kill the redundant single function call interrupt.

Acked-by: Will Deacon <[email protected]>

Will

2013-09-12 09:14:32

by Will Deacon

[permalink] [raw]
Subject: Re: [RFC PATCH v2 05/25] smp, ARM64: kill SMP single function call interrupt

On Wed, Sep 11, 2013 at 05:07:09PM +0100, Jiang Liu wrote:
> From: Jiang Liu <[email protected]>
>
> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
> similar to smp_call_function_single()" has unified the way to handle
> single and multiple cross-CPU function calls. Now only one interrupt
> is needed for architecture specific code to support generic SMP function
> call interfaces, so kill the redundant single function call interrupt.

Acked-by: Will Deacon <[email protected]>

Will

2013-09-12 11:15:08

by James Hogan

[permalink] [raw]
Subject: Re: [RFC PATCH v2 10/25] smp, metag: kill SMP single function call interrupt

On 11/09/13 17:07, Jiang Liu wrote:
> From: Jiang Liu <[email protected]>
>
> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
> similar to smp_call_function_single()" has unified the way to handle
> single and multiple cross-CPU function calls. Now only one interrupt
> is needed for architecture specific code to support generic SMP function
> call interfaces, so kill the redundant single function call interrupt.
>
> Signed-off-by: Jiang Liu <[email protected]>
> Cc: Jiang Liu <[email protected]>

Seems to work.

Acked-by: James Hogan <[email protected]>

Cheers
James

> ---
> arch/metag/include/asm/smp.h | 2 --
> arch/metag/kernel/smp.c | 6 +-----
> 2 files changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/arch/metag/include/asm/smp.h b/arch/metag/include/asm/smp.h
> index e0373f8..1d7e770 100644
> --- a/arch/metag/include/asm/smp.h
> +++ b/arch/metag/include/asm/smp.h
> @@ -7,13 +7,11 @@
>
> enum ipi_msg_type {
> IPI_CALL_FUNC,
> - IPI_CALL_FUNC_SINGLE,
> IPI_RESCHEDULE,
> };
>
> extern void arch_send_call_function_single_ipi(int cpu);
> extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
> -#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask
>
> asmlinkage void secondary_start_kernel(void);
>
> diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c
> index 7c01131..5b3933b4 100644
> --- a/arch/metag/kernel/smp.c
> +++ b/arch/metag/kernel/smp.c
> @@ -491,7 +491,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
>
> void arch_send_call_function_single_ipi(int cpu)
> {
> - send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
> + send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC);
> }
>
> void show_ipi_list(struct seq_file *p)
> @@ -546,10 +546,6 @@ static int do_IPI(struct pt_regs *regs)
> generic_smp_call_function_interrupt();
> break;
>
> - case IPI_CALL_FUNC_SINGLE:
> - generic_smp_call_function_single_interrupt();
> - break;
> -
> default:
> pr_crit("CPU%u: Unknown IPI message 0x%lx\n",
> cpu, nextmsg);
>

2013-09-12 14:05:00

by Jiang Liu

[permalink] [raw]
Subject: Re: [RFC PATCH v2 15/25] smp, ppc: kill SMP single function call interrupt

On 09/12/2013 04:03 AM, Srivatsa S. Bhat wrote:
> On 09/11/2013 09:37 PM, Jiang Liu wrote:
>> From: Jiang Liu <[email protected]>
>>
>> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
>> similar to smp_call_function_single()" has unified the way to handle
>> single and multiple cross-CPU function calls. Now only one interrupt
>> is needed for architecture specific code to support generic SMP function
>> call interfaces, so kill the redundant single function call interrupt.
>>
>> Signed-off-by: Jiang Liu <[email protected]>
>> Cc: Jiang Liu <[email protected]>
>> ---
>
> It turns out that freeing up the IPI slot in powerpc is very useful, since
> we actually wanted a slot for some other use-case (and there are only 4 slots
> available on powerpc).
>
> Here are the patches which achieve that:
> http://marc.info/?l=linuxppc-embedded&m=137886807502898&w=2
> http://marc.info/?l=linuxppc-embedded&m=137886811502909&w=2
Hi Srivatsa,
That's great and I will drop this patch from my series.
Could you please to kill call_function_single_action() instead of
call_function_action()? Please refer to
http://lkml.org/lkml/2013/9/11/579
Regards!
Gerry

>
> So, can you kindly consider dropping the powerpc patch from your series,
> if that is OK with you? Thanks!
>
> BTW, after doing the powerpc cleanup, even I had thought about killing one
> of the smp-function variants in various architectures, but never got around
> to do it. But now that you have posted the series which does that, I'll try
> to review them.
>
> Thank you!
>
> Regards,
> Srivatsa S. Bhat
>
>> arch/powerpc/include/asm/smp.h | 3 +--
>> arch/powerpc/kernel/smp.c | 12 +-----------
>> 2 files changed, 2 insertions(+), 13 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
>> index 48cfc85..53faa03 100644
>> --- a/arch/powerpc/include/asm/smp.h
>> +++ b/arch/powerpc/include/asm/smp.h
>> @@ -119,8 +119,7 @@ extern int cpu_to_core_id(int cpu);
>> * in /proc/interrupts will be wrong!!! --Troy */
>> #define PPC_MSG_CALL_FUNCTION 0
>> #define PPC_MSG_RESCHEDULE 1
>> -#define PPC_MSG_CALL_FUNC_SINGLE 2
>> -#define PPC_MSG_DEBUGGER_BREAK 3
>> +#define PPC_MSG_DEBUGGER_BREAK 2
>>
>> /* for irq controllers that have dedicated ipis per message (4) */
>> extern int smp_request_message_ipi(int virq, int message);
>> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
>> index 38b0ba6..0c53b10 100644
>> --- a/arch/powerpc/kernel/smp.c
>> +++ b/arch/powerpc/kernel/smp.c
>> @@ -123,12 +123,6 @@ static irqreturn_t reschedule_action(int irq, void *data)
>> return IRQ_HANDLED;
>> }
>>
>> -static irqreturn_t call_function_single_action(int irq, void *data)
>> -{
>> - generic_smp_call_function_single_interrupt();
>> - return IRQ_HANDLED;
>> -}
>> -
>> static irqreturn_t debug_ipi_action(int irq, void *data)
>> {
>> if (crash_ipi_function_ptr) {
>> @@ -146,14 +140,12 @@ static irqreturn_t debug_ipi_action(int irq, void *data)
>> static irq_handler_t smp_ipi_action[] = {
>> [PPC_MSG_CALL_FUNCTION] = call_function_action,
>> [PPC_MSG_RESCHEDULE] = reschedule_action,
>> - [PPC_MSG_CALL_FUNC_SINGLE] = call_function_single_action,
>> [PPC_MSG_DEBUGGER_BREAK] = debug_ipi_action,
>> };
>>
>> const char *smp_ipi_name[] = {
>> [PPC_MSG_CALL_FUNCTION] = "ipi call function",
>> [PPC_MSG_RESCHEDULE] = "ipi reschedule",
>> - [PPC_MSG_CALL_FUNC_SINGLE] = "ipi call function single",
>> [PPC_MSG_DEBUGGER_BREAK] = "ipi debugger",
>> };
>>
>> @@ -225,8 +217,6 @@ irqreturn_t smp_ipi_demux(void)
>> generic_smp_call_function_interrupt();
>> if (all & (1 << (24 - 8 * PPC_MSG_RESCHEDULE)))
>> scheduler_ipi();
>> - if (all & (1 << (24 - 8 * PPC_MSG_CALL_FUNC_SINGLE)))
>> - generic_smp_call_function_single_interrupt();
>> if (all & (1 << (24 - 8 * PPC_MSG_DEBUGGER_BREAK)))
>> debug_ipi_action(0, NULL);
>> #else
>> @@ -257,7 +247,7 @@ EXPORT_SYMBOL_GPL(smp_send_reschedule);
>>
>> void arch_send_call_function_single_ipi(int cpu)
>> {
>> - do_message_pass(cpu, PPC_MSG_CALL_FUNC_SINGLE);
>> + do_message_pass(cpu, PPC_MSG_CALL_FUNCTION);
>> }
>>
>> void arch_send_call_function_ipi_mask(const struct cpumask *mask)
>>
>

2013-09-14 04:42:09

by Wang YanQing

[permalink] [raw]
Subject: Re: [PATCH v2 01/25] Revert smp: Fix SMP function call empty cpu mask race

On Thu, Sep 12, 2013 at 12:07:05AM +0800, Jiang Liu wrote:
> From: Jiang Liu <[email protected]>
>
> Commit f44310b98ddb7 "smp: Fix SMP function call empty cpu mask race"
> introduced field call_function_data->cpumask_ipi to resolve a race
> condition in smp_call_function_many().
>
> Later commit 9a46ad6d6df3 "smp: make smp_call_function_many() use logic
> similar to smp_call_function_single()" fixed the same issue in another
> way when optimizing smp_call_function_many(), which then obsoletes
> changes introduced by commit f44310b98ddb7. So revert it.
>
> Signed-off-by: Jiang Liu <[email protected]>
> Acked-by: Wang YanQing <[email protected]>
> Cc: Jiang Liu <[email protected]>
> ---
> kernel/smp.c | 16 ++--------------
> 1 file changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/kernel/smp.c b/kernel/smp.c
> index fe9f773..a034712 100644
> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -23,7 +23,6 @@ enum {
> struct call_function_data {
> struct call_single_data __percpu *csd;
> cpumask_var_t cpumask;
> - cpumask_var_t cpumask_ipi;
> };
>
> static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data);
> @@ -47,9 +46,6 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
> if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
> cpu_to_node(cpu)))
> return notifier_from_errno(-ENOMEM);
> - if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL,
> - cpu_to_node(cpu)))
> - return notifier_from_errno(-ENOMEM);
> cfd->csd = alloc_percpu(struct call_single_data);
> if (!cfd->csd) {
> free_cpumask_var(cfd->cpumask);
> @@ -64,7 +60,6 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
> case CPU_DEAD:
> case CPU_DEAD_FROZEN:
> free_cpumask_var(cfd->cpumask);
> - free_cpumask_var(cfd->cpumask_ipi);
> free_percpu(cfd->csd);
> break;
> #endif
> @@ -255,9 +250,9 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
> csd = &__get_cpu_var(csd_data);
>
> csd_lock(csd);
> -
> csd->func = func;
> csd->info = info;
> +
> generic_exec_single(cpu, csd, wait);
> } else {
> err = -ENXIO; /* CPU not online */
> @@ -410,13 +405,6 @@ void smp_call_function_many(const struct cpumask *mask,
> if (unlikely(!cpumask_weight(cfd->cpumask)))
> return;
>
> - /*
> - * After we put an entry into the list, cfd->cpumask may be cleared
> - * again when another CPU sends another IPI for a SMP function call, so
> - * cfd->cpumask will be zero.
> - */
> - cpumask_copy(cfd->cpumask_ipi, cfd->cpumask);
> -
> for_each_cpu(cpu, cfd->cpumask) {
> struct call_single_data *csd = per_cpu_ptr(cfd->csd, cpu);
> struct call_single_queue *dst =
> @@ -433,7 +421,7 @@ void smp_call_function_many(const struct cpumask *mask,
> }
>
> /* Send a message to all CPUs in the map */
> - arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
> + arch_send_call_function_ipi_mask(cfd->cpumask);
>
> if (wait) {
> for_each_cpu(cpu, cfd->cpumask) {
> --
> 1.8.1.2
Hi Liu and all

Commit 60c323699bb308404dcb60e8808531e02651578a
(kernel/smp.c: free related resources when failure occurs in hotplug_cfd())
is a fix patch for commit you revert, and it had been merged into mainline.

So could you ajust your patch to revert it together? I don't think we need
a separate patch to revert 60c323699bb308404dcb60e8808531e02651578a, because
your patch haven't be merged.

Thanks.

2013-09-14 04:43:26

by Wang YanQing

[permalink] [raw]
Subject: Re: [PATCH v2 01/25] Revert smp: Fix SMP function call empty cpu mask race

On Sat, Sep 14, 2013 at 12:41:36PM +0800, Wang YanQing wrote:
> On Thu, Sep 12, 2013 at 12:07:05AM +0800, Jiang Liu wrote:
> > From: Jiang Liu <[email protected]>
> >
> > Commit f44310b98ddb7 "smp: Fix SMP function call empty cpu mask race"
> > introduced field call_function_data->cpumask_ipi to resolve a race
> > condition in smp_call_function_many().
> >
> > Later commit 9a46ad6d6df3 "smp: make smp_call_function_many() use logic
> > similar to smp_call_function_single()" fixed the same issue in another
> > way when optimizing smp_call_function_many(), which then obsoletes
> > changes introduced by commit f44310b98ddb7. So revert it.
> >
> > Signed-off-by: Jiang Liu <[email protected]>
> > Acked-by: Wang YanQing <[email protected]>
> > Cc: Jiang Liu <[email protected]>
> > ---
> > kernel/smp.c | 16 ++--------------
> > 1 file changed, 2 insertions(+), 14 deletions(-)
> >
> > diff --git a/kernel/smp.c b/kernel/smp.c
> > index fe9f773..a034712 100644
> > --- a/kernel/smp.c
> > +++ b/kernel/smp.c
> > @@ -23,7 +23,6 @@ enum {
> > struct call_function_data {
> > struct call_single_data __percpu *csd;
> > cpumask_var_t cpumask;
> > - cpumask_var_t cpumask_ipi;
> > };
> >
> > static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data);
> > @@ -47,9 +46,6 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
> > if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
> > cpu_to_node(cpu)))
> > return notifier_from_errno(-ENOMEM);
> > - if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL,
> > - cpu_to_node(cpu)))
> > - return notifier_from_errno(-ENOMEM);
> > cfd->csd = alloc_percpu(struct call_single_data);
> > if (!cfd->csd) {
> > free_cpumask_var(cfd->cpumask);
> > @@ -64,7 +60,6 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
> > case CPU_DEAD:
> > case CPU_DEAD_FROZEN:
> > free_cpumask_var(cfd->cpumask);
> > - free_cpumask_var(cfd->cpumask_ipi);
> > free_percpu(cfd->csd);
> > break;
> > #endif
> > @@ -255,9 +250,9 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
> > csd = &__get_cpu_var(csd_data);
> >
> > csd_lock(csd);
> > -
> > csd->func = func;
> > csd->info = info;
> > +
> > generic_exec_single(cpu, csd, wait);
> > } else {
> > err = -ENXIO; /* CPU not online */
> > @@ -410,13 +405,6 @@ void smp_call_function_many(const struct cpumask *mask,
> > if (unlikely(!cpumask_weight(cfd->cpumask)))
> > return;
> >
> > - /*
> > - * After we put an entry into the list, cfd->cpumask may be cleared
> > - * again when another CPU sends another IPI for a SMP function call, so
> > - * cfd->cpumask will be zero.
> > - */
> > - cpumask_copy(cfd->cpumask_ipi, cfd->cpumask);
> > -
> > for_each_cpu(cpu, cfd->cpumask) {
> > struct call_single_data *csd = per_cpu_ptr(cfd->csd, cpu);
> > struct call_single_queue *dst =
> > @@ -433,7 +421,7 @@ void smp_call_function_many(const struct cpumask *mask,
> > }
> >
> > /* Send a message to all CPUs in the map */
> > - arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
> > + arch_send_call_function_ipi_mask(cfd->cpumask);
> >
> > if (wait) {
> > for_each_cpu(cpu, cfd->cpumask) {
> > --
> > 1.8.1.2
> Hi Liu and all
>
> Commit 60c323699bb308404dcb60e8808531e02651578a
> (kernel/smp.c: free related resources when failure occurs in hotplug_cfd())
> is a fix patch for commit you revert, and it had been merged into mainline.
>
> So could you ajust your patch to revert it together? I don't think we need
> a separate patch to revert 60c323699bb308404dcb60e8808531e02651578a, because
> your patch haven't be merged.
>
> Thanks.

Add Cc:[email protected]

2013-09-16 02:24:00

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH v2 01/25] Revert smp: Fix SMP function call empty cpu mask race

On 09/14/2013 12:43 PM, Wang YanQing wrote:
> On Sat, Sep 14, 2013 at 12:41:36PM +0800, Wang YanQing wrote:
>> On Thu, Sep 12, 2013 at 12:07:05AM +0800, Jiang Liu wrote:
>>> From: Jiang Liu <[email protected]>
>>>
>>> Commit f44310b98ddb7 "smp: Fix SMP function call empty cpu mask race"
>>> introduced field call_function_data->cpumask_ipi to resolve a race
>>> condition in smp_call_function_many().
>>>
>>> Later commit 9a46ad6d6df3 "smp: make smp_call_function_many() use logic
>>> similar to smp_call_function_single()" fixed the same issue in another
>>> way when optimizing smp_call_function_many(), which then obsoletes
>>> changes introduced by commit f44310b98ddb7. So revert it.
>>>
>>> Signed-off-by: Jiang Liu <[email protected]>
>>> Acked-by: Wang YanQing <[email protected]>
>>> Cc: Jiang Liu <[email protected]>
>>> ---
>>> kernel/smp.c | 16 ++--------------
>>> 1 file changed, 2 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/kernel/smp.c b/kernel/smp.c
>>> index fe9f773..a034712 100644
>>> --- a/kernel/smp.c
>>> +++ b/kernel/smp.c
>>> @@ -23,7 +23,6 @@ enum {
>>> struct call_function_data {
>>> struct call_single_data __percpu *csd;
>>> cpumask_var_t cpumask;
>>> - cpumask_var_t cpumask_ipi;
>>> };
>>>
>>> static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data);
>>> @@ -47,9 +46,6 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
>>> if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
>>> cpu_to_node(cpu)))
>>> return notifier_from_errno(-ENOMEM);
>>> - if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL,
>>> - cpu_to_node(cpu)))
>>> - return notifier_from_errno(-ENOMEM);
>>> cfd->csd = alloc_percpu(struct call_single_data);
>>> if (!cfd->csd) {
>>> free_cpumask_var(cfd->cpumask);
>>> @@ -64,7 +60,6 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
>>> case CPU_DEAD:
>>> case CPU_DEAD_FROZEN:
>>> free_cpumask_var(cfd->cpumask);
>>> - free_cpumask_var(cfd->cpumask_ipi);
>>> free_percpu(cfd->csd);
>>> break;
>>> #endif
>>> @@ -255,9 +250,9 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
>>> csd = &__get_cpu_var(csd_data);
>>>
>>> csd_lock(csd);
>>> -
>>> csd->func = func;
>>> csd->info = info;
>>> +
>>> generic_exec_single(cpu, csd, wait);
>>> } else {
>>> err = -ENXIO; /* CPU not online */
>>> @@ -410,13 +405,6 @@ void smp_call_function_many(const struct cpumask *mask,
>>> if (unlikely(!cpumask_weight(cfd->cpumask)))
>>> return;
>>>
>>> - /*
>>> - * After we put an entry into the list, cfd->cpumask may be cleared
>>> - * again when another CPU sends another IPI for a SMP function call, so
>>> - * cfd->cpumask will be zero.
>>> - */
>>> - cpumask_copy(cfd->cpumask_ipi, cfd->cpumask);
>>> -
>>> for_each_cpu(cpu, cfd->cpumask) {
>>> struct call_single_data *csd = per_cpu_ptr(cfd->csd, cpu);
>>> struct call_single_queue *dst =
>>> @@ -433,7 +421,7 @@ void smp_call_function_many(const struct cpumask *mask,
>>> }
>>>
>>> /* Send a message to all CPUs in the map */
>>> - arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
>>> + arch_send_call_function_ipi_mask(cfd->cpumask);
>>>
>>> if (wait) {
>>> for_each_cpu(cpu, cfd->cpumask) {
>>> --
>>> 1.8.1.2
>> Hi Liu and all
>>
>> Commit 60c323699bb308404dcb60e8808531e02651578a
>> (kernel/smp.c: free related resources when failure occurs in hotplug_cfd())
>> is a fix patch for commit you revert, and it had been merged into mainline.
>>
>> So could you ajust your patch to revert it together? I don't think we need
>> a separate patch to revert 60c323699bb308404dcb60e8808531e02651578a, because
>> your patch haven't be merged.
>>
>> Thanks.
>
> Add Cc:[email protected]

Thank you, and, I should continue trying to familiar with kernel step by
step.

> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>


--
Chen Gang

--
Chen Gang

2013-09-25 11:34:16

by Vineet Gupta

[permalink] [raw]
Subject: Re: [RFC PATCH v2 03/25] smp, ARC: kill SMP single function call interrupt

On 09/11/2013 09:37 PM, Jiang Liu wrote:
> From: Jiang Liu <[email protected]>
>
> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
> similar to smp_call_function_single()" has unified the way to handle
> single and multiple cross-CPU function calls. Now only one interrupt
> is needed for architecture specific code to support generic SMP function
> call interfaces, so kill the redundant single function call interrupt.
>
> Signed-off-by: Jiang Liu <[email protected]>
> Cc: Jiang Liu <[email protected]>

Verified that it works for ARC too.

Acked-by: Vineet Gupta <[email protected]>

Thx,
-Vineet

2013-10-22 10:08:17

by Vineet Gupta

[permalink] [raw]
Subject: Re: [RFC PATCH v2 02/25] smp, alpha: kill SMP single function call interrupt

Hi Jiang,

On 09/11/2013 09:37 PM, Jiang Liu wrote:
> From: Jiang Liu <[email protected]>
>
> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
> similar to smp_call_function_single()" has unified the way to handle
> single and multiple cross-CPU function calls. Now only one interrupt
> is needed for architecture specific code to support generic SMP function
> call interfaces, so kill the redundant single function call interrupt.
>
> Signed-off-by: Jiang Liu <[email protected]>

What's the status of this series - seemed useful to me. Are you planning to get it
merged in 3.13

-Vineet

2013-10-22 10:19:11

by Vineet Gupta

[permalink] [raw]
Subject: Re: [RFC PATCH v2 02/25] smp, alpha: kill SMP single function call interrupt

+CC gmail address, as the othe rone bounced !

On 10/22/2013 03:37 PM, Vineet Gupta wrote:
> Hi Jiang,
>
> On 09/11/2013 09:37 PM, Jiang Liu wrote:
>> From: Jiang Liu <[email protected]>
>>
>> Commit 9a46ad6d6df3b54 "smp: make smp_call_function_many() use logic
>> similar to smp_call_function_single()" has unified the way to handle
>> single and multiple cross-CPU function calls. Now only one interrupt
>> is needed for architecture specific code to support generic SMP function
>> call interfaces, so kill the redundant single function call interrupt.
>>
>> Signed-off-by: Jiang Liu <[email protected]>
>
> What's the status of this series - seemed useful to me. Are you planning to get it
> merged in 3.13
>
> -Vineet
>