linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	npiggin-l3A5Bk7waGM@public.gmane.org,
	torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org
Cc: peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org,
	Jens Axboe <jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	Ralf Baechle <ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
Subject: [PATCH 8/11] mips: convert to generic helpers for IPI function calls
Date: Tue, 22 Apr 2008 20:50:24 +0200	[thread overview]
Message-ID: <1208890227-24808-9-git-send-email-jens.axboe@oracle.com> (raw)
In-Reply-To: <1208890227-24808-1-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

This converts mips to use the new helpers for smp_call_function() and
friends, and adds support for smp_call_function_single(). Not tested,
but it compiles.

Cc: Ralf Baechle <ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
Signed-off-by: Jens Axboe <jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
 arch/mips/Kconfig              |    1 +
 arch/mips/kernel/smp-mt.c      |   27 ++++++++-
 arch/mips/kernel/smp.c         |  133 +++-------------------------------------
 arch/mips/kernel/smtc.c        |    7 ++
 arch/mips/sibyte/bcm1480/smp.c |    3 +
 arch/mips/sibyte/sb1250/smp.c  |    2 +
 include/asm-mips/smp.h         |   12 +---
 7 files changed, 49 insertions(+), 136 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 8724ed3..5092a9e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1742,6 +1742,7 @@ config SMP
 	bool "Multi-Processing support"
 	depends on SYS_SUPPORTS_SMP
 	select IRQ_PER_CPU
+	select USE_GENERIC_SMP_HELPERS
 	help
 	  This enables support for systems with more than one CPU. If you have
 	  a system with only one CPU, like most personal computers, say N. If
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 89e6f6a..31049fc 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -38,8 +38,9 @@
 
 #define MIPS_CPU_IPI_RESCHED_IRQ 0
 #define MIPS_CPU_IPI_CALL_IRQ 1
+#define MIPS_CPU_IPI_CALL_SINGLE_IRQ 2
 
-static int cpu_ipi_resched_irq, cpu_ipi_call_irq;
+static int cpu_ipi_resched_irq, cpu_ipi_call_irq, cpu_ipi_call_single_irq;
 
 #if 0
 static void dump_mtregisters(int vpe, int tc)
@@ -115,6 +116,11 @@ static void ipi_call_dispatch(void)
 	do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ);
 }
 
+static void ipi_call_single_dispatch(void)
+{
+	do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_SINGLE_IRQ);
+}
+
 static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
 {
 	return IRQ_HANDLED;
@@ -127,6 +133,13 @@ static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t ipi_call_single_interrupt(int irq, void *dev_id)
+{
+	smp_call_function_single_interrupt();
+
+	return IRQ_HANDLED;
+}
+
 static struct irqaction irq_resched = {
 	.handler	= ipi_resched_interrupt,
 	.flags		= IRQF_DISABLED|IRQF_PERCPU,
@@ -139,6 +152,12 @@ static struct irqaction irq_call = {
 	.name		= "IPI_call"
 };
 
+static struct irqaction irq_call_single = {
+	.handler	= ipi_call_single_interrupt,
+	.flags		= IRQF_DISABLED|IRQF_PERCPU,
+	.name		= "IPI_call_single"
+};
+
 static void __init smp_copy_vpe_config(void)
 {
 	write_vpe_c0_status(
@@ -376,16 +395,22 @@ static void __init vsmp_prepare_cpus(unsigned int max_cpus)
 	if (cpu_has_vint) {
 		set_vi_handler(MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch);
 		set_vi_handler(MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch);
+		set_vi_handler(MIPS_CPU_IPI_CALL_SINGLE_IRQ,
+					ipi_call_single_dispatch);
 	}
 
 	cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ;
 	cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ;
+	cpu_ipi_call_single_irq = MIPS_CPU_IRQ_BASE +
+						MIPS_CPU_IPI_CALL_SINGLE_IRQ;
 
 	setup_irq(cpu_ipi_resched_irq, &irq_resched);
 	setup_irq(cpu_ipi_call_irq, &irq_call);
+	setup_irq(cpu_ipi_call_single_irq, &irq_call_single);
 
 	set_irq_handler(cpu_ipi_resched_irq, handle_percpu_irq);
 	set_irq_handler(cpu_ipi_call_irq, handle_percpu_irq);
+	set_irq_handler(cpu_ipi_call_single_irq, handle_percpu_irq);
 }
 
 struct plat_smp_ops vsmp_smp_ops = {
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 9d41dab..931c0d9 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -128,145 +128,28 @@ asmlinkage __cpuinit void start_secondary(void)
 	cpu_idle();
 }
 
-DEFINE_SPINLOCK(smp_call_lock);
-
-struct call_data_struct *call_data;
-
-/*
- * Run a function on all other CPUs.
- *
- *  <mask>	cpuset_t of all processors to run the function on.
- *  <func>      The function to run. This must be fast and non-blocking.
- *  <info>      An arbitrary pointer to pass to the function.
- *  <retry>     If true, keep retrying until ready.
- *  <wait>      If true, wait until function has completed on other CPUs.
- *  [RETURNS]   0 on success, else a negative status code.
- *
- * Does not return until remote CPUs are nearly ready to execute <func>
- * or are or have executed.
- *
- * You must not call this function with disabled interrupts or from a
- * hardware interrupt handler or from a bottom half handler:
- *
- * CPU A                               CPU B
- * Disable interrupts
- *                                     smp_call_function()
- *                                     Take call_lock
- *                                     Send IPIs
- *                                     Wait for all cpus to acknowledge IPI
- *                                     CPU A has not responded, spin waiting
- *                                     for cpu A to respond, holding call_lock
- * smp_call_function()
- * Spin waiting for call_lock
- * Deadlock                            Deadlock
- */
-int smp_call_function_mask(cpumask_t mask, void (*func) (void *info),
-	void *info, int retry, int wait)
+void arch_send_call_function_ipi(cpumask_t mask)
 {
-	struct call_data_struct data;
-	int cpu = smp_processor_id();
-	int cpus;
-
-	/*
-	 * Can die spectacularly if this CPU isn't yet marked online
-	 */
-	BUG_ON(!cpu_online(cpu));
-
-	cpu_clear(cpu, mask);
-	cpus = cpus_weight(mask);
-	if (!cpus)
-		return 0;
-
-	/* Can deadlock when called with interrupts disabled */
-	WARN_ON(irqs_disabled());
-
-	data.func = func;
-	data.info = info;
-	atomic_set(&data.started, 0);
-	data.wait = wait;
-	if (wait)
-		atomic_set(&data.finished, 0);
-
-	spin_lock(&smp_call_lock);
-	call_data = &data;
-	smp_mb();
-
-	/* Send a message to all other CPUs and wait for them to respond */
 	mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
-
-	/* Wait for response */
-	/* FIXME: lock-up detection, backtrace on lock-up */
-	while (atomic_read(&data.started) != cpus)
-		barrier();
-
-	if (wait)
-		while (atomic_read(&data.finished) != cpus)
-			barrier();
-	call_data = NULL;
-	spin_unlock(&smp_call_lock);
-
-	return 0;
 }
 
-int smp_call_function(void (*func) (void *info), void *info, int retry,
-	int wait)
+void arch_send_call_function_single_ipi(int cpu)
 {
-	return smp_call_function_mask(cpu_online_map, func, info, retry, wait);
+	mp_ops->send_ipi_mask(cpumask_of_cpu(cpu), SMP_CALL_FUNCTION_SINGLE);
 }
 
 void smp_call_function_interrupt(void)
 {
-	void (*func) (void *info) = call_data->func;
-	void *info = call_data->info;
-	int wait = call_data->wait;
-
-	/*
-	 * Notify initiating CPU that I've grabbed the data and am
-	 * about to execute the function.
-	 */
-	smp_mb();
-	atomic_inc(&call_data->started);
-
-	/*
-	 * At this point the info structure may be out of scope unless wait==1.
-	 */
 	irq_enter();
-	(*func)(info);
+	generic_smp_call_function_interrupt();
 	irq_exit();
-
-	if (wait) {
-		smp_mb();
-		atomic_inc(&call_data->finished);
-	}
 }
 
-int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
-			     int retry, int wait)
+void smp_call_function_single_interrupt(void)
 {
-	int ret, me;
-
-	/*
-	 * Can die spectacularly if this CPU isn't yet marked online
-	 */
-	if (!cpu_online(cpu))
-		return 0;
-
-	me = get_cpu();
-	BUG_ON(!cpu_online(me));
-
-	if (cpu == me) {
-		local_irq_disable();
-		func(info);
-		local_irq_enable();
-		put_cpu();
-		return 0;
-	}
-
-	ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, retry,
-				     wait);
-
-	put_cpu();
-	return 0;
+	irq_enter();
+	generic_smp_call_function_single_interrupt();
+	irq_exit();
 }
 
 static void stop_this_cpu(void *dummy)
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index b42e71c..434605f 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -884,6 +884,10 @@ static void ipi_resched_interrupt(void)
 	/* Return from interrupt should be enough to cause scheduler check */
 }
 
+static void ipi_call_single_interrupt(void)
+{
+	smp_call_function_single_interrupt();
+}
 
 static void ipi_call_interrupt(void)
 {
@@ -924,6 +928,9 @@ void ipi_decode(struct smtc_ipi *pipi)
 		case SMP_CALL_FUNCTION:
 			ipi_call_interrupt();
 			break;
+		case SMP_CALL_FUNCTION_SINGLE:
+			ipi_call_single_interrupt();
+			break;
 		default:
 			printk("Impossible SMTC IPI Argument 0x%x\n",
 				(int)arg_copy);
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index bd9eeb4..76d36ff 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -29,6 +29,7 @@
 #include <asm/sibyte/bcm1480_int.h>
 
 extern void smp_call_function_interrupt(void);
+extern void smp_call_function_single_interrupt(void);
 
 /*
  * These are routines for dealing with the bcm1480 smp capabilities
@@ -194,4 +195,6 @@ void bcm1480_mailbox_interrupt(void)
 
 	if (action & SMP_CALL_FUNCTION)
 		smp_call_function_interrupt();
+	else if (action & SMP_CALL_FUNCTION_SINGLE)
+		smp_call_function_single_interrupt();
 }
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c
index 0734b93..8742127 100644
--- a/arch/mips/sibyte/sb1250/smp.c
+++ b/arch/mips/sibyte/sb1250/smp.c
@@ -182,4 +182,6 @@ void sb1250_mailbox_interrupt(void)
 
 	if (action & SMP_CALL_FUNCTION)
 		smp_call_function_interrupt();
+	else if (action & SMP_CALL_FUNCTION_SINGLE)
+		smp_call_function_single_interrupt();
 }
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h
index 84fef1a..d35c0ad 100644
--- a/include/asm-mips/smp.h
+++ b/include/asm-mips/smp.h
@@ -35,18 +35,9 @@ extern int __cpu_logical_map[NR_CPUS];
 
 #define NO_PROC_ID	(-1)
 
-struct call_data_struct {
-	void		(*func)(void *);
-	void		*info;
-	atomic_t	started;
-	atomic_t	finished;
-	int		wait;
-};
-
-extern struct call_data_struct *call_data;
-
 #define SMP_RESCHEDULE_YOURSELF	0x1	/* XXX braindead */
 #define SMP_CALL_FUNCTION	0x2
+#define SMP_CALL_FUNCTION_SINGLE	0x4
 
 extern cpumask_t phys_cpu_present_map;
 #define cpu_possible_map	phys_cpu_present_map
@@ -66,5 +57,6 @@ static inline void smp_send_reschedule(int cpu)
 }
 
 extern asmlinkage void smp_call_function_interrupt(void);
+extern asmlinkage void smp_call_function_single_interrupt(void);
 
 #endif /* __ASM_SMP_H */
-- 
1.5.5.1.57.g5909c

WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <jens.axboe@oracle.com>
To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	npiggin@suse.de, torvalds@linux-foundation.org
Cc: peterz@infradead.org, sam@ravnborg.org,
	Jens Axboe <jens.axboe@oracle.com>,
	Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 8/11] mips: convert to generic helpers for IPI function calls
Date: Tue, 22 Apr 2008 20:50:24 +0200	[thread overview]
Message-ID: <1208890227-24808-9-git-send-email-jens.axboe@oracle.com> (raw)
Message-ID: <20080422185024.EzxLcLwyL9vcoNdtdAICn04jMtlwFTDUrSg_bFmRFEQ@z> (raw)
In-Reply-To: <1208890227-24808-1-git-send-email-jens.axboe@oracle.com>

This converts mips to use the new helpers for smp_call_function() and
friends, and adds support for smp_call_function_single(). Not tested,
but it compiles.

Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
---
 arch/mips/Kconfig              |    1 +
 arch/mips/kernel/smp-mt.c      |   27 ++++++++-
 arch/mips/kernel/smp.c         |  133 +++-------------------------------------
 arch/mips/kernel/smtc.c        |    7 ++
 arch/mips/sibyte/bcm1480/smp.c |    3 +
 arch/mips/sibyte/sb1250/smp.c  |    2 +
 include/asm-mips/smp.h         |   12 +---
 7 files changed, 49 insertions(+), 136 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 8724ed3..5092a9e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1742,6 +1742,7 @@ config SMP
 	bool "Multi-Processing support"
 	depends on SYS_SUPPORTS_SMP
 	select IRQ_PER_CPU
+	select USE_GENERIC_SMP_HELPERS
 	help
 	  This enables support for systems with more than one CPU. If you have
 	  a system with only one CPU, like most personal computers, say N. If
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 89e6f6a..31049fc 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -38,8 +38,9 @@
 
 #define MIPS_CPU_IPI_RESCHED_IRQ 0
 #define MIPS_CPU_IPI_CALL_IRQ 1
+#define MIPS_CPU_IPI_CALL_SINGLE_IRQ 2
 
-static int cpu_ipi_resched_irq, cpu_ipi_call_irq;
+static int cpu_ipi_resched_irq, cpu_ipi_call_irq, cpu_ipi_call_single_irq;
 
 #if 0
 static void dump_mtregisters(int vpe, int tc)
@@ -115,6 +116,11 @@ static void ipi_call_dispatch(void)
 	do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ);
 }
 
+static void ipi_call_single_dispatch(void)
+{
+	do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_SINGLE_IRQ);
+}
+
 static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
 {
 	return IRQ_HANDLED;
@@ -127,6 +133,13 @@ static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t ipi_call_single_interrupt(int irq, void *dev_id)
+{
+	smp_call_function_single_interrupt();
+
+	return IRQ_HANDLED;
+}
+
 static struct irqaction irq_resched = {
 	.handler	= ipi_resched_interrupt,
 	.flags		= IRQF_DISABLED|IRQF_PERCPU,
@@ -139,6 +152,12 @@ static struct irqaction irq_call = {
 	.name		= "IPI_call"
 };
 
+static struct irqaction irq_call_single = {
+	.handler	= ipi_call_single_interrupt,
+	.flags		= IRQF_DISABLED|IRQF_PERCPU,
+	.name		= "IPI_call_single"
+};
+
 static void __init smp_copy_vpe_config(void)
 {
 	write_vpe_c0_status(
@@ -376,16 +395,22 @@ static void __init vsmp_prepare_cpus(unsigned int max_cpus)
 	if (cpu_has_vint) {
 		set_vi_handler(MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch);
 		set_vi_handler(MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch);
+		set_vi_handler(MIPS_CPU_IPI_CALL_SINGLE_IRQ,
+					ipi_call_single_dispatch);
 	}
 
 	cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ;
 	cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ;
+	cpu_ipi_call_single_irq = MIPS_CPU_IRQ_BASE +
+						MIPS_CPU_IPI_CALL_SINGLE_IRQ;
 
 	setup_irq(cpu_ipi_resched_irq, &irq_resched);
 	setup_irq(cpu_ipi_call_irq, &irq_call);
+	setup_irq(cpu_ipi_call_single_irq, &irq_call_single);
 
 	set_irq_handler(cpu_ipi_resched_irq, handle_percpu_irq);
 	set_irq_handler(cpu_ipi_call_irq, handle_percpu_irq);
+	set_irq_handler(cpu_ipi_call_single_irq, handle_percpu_irq);
 }
 
 struct plat_smp_ops vsmp_smp_ops = {
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 9d41dab..931c0d9 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -128,145 +128,28 @@ asmlinkage __cpuinit void start_secondary(void)
 	cpu_idle();
 }
 
-DEFINE_SPINLOCK(smp_call_lock);
-
-struct call_data_struct *call_data;
-
-/*
- * Run a function on all other CPUs.
- *
- *  <mask>	cpuset_t of all processors to run the function on.
- *  <func>      The function to run. This must be fast and non-blocking.
- *  <info>      An arbitrary pointer to pass to the function.
- *  <retry>     If true, keep retrying until ready.
- *  <wait>      If true, wait until function has completed on other CPUs.
- *  [RETURNS]   0 on success, else a negative status code.
- *
- * Does not return until remote CPUs are nearly ready to execute <func>
- * or are or have executed.
- *
- * You must not call this function with disabled interrupts or from a
- * hardware interrupt handler or from a bottom half handler:
- *
- * CPU A                               CPU B
- * Disable interrupts
- *                                     smp_call_function()
- *                                     Take call_lock
- *                                     Send IPIs
- *                                     Wait for all cpus to acknowledge IPI
- *                                     CPU A has not responded, spin waiting
- *                                     for cpu A to respond, holding call_lock
- * smp_call_function()
- * Spin waiting for call_lock
- * Deadlock                            Deadlock
- */
-int smp_call_function_mask(cpumask_t mask, void (*func) (void *info),
-	void *info, int retry, int wait)
+void arch_send_call_function_ipi(cpumask_t mask)
 {
-	struct call_data_struct data;
-	int cpu = smp_processor_id();
-	int cpus;
-
-	/*
-	 * Can die spectacularly if this CPU isn't yet marked online
-	 */
-	BUG_ON(!cpu_online(cpu));
-
-	cpu_clear(cpu, mask);
-	cpus = cpus_weight(mask);
-	if (!cpus)
-		return 0;
-
-	/* Can deadlock when called with interrupts disabled */
-	WARN_ON(irqs_disabled());
-
-	data.func = func;
-	data.info = info;
-	atomic_set(&data.started, 0);
-	data.wait = wait;
-	if (wait)
-		atomic_set(&data.finished, 0);
-
-	spin_lock(&smp_call_lock);
-	call_data = &data;
-	smp_mb();
-
-	/* Send a message to all other CPUs and wait for them to respond */
 	mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
-
-	/* Wait for response */
-	/* FIXME: lock-up detection, backtrace on lock-up */
-	while (atomic_read(&data.started) != cpus)
-		barrier();
-
-	if (wait)
-		while (atomic_read(&data.finished) != cpus)
-			barrier();
-	call_data = NULL;
-	spin_unlock(&smp_call_lock);
-
-	return 0;
 }
 
-int smp_call_function(void (*func) (void *info), void *info, int retry,
-	int wait)
+void arch_send_call_function_single_ipi(int cpu)
 {
-	return smp_call_function_mask(cpu_online_map, func, info, retry, wait);
+	mp_ops->send_ipi_mask(cpumask_of_cpu(cpu), SMP_CALL_FUNCTION_SINGLE);
 }
 
 void smp_call_function_interrupt(void)
 {
-	void (*func) (void *info) = call_data->func;
-	void *info = call_data->info;
-	int wait = call_data->wait;
-
-	/*
-	 * Notify initiating CPU that I've grabbed the data and am
-	 * about to execute the function.
-	 */
-	smp_mb();
-	atomic_inc(&call_data->started);
-
-	/*
-	 * At this point the info structure may be out of scope unless wait==1.
-	 */
 	irq_enter();
-	(*func)(info);
+	generic_smp_call_function_interrupt();
 	irq_exit();
-
-	if (wait) {
-		smp_mb();
-		atomic_inc(&call_data->finished);
-	}
 }
 
-int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
-			     int retry, int wait)
+void smp_call_function_single_interrupt(void)
 {
-	int ret, me;
-
-	/*
-	 * Can die spectacularly if this CPU isn't yet marked online
-	 */
-	if (!cpu_online(cpu))
-		return 0;
-
-	me = get_cpu();
-	BUG_ON(!cpu_online(me));
-
-	if (cpu == me) {
-		local_irq_disable();
-		func(info);
-		local_irq_enable();
-		put_cpu();
-		return 0;
-	}
-
-	ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, retry,
-				     wait);
-
-	put_cpu();
-	return 0;
+	irq_enter();
+	generic_smp_call_function_single_interrupt();
+	irq_exit();
 }
 
 static void stop_this_cpu(void *dummy)
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index b42e71c..434605f 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -884,6 +884,10 @@ static void ipi_resched_interrupt(void)
 	/* Return from interrupt should be enough to cause scheduler check */
 }
 
+static void ipi_call_single_interrupt(void)
+{
+	smp_call_function_single_interrupt();
+}
 
 static void ipi_call_interrupt(void)
 {
@@ -924,6 +928,9 @@ void ipi_decode(struct smtc_ipi *pipi)
 		case SMP_CALL_FUNCTION:
 			ipi_call_interrupt();
 			break;
+		case SMP_CALL_FUNCTION_SINGLE:
+			ipi_call_single_interrupt();
+			break;
 		default:
 			printk("Impossible SMTC IPI Argument 0x%x\n",
 				(int)arg_copy);
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index bd9eeb4..76d36ff 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -29,6 +29,7 @@
 #include <asm/sibyte/bcm1480_int.h>
 
 extern void smp_call_function_interrupt(void);
+extern void smp_call_function_single_interrupt(void);
 
 /*
  * These are routines for dealing with the bcm1480 smp capabilities
@@ -194,4 +195,6 @@ void bcm1480_mailbox_interrupt(void)
 
 	if (action & SMP_CALL_FUNCTION)
 		smp_call_function_interrupt();
+	else if (action & SMP_CALL_FUNCTION_SINGLE)
+		smp_call_function_single_interrupt();
 }
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c
index 0734b93..8742127 100644
--- a/arch/mips/sibyte/sb1250/smp.c
+++ b/arch/mips/sibyte/sb1250/smp.c
@@ -182,4 +182,6 @@ void sb1250_mailbox_interrupt(void)
 
 	if (action & SMP_CALL_FUNCTION)
 		smp_call_function_interrupt();
+	else if (action & SMP_CALL_FUNCTION_SINGLE)
+		smp_call_function_single_interrupt();
 }
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h
index 84fef1a..d35c0ad 100644
--- a/include/asm-mips/smp.h
+++ b/include/asm-mips/smp.h
@@ -35,18 +35,9 @@ extern int __cpu_logical_map[NR_CPUS];
 
 #define NO_PROC_ID	(-1)
 
-struct call_data_struct {
-	void		(*func)(void *);
-	void		*info;
-	atomic_t	started;
-	atomic_t	finished;
-	int		wait;
-};
-
-extern struct call_data_struct *call_data;
-
 #define SMP_RESCHEDULE_YOURSELF	0x1	/* XXX braindead */
 #define SMP_CALL_FUNCTION	0x2
+#define SMP_CALL_FUNCTION_SINGLE	0x4
 
 extern cpumask_t phys_cpu_present_map;
 #define cpu_possible_map	phys_cpu_present_map
@@ -66,5 +57,6 @@ static inline void smp_send_reschedule(int cpu)
 }
 
 extern asmlinkage void smp_call_function_interrupt(void);
+extern asmlinkage void smp_call_function_single_interrupt(void);
 
 #endif /* __ASM_SMP_H */
-- 
1.5.5.1.57.g5909c


  parent reply	other threads:[~2008-04-22 18:50 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-22 18:50 [PATCH 0/11] Generic smp_call_function() #2 Jens Axboe
2008-04-22 18:50 ` Jens Axboe
     [not found] ` <1208890227-24808-1-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2008-04-22 18:50   ` [PATCH 1/11] Add generic helpers for arch IPI function calls Jens Axboe
2008-04-22 18:50     ` Jens Axboe
     [not found]     ` <1208890227-24808-2-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2008-04-22 20:17       ` Peter Zijlstra
2008-04-22 20:17         ` Peter Zijlstra
2008-04-23  6:07         ` Jens Axboe
2008-04-23  6:07           ` Jens Axboe
     [not found]           ` <20080423060725.GT12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2008-04-23  6:32             ` Peter Zijlstra
2008-04-23  6:32               ` Peter Zijlstra
2008-04-23  7:49               ` Jens Axboe
2008-04-23  7:49                 ` Jens Axboe
     [not found]                 ` <20080423074933.GB12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2008-04-23  7:50                   ` Peter Zijlstra
2008-04-23  7:50                     ` Peter Zijlstra
2008-04-24 22:01       ` Russell King
2008-04-24 22:01         ` Russell King
     [not found]         ` <20080424220157.GA26179-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2008-04-25  7:18           ` Jens Axboe
2008-04-25  7:18             ` Jens Axboe
     [not found]             ` <20080425071823.GF12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2008-04-26  6:28               ` Jeremy Fitzhardinge
2008-04-26  6:28                 ` Jeremy Fitzhardinge
     [not found]                 ` <4812CB99.1070600-TSDbQ3PG+2Y@public.gmane.org>
2008-04-28  7:38                   ` Jes Sorensen
2008-04-28  7:38                     ` Jes Sorensen
2008-04-26  6:11       ` Andrew Morton
2008-04-26  6:11         ` Andrew Morton
     [not found]         ` <20080425231100.b93a1601.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-04-26 14:13           ` James Bottomley
2008-04-26 14:13             ` James Bottomley
2008-04-27  0:58           ` Paul E. McKenney
2008-04-27  0:58             ` Paul E. McKenney
     [not found]             ` <20080427005816.GB21687-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2008-04-27 10:36               ` Jens Axboe
2008-04-27 10:36                 ` Jens Axboe
2008-04-27 10:30           ` Jens Axboe
2008-04-27 10:30             ` Jens Axboe
     [not found]         ` <1209219236.3113.6.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-04-28 14:25           ` David Howells
2008-04-28 14:25             ` David Howells
     [not found]             ` <18470.1209392727-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-04-28 14:43               ` James Bottomley
2008-04-28 14:43                 ` James Bottomley
2008-04-22 18:50   ` [PATCH 2/11] x86: convert to generic helpers for " Jens Axboe
2008-04-22 18:50     ` Jens Axboe
2008-04-22 19:03     ` Linus Torvalds
2008-04-22 19:03       ` Linus Torvalds
     [not found]       ` <alpine.LFD.1.10.0804221157220.2779-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-04-22 19:12         ` Ingo Molnar
2008-04-22 19:12           ` Ingo Molnar
     [not found]           ` <20080422191213.GA6370-X9Un+BFzKDI@public.gmane.org>
2008-04-22 19:22             ` Linus Torvalds
2008-04-22 19:22               ` Linus Torvalds
2008-04-22 19:26               ` Ingo Molnar
2008-04-22 19:26                 ` Ingo Molnar
     [not found]                 ` <20080422192601.GB12588-X9Un+BFzKDI@public.gmane.org>
2008-04-22 19:50                   ` Linus Torvalds
2008-04-22 19:50                     ` Linus Torvalds
     [not found]                     ` <alpine.LFD.1.10.0804221244350.2779-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-04-23  1:11                       ` Nick Piggin
2008-04-23  1:11                         ` Nick Piggin
     [not found]                         ` <20080423011153.GB17572-B4tOwbsTzaBolqkO4TVVkw@public.gmane.org>
2008-04-23  1:22                           ` Linus Torvalds
2008-04-23  1:22                             ` Linus Torvalds
     [not found]                             ` <alpine.LFD.1.10.0804221817050.2779-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-04-23  1:36                               ` Nick Piggin
2008-04-23  1:36                                 ` Nick Piggin
2008-04-23  7:08                           ` Jens Axboe
2008-04-23  7:08                             ` Jens Axboe
2008-04-23 12:54         ` Jens Axboe
2008-04-23 12:54           ` Jens Axboe
     [not found]     ` <1208890227-24808-3-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2008-04-26  6:44       ` Jeremy Fitzhardinge
2008-04-26  6:44         ` Jeremy Fitzhardinge
     [not found]         ` <4812CF5B.4080902-TSDbQ3PG+2Y@public.gmane.org>
2008-04-27 10:23           ` Jens Axboe
2008-04-27 10:23             ` Jens Axboe
     [not found]             ` <20080427102335.GS12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2008-04-27 15:18               ` Jeremy Fitzhardinge
2008-04-27 15:18                 ` Jeremy Fitzhardinge
2008-04-22 18:50   ` [PATCH 3/11] powerpc: " Jens Axboe
2008-04-22 18:50     ` Jens Axboe
2008-04-22 18:50   ` [PATCH 4/11] ia64: " Jens Axboe
2008-04-22 18:50     ` Jens Axboe
2008-04-22 18:50   ` [PATCH 5/11] alpha: " Jens Axboe
2008-04-22 18:50     ` Jens Axboe
2008-04-22 18:50   ` [PATCH 6/11] arm: " Jens Axboe
2008-04-22 18:50     ` Jens Axboe
2008-04-22 18:50   ` [PATCH 7/11] m32r: " Jens Axboe
2008-04-22 18:50     ` Jens Axboe
2008-04-22 18:50   ` Jens Axboe [this message]
2008-04-22 18:50     ` [PATCH 8/11] mips: " Jens Axboe
2008-04-22 23:18     ` Ralf Baechle
2008-04-22 23:18       ` Ralf Baechle
2008-04-23  7:18       ` Jens Axboe
2008-04-23  7:18         ` Jens Axboe
2008-04-22 18:50   ` [PATCH 9/11] parisc: " Jens Axboe
2008-04-22 18:50     ` Jens Axboe
2008-04-22 18:50   ` [PATCH 10/11] sh: " Jens Axboe
2008-04-22 18:50     ` Jens Axboe
     [not found]     ` <1208890227-24808-11-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2008-04-25  8:56       ` Paul Mundt
2008-04-25  8:56         ` Paul Mundt
     [not found]         ` <20080425085637.GA30569-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org>
2008-04-25  9:16           ` Jens Axboe
2008-04-25  9:16             ` Jens Axboe
2008-04-22 18:50   ` [PATCH 11/11] s390: " Jens Axboe
2008-04-22 18:50     ` Jens Axboe
     [not found]     ` <1208890227-24808-12-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2008-04-23  7:58       ` Heiko Carstens
2008-04-23  7:58         ` Heiko Carstens
     [not found]         ` <20080423075831.GB15850-Pmgahw53EmNLmI7Nx2oIsGnsbthNF6/HVpNB7YpNyf8@public.gmane.org>
2008-04-23  8:11           ` Jens Axboe
2008-04-23  8:11             ` Jens Axboe
     [not found]             ` <20080423081147.GC12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2008-04-23 11:21               ` Jens Axboe
2008-04-23 11:21                 ` Jens Axboe
     [not found]                 ` <20080423112124.GJ12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2008-04-23 11:47                   ` Heiko Carstens
2008-04-23 11:47                     ` Heiko Carstens
     [not found]                     ` <20080423114744.GA29422-Pmgahw53EmNLmI7Nx2oIsGnsbthNF6/HVpNB7YpNyf8@public.gmane.org>
2008-04-23 11:54                       ` Jens Axboe
2008-04-23 11:54                         ` Jens Axboe
2008-04-23 12:42                       ` Martin Schwidefsky
2008-04-23 12:42                         ` Martin Schwidefsky
2008-04-23 15:56                         ` Rusty Russell
2008-04-23 15:56                           ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2008-04-22  7:57 [PATCH 0/11] Generic smp_call_function() and friends Jens Axboe
     [not found] ` <1208851058-8500-1-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2008-04-22  7:57   ` [PATCH 8/11] mips: convert to generic helpers for IPI function calls Jens Axboe
2008-04-22  7:57     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208890227-24808-9-git-send-email-jens.axboe@oracle.com \
    --to=jens.axboe-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=npiggin-l3A5Bk7waGM@public.gmane.org \
    --cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).