linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Milton Miller <miltonm@bga.com>
To: <linuxppc-dev@lists.ozlabs.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: [PATCH 11/37] powerpc: remove checks for MSG_ALL and MSG_ALL_BUT_SELF
Date: Wed, 11 May 2011 00:29:10 -0500	[thread overview]
Message-ID: <21fcf71a581c724f968518c87b13ebb6163464d2.1305092637.git.miltonm@bga.com> (raw)
In-Reply-To: <cover.1305092637.git.miltonm@bga.com>

Now that smp_ops->smp_message_pass is always called with an (online) cpu
number for the target remove the checks for MSG_ALL and MSG_ALL_BUT_SELF.

Signed-off-by: Milton Miller <miltonm@bga.com>
---
rediffed for ppc-next xics split
---
 arch/powerpc/include/asm/dbell.h       |    2 +-
 arch/powerpc/include/asm/machdep.h     |    2 +-
 arch/powerpc/include/asm/xics.h        |    2 +-
 arch/powerpc/kernel/dbell.c            |   29 +++++------------------------
 arch/powerpc/platforms/cell/beat_smp.c |   18 +-----------------
 arch/powerpc/platforms/cell/smp.c      |   18 +-----------------
 arch/powerpc/platforms/iseries/smp.c   |   18 +-----------------
 arch/powerpc/platforms/powermac/smp.c  |   17 +++--------------
 arch/powerpc/platforms/ps3/smp.c       |   22 +++-------------------
 arch/powerpc/sysdev/mpic.c             |   20 ++------------------
 arch/powerpc/sysdev/xics/icp-hv.c      |   18 +-----------------
 arch/powerpc/sysdev/xics/icp-native.c  |   18 +-----------------
 12 files changed, 21 insertions(+), 163 deletions(-)

diff --git a/arch/powerpc/include/asm/dbell.h b/arch/powerpc/include/asm/dbell.h
index 0893ab9..3269eb4 100644
--- a/arch/powerpc/include/asm/dbell.h
+++ b/arch/powerpc/include/asm/dbell.h
@@ -27,7 +27,7 @@ enum ppc_dbell {
 	PPC_G_DBELL_MC = 4,	/* guest mcheck doorbell */
 };
 
-extern void doorbell_message_pass(int target, int msg);
+extern void doorbell_message_pass(int cpu, int msg);
 extern void doorbell_exception(struct pt_regs *regs);
 extern void doorbell_check_self(void);
 extern void doorbell_setup_this_cpu(void);
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index c6345ac..b0802a5 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -31,7 +31,7 @@ struct kimage;
 
 #ifdef CONFIG_SMP
 struct smp_ops_t {
-	void  (*message_pass)(int target, int msg);
+	void  (*message_pass)(int cpu, int msg);
 	int   (*probe)(void);
 	int   (*kick_cpu)(int nr);
 	void  (*setup_cpu)(int nr);
diff --git a/arch/powerpc/include/asm/xics.h b/arch/powerpc/include/asm/xics.h
index 6c06306..1750c8d 100644
--- a/arch/powerpc/include/asm/xics.h
+++ b/arch/powerpc/include/asm/xics.h
@@ -40,7 +40,7 @@ struct icp_ops {
 	void (*teardown_cpu)(void);
 	void (*flush_ipi)(void);
 #ifdef CONFIG_SMP
-	void (*message_pass)(int target, int msg);
+	void (*message_pass)(int cpu, int msg);
 	irq_handler_t ipi_action;
 #endif
 };
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
index 3307a52..e49b24c 100644
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -34,32 +34,13 @@ void doorbell_setup_this_cpu(void)
 	info->tag = mfspr(SPRN_PIR) & 0x3fff;
 }
 
-void doorbell_message_pass(int target, int msg)
+void doorbell_message_pass(int cpu, int msg)
 {
 	struct doorbell_cpu_info *info;
-	int i;
-
-	if (target < NR_CPUS) {
-		info = &per_cpu(doorbell_cpu_info, target);
-		set_bit(msg, &info->messages);
-		ppc_msgsnd(PPC_DBELL, 0, info->tag);
-	}
-	else if (target == MSG_ALL_BUT_SELF) {
-		for_each_online_cpu(i) {
-			if (i == smp_processor_id())
-				continue;
-			info = &per_cpu(doorbell_cpu_info, i);
-			set_bit(msg, &info->messages);
-			ppc_msgsnd(PPC_DBELL, 0, info->tag);
-		}
-	}
-	else { /* target == MSG_ALL */
-		for_each_online_cpu(i) {
-			info = &per_cpu(doorbell_cpu_info, i);
-			set_bit(msg, &info->messages);
-		}
-		ppc_msgsnd(PPC_DBELL, PPC_DBELL_MSG_BRDCAST, 0);
-	}
+
+	info = &per_cpu(doorbell_cpu_info, cpu);
+	set_bit(msg, &info->messages);
+	ppc_msgsnd(PPC_DBELL, 0, info->tag);
 }
 
 void doorbell_exception(struct pt_regs *regs)
diff --git a/arch/powerpc/platforms/cell/beat_smp.c b/arch/powerpc/platforms/cell/beat_smp.c
index 3e86acb..23bbe6e 100644
--- a/arch/powerpc/platforms/cell/beat_smp.c
+++ b/arch/powerpc/platforms/cell/beat_smp.c
@@ -67,22 +67,6 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
 	return 0;
 }
 
-static void smp_beatic_message_pass(int target, int msg)
-{
-	unsigned int i;
-
-	if (target < NR_CPUS) {
-		beatic_cause_IPI(target, msg);
-	} else {
-		for_each_online_cpu(i) {
-			if (target == MSG_ALL_BUT_SELF
-			    && i == smp_processor_id())
-				continue;
-			beatic_cause_IPI(i, msg);
-		}
-	}
-}
-
 static int __init smp_beatic_probe(void)
 {
 	return cpumask_weight(cpu_possible_mask);
@@ -105,7 +89,7 @@ static int smp_celleb_cpu_bootable(unsigned int nr)
 	return 1;
 }
 static struct smp_ops_t bpa_beatic_smp_ops = {
-	.message_pass	= smp_beatic_message_pass,
+	.message_pass	= beatic_cause_IPI,
 	.probe		= smp_beatic_probe,
 	.kick_cpu	= smp_celleb_kick_cpu,
 	.setup_cpu	= smp_beatic_setup_cpu,
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index a2161b9..d176e61 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -103,22 +103,6 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
 	return 1;
 }
 
-static void smp_iic_message_pass(int target, int msg)
-{
-	unsigned int i;
-
-	if (target < NR_CPUS) {
-		iic_cause_IPI(target, msg);
-	} else {
-		for_each_online_cpu(i) {
-			if (target == MSG_ALL_BUT_SELF
-			    && i == smp_processor_id())
-				continue;
-			iic_cause_IPI(i, msg);
-		}
-	}
-}
-
 static int __init smp_iic_probe(void)
 {
 	iic_request_IPIs();
@@ -168,7 +152,7 @@ static int smp_cell_cpu_bootable(unsigned int nr)
 	return 1;
 }
 static struct smp_ops_t bpa_iic_smp_ops = {
-	.message_pass	= smp_iic_message_pass,
+	.message_pass	= iic_cause_IPI,
 	.probe		= smp_iic_probe,
 	.kick_cpu	= smp_cell_kick_cpu,
 	.setup_cpu	= smp_cell_setup_cpu,
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index 02a677a..dcdbc5d 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -59,28 +59,12 @@ void iSeries_smp_message_recv(void)
 			smp_message_recv(msg);
 }
 
-static inline void smp_iSeries_do_message(int cpu, int msg)
+static void smp_iSeries_message_pass(int cpu, int msg)
 {
 	set_bit(msg, &iSeries_smp_message[cpu]);
 	HvCall_sendIPI(&(paca[cpu]));
 }
 
-static void smp_iSeries_message_pass(int target, int msg)
-{
-	int i;
-
-	if (target < NR_CPUS)
-		smp_iSeries_do_message(target, msg);
-	else {
-		for_each_online_cpu(i) {
-			if ((target == MSG_ALL_BUT_SELF) &&
-					(i == smp_processor_id()))
-				continue;
-			smp_iSeries_do_message(i, msg);
-		}
-	}
-}
-
 static int smp_iSeries_probe(void)
 {
 	return cpumask_weight(cpu_possible_mask);
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 621d4b7..c49e719 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -186,21 +186,10 @@ irqreturn_t psurge_primary_intr(int irq, void *d)
 	return IRQ_HANDLED;
 }
 
-static void smp_psurge_message_pass(int target, int msg)
+static void smp_psurge_message_pass(int cpu, int msg)
 {
-	int i;
-
-	if (num_online_cpus() < 2)
-		return;
-
-	for_each_online_cpu(i) {
-		if (target == MSG_ALL
-		    || (target == MSG_ALL_BUT_SELF && i != smp_processor_id())
-		    || target == i) {
-			set_bit(msg, &psurge_smp_message[i]);
-			psurge_set_ipi(i);
-		}
-	}
+	set_bit(msg, &psurge_smp_message[cpu]);
+	psurge_set_ipi(cpu);
 }
 
 /*
diff --git a/arch/powerpc/platforms/ps3/smp.c b/arch/powerpc/platforms/ps3/smp.c
index 51ffde4..4c44794 100644
--- a/arch/powerpc/platforms/ps3/smp.c
+++ b/arch/powerpc/platforms/ps3/smp.c
@@ -39,7 +39,7 @@
 #define MSG_COUNT 4
 static DEFINE_PER_CPU(unsigned int [MSG_COUNT], ps3_ipi_virqs);
 
-static void do_message_pass(int target, int msg)
+static void ps3_smp_message_pass(int cpu, int msg)
 {
 	int result;
 	unsigned int virq;
@@ -49,28 +49,12 @@ static void do_message_pass(int target, int msg)
 		return;
 	}
 
-	virq = per_cpu(ps3_ipi_virqs, target)[msg];
+	virq = per_cpu(ps3_ipi_virqs, cpu)[msg];
 	result = ps3_send_event_locally(virq);
 
 	if (result)
 		DBG("%s:%d: ps3_send_event_locally(%d, %d) failed"
-			" (%d)\n", __func__, __LINE__, target, msg, result);
-}
-
-static void ps3_smp_message_pass(int target, int msg)
-{
-	int cpu;
-
-	if (target < NR_CPUS)
-		do_message_pass(target, msg);
-	else if (target == MSG_ALL_BUT_SELF) {
-		for_each_online_cpu(cpu)
-			if (cpu != smp_processor_id())
-				do_message_pass(cpu, msg);
-	} else {
-		for_each_online_cpu(cpu)
-			do_message_pass(cpu, msg);
-	}
+			" (%d)\n", __func__, __LINE__, cpu, msg, result);
 }
 
 static int ps3_smp_probe(void)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 116695b..68ea50c 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1628,31 +1628,15 @@ static void mpic_send_ipi(unsigned int ipi_no, const struct cpumask *cpu_mask)
 		       mpic_physmask(cpumask_bits(cpu_mask)[0]));
 }
 
-void smp_mpic_message_pass(int target, int msg)
+void smp_mpic_message_pass(int cpu, int msg)
 {
-	cpumask_var_t tmp;
-
 	/* make sure we're sending something that translates to an IPI */
 	if ((unsigned int)msg > 3) {
 		printk("SMP %d: smp_message_pass: unknown msg %d\n",
 		       smp_processor_id(), msg);
 		return;
 	}
-	switch (target) {
-	case MSG_ALL:
-		mpic_send_ipi(msg, cpu_online_mask);
-		break;
-	case MSG_ALL_BUT_SELF:
-		alloc_cpumask_var(&tmp, GFP_NOWAIT);
-		cpumask_andnot(tmp, cpu_online_mask,
-			       cpumask_of(smp_processor_id()));
-		mpic_send_ipi(msg, tmp);
-		free_cpumask_var(tmp);
-		break;
-	default:
-		mpic_send_ipi(msg, cpumask_of(target));
-		break;
-	}
+	mpic_send_ipi(msg, cpumask_of(cpu));
 }
 
 int __init smp_mpic_probe(void)
diff --git a/arch/powerpc/sysdev/xics/icp-hv.c b/arch/powerpc/sysdev/xics/icp-hv.c
index 76e8724..234764c 100644
--- a/arch/powerpc/sysdev/xics/icp-hv.c
+++ b/arch/powerpc/sysdev/xics/icp-hv.c
@@ -118,7 +118,7 @@ static void icp_hv_set_cpu_priority(unsigned char cppr)
 
 #ifdef CONFIG_SMP
 
-static inline void icp_hv_do_message(int cpu, int msg)
+static void icp_hv_message_pass(int cpu, int msg)
 {
 	unsigned long *tgt = &per_cpu(xics_ipi_message, cpu);
 
@@ -127,22 +127,6 @@ static inline void icp_hv_do_message(int cpu, int msg)
 	icp_hv_set_qirr(cpu, IPI_PRIORITY);
 }
 
-static void icp_hv_message_pass(int target, int msg)
-{
-	unsigned int i;
-
-	if (target < NR_CPUS) {
-		icp_hv_do_message(target, msg);
-	} else {
-		for_each_online_cpu(i) {
-			if (target == MSG_ALL_BUT_SELF
-			    && i == smp_processor_id())
-				continue;
-			icp_hv_do_message(i, msg);
-		}
-	}
-}
-
 static irqreturn_t icp_hv_ipi_action(int irq, void *dev_id)
 {
 	int cpu = smp_processor_id();
diff --git a/arch/powerpc/sysdev/xics/icp-native.c b/arch/powerpc/sysdev/xics/icp-native.c
index 3508321..246500e 100644
--- a/arch/powerpc/sysdev/xics/icp-native.c
+++ b/arch/powerpc/sysdev/xics/icp-native.c
@@ -134,7 +134,7 @@ static unsigned int icp_native_get_irq(void)
 
 #ifdef CONFIG_SMP
 
-static inline void icp_native_do_message(int cpu, int msg)
+static void icp_native_message_pass(int cpu, int msg)
 {
 	unsigned long *tgt = &per_cpu(xics_ipi_message, cpu);
 
@@ -143,22 +143,6 @@ static inline void icp_native_do_message(int cpu, int msg)
 	icp_native_set_qirr(cpu, IPI_PRIORITY);
 }
 
-static void icp_native_message_pass(int target, int msg)
-{
-	unsigned int i;
-
-	if (target < NR_CPUS) {
-		icp_native_do_message(target, msg);
-	} else {
-		for_each_online_cpu(i) {
-			if (target == MSG_ALL_BUT_SELF
-			    && i == smp_processor_id())
-				continue;
-			icp_native_do_message(i, msg);
-		}
-	}
-}
-
 static irqreturn_t icp_native_ipi_action(int irq, void *dev_id)
 {
 	int cpu = smp_processor_id();
-- 
1.7.0.4

  parent reply	other threads:[~2011-05-11  7:42 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11  5:43 [PATCH 00/37] fix paca memory usage and NR_CPU loops, factor ipi and simplify irq code Milton Miller
2011-05-11  5:28 ` [PATCH 01/37] powerpc: fix memory corruption from unallocated slaves Milton Miller
2011-05-11  5:28 ` [PATCH 02/37] powerpc: don't search for paca in freed memory Milton Miller
2011-05-11  5:28 ` [PATCH 03/37] powerpc/kdump64: Don't reference freed memory as pacas Milton Miller
2011-05-11  5:28 ` [PATCH 04/37] powerpc/iseries: cleanup and fix secondary startup Milton Miller
2011-05-11  5:28 ` [PATCH 05/37] powerpc: Respect nr_cpu_ids when calling set_cpu_possible and set_cpu_present Milton Miller
2011-05-11  5:28 ` [PATCH 06/37] powerpc: use nr_cpu_ids in initial paca allocation Milton Miller
2011-05-11  5:28 ` [PATCH 07/37] powerpc: call no-longer static setup_nr_cpu_ids instead of replicating it Milton Miller
2011-05-11  5:28 ` [PATCH 08/37] powerpc: mpic: limit NR_CPUS loop to 32 bit Milton Miller
2011-05-11  5:29 ` [PATCH 09/37] powerpc: mpic: break cpumask abstraction earlier Milton Miller
2011-05-11  5:29 ` [PATCH 10/37] powerpc: remove call sites of MSG_ALL_BUT_SELF Milton Miller
2011-05-11  5:29 ` Milton Miller [this message]
2011-05-11  5:29 ` [PATCH 12/37] linux/smp.h: remove unused MSG_ flags Milton Miller
2011-05-11  5:29 ` [PATCH 13/37] powerpc/mpic: simplify ipi cpu mask handling Milton Miller
2011-05-11  5:29 ` [PATCH 14/37] powerpc: remove powermac/pic.h Milton Miller
2011-05-11  5:29 ` [PATCH 15/37] powerpc: remove alloc_maybe_bootmem for zalloc version Milton Miller
2011-05-11  5:29 ` [PATCH 16/37] powerpc: remove stubbed beat smp support Milton Miller
2011-05-11  5:29 ` [PATCH 17/37] powerpc cell: use smp_request_message_ipi Milton Miller
2011-05-11  5:29 ` [PATCH 18/37] powerpc: move smp_ops_t from machdep.h to smp.h Milton Miller
2011-05-11  5:29 ` [PATCH 19/37] powerpc: consolidate ipi message mux and demux Milton Miller
2011-05-19  6:57   ` Benjamin Herrenschmidt
2011-05-19  6:58     ` Benjamin Herrenschmidt
2011-05-11  5:29 ` [PATCH 20/37] powerpc: add kconfig for muxed smp ipi support Milton Miller
2011-05-11  5:29 ` [PATCH 21/37] powerpc: use bytes instead of bitops in smp ipi multiplexing Milton Miller
2011-05-11  5:29 ` [PATCH 22/37] powerpc: xics: cleanup xics_host_map and ipi Milton Miller
2011-05-11  5:29 ` [PATCH 23/37] powerpc: radix trees are available before init_IRQ Milton Miller
2011-05-11 19:00   ` Grant Likely
2011-05-11  5:29 ` [PATCH 24/37] powerpc: return early if irq_host lookup type is wrong Milton Miller
2011-05-11 19:03   ` Grant Likely
2011-05-11  5:30 ` [PATCH 25/37] powerpc: remove trival irq_host_ops.unmap Milton Miller
2011-05-11  5:30 ` [PATCH 26/37] powerpc: remove i8259 irq_host_ops->unmap Milton Miller
2011-05-11  5:30 ` [PATCH 27/37] powerpc fsl_msi: don't abuse platform_data for driver_data Milton Miller
2011-05-11 19:05   ` Grant Likely
2011-05-11  5:30 ` [PATCH 28/37] powerpc: fsl_msi: use chip_data not handler_data Milton Miller
2011-05-11  5:30 ` [PATCH 29/37] powerpc: mpc5121_ads_cpld: remove use of NO_IRQ_IGNORE Milton Miller
2011-05-11 19:07   ` Grant Likely
2011-05-11  5:30 ` [PATCH 30/37] powerpc: mpc62xx_pic: fix get_irq handling of NO_IRQ Milton Miller
2011-05-11 19:08   ` Grant Likely
2011-05-11  5:30 ` [PATCH 31/37] powerpc: psurge: create a irq_host for secondary cpus Milton Miller
2011-05-11  5:30 ` [PATCH 32/37] powerpc: remove irq_host_ops->remap hook Milton Miller
2011-05-11  5:30 ` [PATCH 33/37] powerpc: spider-pic: get pic from chip_data instead of irq_map Milton Miller
2011-05-11 19:13   ` Grant Likely
2011-05-11  5:30 ` [PATCH 34/37] powerpc: axon_msi: validate msi irq via chip_data Milton Miller
2011-05-11  5:30 ` [PATCH 35/37] powerpc: add virq_is_host to reduce virq_to_host usage Milton Miller
2011-05-11 19:16   ` Grant Likely
2011-05-11  5:30 ` [PATCH 36/37] powerpc: remove virq_to_host Milton Miller
2011-05-11 19:17   ` Grant Likely
2011-05-11  5:30 ` [PATCH 37/37] powerpc: make IRQ_NOREQUEST last to clear, first to set Milton Miller
2011-05-11 19:18   ` Grant Likely
2011-05-12  8:31     ` Milton Miller
2011-05-11 19:40 ` [PATCH 00/37] fix paca memory usage and NR_CPU loops, factor ipi and simplify irq code Grant Likely

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=21fcf71a581c724f968518c87b13ebb6163464d2.1305092637.git.miltonm@bga.com \
    --to=miltonm@bga.com \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.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).