From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] ARM: CPU hotplug: ensure we migrate all IRQs off a downed CPU
Date: Thu, 21 Jul 2011 16:25:35 +0100 [thread overview]
Message-ID: <E1Qjv83-0003Ie-Ui@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20110721151413.GD28942@n2100.arm.linux.org.uk>
Our selection of interrupts to consider for IRQ migration is sub-
standard. We were potentially including per-CPU interrupts in our
migration strategy, but omitting chained interrupts. This caused
some interrupts to remain on a downed CPU.
We were also trying to migrate interrupts which were not migratable,
resulting in an OOPS.
Instead, iterate over all interrupts, skipping per-CPU interrupts
or interrupts whose affinity does not include the downed CPU, and
attempt to set the affinity for every one else if their chip
implements irq_set_affinity().
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/kernel/irq.c | 39 ++++++++++++++++++++++++++++-----------
1 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index ab63c05..0f928a1 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -131,46 +131,63 @@ int __init arch_probe_nr_irqs(void)
#ifdef CONFIG_HOTPLUG_CPU
-static bool migrate_one_irq(struct irq_data *d)
+static bool migrate_one_irq(struct irq_desc *desc)
{
+ struct irq_data *d = irq_desc_get_irq_data(desc);
const struct cpumask *affinity = d->affinity;
+ struct irq_chip *c;
bool ret = false;
+ /*
+ * If this is a per-CPU interrupt, or the affinity does not
+ * include this CPU, then we have nothing to do.
+ */
+ if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
+ return false;
+
if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
- affinity cpu_online_mask;
+ affinity = cpu_online_mask;
ret = true;
}
- d->chip->irq_set_affinity(d, affinity, true);
+ c = irq_data_get_irq_chip(d);
+ if (c->irq_set_affinity)
+ c->irq_set_affinity(d, affinity, true);
+ else
+ pr_debug("IRQ%u: unable to set affinity\n", d->irq);
return ret;
}
/*
- * The CPU has been marked offline. Migrate IRQs off this CPU. If
- * the affinity settings do not allow other CPUs, force them onto any
+ * The current CPU has been marked offline. Migrate IRQs off this CPU.
+ * If the affinity settings do not allow other CPUs, force them onto any
* available CPU.
+ *
+ * Note: we must iterate over all IRQs, whether they have an attached
+ * action structure or not, as we need to get chained interrupts too.
*/
void migrate_irqs(void)
{
- unsigned int i, cpu = smp_processor_id();
+ unsigned int i;
struct irq_desc *desc;
unsigned long flags;
local_irq_save(flags);
for_each_irq_desc(i, desc) {
- struct irq_data *d = &desc->irq_data;
bool affinity_broken = false;
+ if (!desc)
+ continue;
+
raw_spin_lock(&desc->lock);
- if (desc->action != NULL &&
- cpumask_test_cpu(smp_processor_id(), d->affinity))
- affinity_broken = migrate_one_irq(d);
+ affinity_broken = migrate_one_irq(desc);
raw_spin_unlock(&desc->lock);
if (affinity_broken && printk_ratelimit())
- pr_warning("IRQ%u no longer affine to CPU%u\n", i, cpu);
+ pr_warning("IRQ%u no longer affine to CPU%u\n", i,
+ smp_processor_id());
}
local_irq_restore(flags);
--
1.7.4.4
next prev parent reply other threads:[~2011-07-21 15:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-21 15:14 [PATCH 0/4] Fix CPU hotplug IRQ migration Russell King - ARM Linux
2011-07-21 15:24 ` [PATCH 1/4] ARM: CPU hotplug: fix abuse of irqdesc->node Russell King - ARM Linux
2011-07-21 15:24 ` [PATCH 2/4] ARM: GIC: avoid routing interrupts to offline CPUs Russell King - ARM Linux
2011-07-21 15:25 ` [PATCH 3/4] ARM: CPU hotplug: pass in proper affinity mask on IRQ migration Russell King - ARM Linux
2011-07-25 12:38 ` Santosh Shilimkar
2011-07-25 13:06 ` Russell King - ARM Linux
2011-07-21 15:25 ` Russell King - ARM Linux [this message]
2011-07-22 5:35 ` [PATCH 0/4] Fix CPU hotplug " Santosh Shilimkar
2011-07-22 8:12 ` Russell King - ARM Linux
2011-07-22 8:22 ` Santosh Shilimkar
2011-07-22 17:14 ` Colin Cross
2011-07-25 13:04 ` Santosh Shilimkar
2011-07-25 13:23 ` Russell King - ARM Linux
2011-07-25 14:27 ` Santosh Shilimkar
2011-07-25 14:46 ` Russell King - ARM Linux
2011-07-25 15:03 ` Santosh Shilimkar
2011-07-22 8:50 ` Will Deacon
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=E1Qjv83-0003Ie-Ui@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).