From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/9] ARM: smp: avoid using bitmasks and locks for IPIs, use hardware instead
Date: Mon, 15 Nov 2010 17:58:24 +0000 [thread overview]
Message-ID: <E1PI3Jw-00029e-Kh@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20101115175553.GC31421@n2100.arm.linux.org.uk>
Avoid using bitmasks and locks in the percpu area for IPIs, and instead
use individual software generated interrupts to identify the reason for
the IPI. This avoids the problems of having spinlocks in the percpu
area.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/kernel/smp.c | 87 ++++++++++++++----------------------------------
1 files changed, 26 insertions(+), 61 deletions(-)
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 7a236db..78d55c6 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -48,20 +48,15 @@ struct secondary_data secondary_data;
/*
* structures for inter-processor calls
- * - A collection of single bit ipi messages.
*/
struct ipi_data {
- spinlock_t lock;
unsigned long ipi_count;
- unsigned long bits;
};
-static DEFINE_PER_CPU(struct ipi_data, ipi_data) = {
- .lock = SPIN_LOCK_UNLOCKED,
-};
+static DEFINE_PER_CPU(struct ipi_data, ipi_data);
enum ipi_msg_type {
- IPI_TIMER,
+ IPI_TIMER = 2,
IPI_RESCHEDULE,
IPI_CALL_FUNC,
IPI_CALL_FUNC_SINGLE,
@@ -389,22 +384,13 @@ void __init smp_prepare_boot_cpu(void)
static void send_ipi_message(const struct cpumask *mask, enum ipi_msg_type msg)
{
unsigned long flags;
- unsigned int cpu;
local_irq_save(flags);
- for_each_cpu(cpu, mask) {
- struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
-
- spin_lock(&ipi->lock);
- ipi->bits |= 1 << msg;
- spin_unlock(&ipi->lock);
- }
-
/*
* Call the platform specific cross-CPU call function.
*/
- smp_cross_call(mask, 1);
+ smp_cross_call(mask, msg);
local_irq_restore(flags);
}
@@ -546,56 +532,35 @@ asmlinkage void __exception do_IPI(int ipinr, struct pt_regs *regs)
ipi->ipi_count++;
- for (;;) {
- unsigned long msgs;
-
- spin_lock(&ipi->lock);
- msgs = ipi->bits;
- ipi->bits = 0;
- spin_unlock(&ipi->lock);
-
- if (!msgs)
- break;
-
- do {
- unsigned nextmsg;
-
- nextmsg = msgs & -msgs;
- msgs &= ~nextmsg;
- nextmsg = ffz(~nextmsg);
-
- switch (nextmsg) {
- case IPI_TIMER:
- ipi_timer();
- break;
+ switch (ipinr) {
+ case IPI_TIMER:
+ ipi_timer();
+ break;
- case IPI_RESCHEDULE:
- /*
- * nothing more to do - eveything is
- * done on the interrupt return path
- */
- break;
+ case IPI_RESCHEDULE:
+ /*
+ * nothing more to do - eveything is
+ * done on the interrupt return path
+ */
+ break;
- case IPI_CALL_FUNC:
- generic_smp_call_function_interrupt();
- break;
+ case IPI_CALL_FUNC:
+ generic_smp_call_function_interrupt();
+ break;
- case IPI_CALL_FUNC_SINGLE:
- generic_smp_call_function_single_interrupt();
- break;
+ case IPI_CALL_FUNC_SINGLE:
+ generic_smp_call_function_single_interrupt();
+ break;
- case IPI_CPU_STOP:
- ipi_cpu_stop(cpu);
- break;
+ case IPI_CPU_STOP:
+ ipi_cpu_stop(cpu);
+ break;
- default:
- printk(KERN_CRIT "CPU%u: Unknown IPI message 0x%x\n",
- cpu, nextmsg);
- break;
- }
- } while (msgs);
+ default:
+ printk(KERN_CRIT "CPU%u: Unknown IPI message 0x%x\n",
+ cpu, ipinr);
+ break;
}
-
set_irq_regs(old_regs);
}
--
1.6.2.5
next prev parent reply other threads:[~2010-11-15 17:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-15 17:55 [PATCH 0/9] Clean up SMP IPI support Russell King - ARM Linux
2010-11-15 17:58 ` [PATCH 1/9] ARM: remove obsolete smp_cross_call_done() Russell King - ARM Linux
2010-11-15 17:58 ` [PATCH 2/9] ARM: smp: pass an ipi number to smp_cross_call() Russell King - ARM Linux
2010-11-17 11:05 ` Catalin Marinas
2010-11-15 17:58 ` Russell King - ARM Linux [this message]
2010-11-17 17:06 ` [PATCH 3/9] ARM: smp: avoid using bitmasks and locks for IPIs, use hardware instead Catalin Marinas
2010-11-17 17:19 ` Russell King - ARM Linux
2010-11-17 17:28 ` Catalin Marinas
2010-11-15 17:58 ` [PATCH 4/9] ARM: include local timer irq stats only when local timers configured Russell King - ARM Linux
2010-11-15 17:58 ` [PATCH 5/9] ARM: smp: provide accessors for irq_stat data Russell King - ARM Linux
2010-11-15 17:58 ` [PATCH 6/9] ARM: smp: move ipi_count into irq_stat structure Russell King - ARM Linux
2010-11-15 17:59 ` [PATCH 7/9] ARM: fix /proc/interrupts formatting Russell King - ARM Linux
2010-11-15 17:59 ` [PATCH 8/9] ARM: smp: provide individual IPI interrupt statistics Russell King - ARM Linux
2010-11-15 17:59 ` [PATCH 9/9] ARM: smp: collect IPI and local timer IRQs for /proc/stat Russell King - ARM Linux
2010-11-17 17:07 ` [PATCH 0/9] Clean up SMP IPI support Catalin Marinas
2010-11-17 17:17 ` Catalin Marinas
2010-11-17 17:21 ` Russell King - ARM Linux
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=E1PI3Jw-00029e-Kh@rmk-PC.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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).