Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1226673 > unrolled thread
| Started by | Yang Yingliang <yangyingliang@huawei.com> |
|---|---|
| First post | 2015-09-17 07:30 +0200 |
| Last post | 2015-09-18 03:20 +0200 |
| Articles | 5 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC PATCH v4 2/4] genirq: add move_irqs() for cpu hotplug Yang Yingliang <yangyingliang@huawei.com> - 2015-09-17 07:30 +0200
Re: [RFC PATCH v4 2/4] genirq: add move_irqs() for cpu hotplug Marc Zyngier <marc.zyngier@arm.com> - 2015-09-17 18:50 +0200
Re: [RFC PATCH v4 2/4] genirq: add move_irqs() for cpu hotplug Thomas Gleixner <tglx@linutronix.de> - 2015-09-18 00:10 +0200
Re: [RFC PATCH v4 2/4] genirq: add move_irqs() for cpu hotplug Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-09-18 00:20 +0200
Re: [RFC PATCH v4 2/4] genirq: add move_irqs() for cpu hotplug Yang Yingliang <yangyingliang@huawei.com> - 2015-09-18 03:20 +0200
| From | Yang Yingliang <yangyingliang@huawei.com> |
|---|---|
| Date | 2015-09-17 07:30 +0200 |
| Subject | [RFC PATCH v4 2/4] genirq: add move_irqs() for cpu hotplug |
| Message-ID | <q9zVE-2aZ-7@gated-at.bofh.it> |
Add move_irqs() into kernel/irq/migration.c.
So we can use it to migrate interrupts, when
cpu is offline.
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
include/linux/irq.h | 4 +++
kernel/irq/migration.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 6f8b340..64e3a02 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -446,6 +446,10 @@ static inline void irq_move_irq(struct irq_data *data) { }
static inline void irq_move_masked_irq(struct irq_data *data) { }
#endif
+#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_IRQ_MIGRATION) && defined(CONFIG_HOTPLUG_CPU)
+void move_irqs(void);
+#endif
+
extern int no_irq_affinity;
#ifdef CONFIG_HARDIRQS_SW_RESEND
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
index 1ff2b77..75bff60 100644
--- a/kernel/irq/migration.c
+++ b/kernel/irq/migration.c
@@ -1,6 +1,7 @@
#include <linux/irq.h>
#include <linux/interrupt.h>
+#include <linux/ratelimit.h>
#include "internals.h"
@@ -79,3 +80,68 @@ void irq_move_irq(struct irq_data *idata)
idata->chip->irq_unmask(idata);
}
#endif
+
+#ifdef CONFIG_HOTPLUG_CPU
+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;
+ ret = true;
+ }
+
+ c = irq_data_get_irq_chip(d);
+ if (!c->irq_set_affinity) {
+ pr_warn_ratelimited("IRQ%u: unable to set affinity\n", d->irq);
+ } else {
+ int r = irq_do_set_affinity(d, affinity, false);
+ if (r)
+ pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", d->irq, r);
+ }
+
+ return ret;
+}
+
+/*
+ * 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 move_irqs(void)
+{
+ unsigned int irq;
+ struct irq_desc *desc;
+ unsigned long flags;
+
+ local_irq_save(flags);
+
+ for_each_active_irq(irq) {
+ bool affinity_broken;
+
+ desc = irq_to_desc(irq);
+ raw_spin_lock(&desc->lock);
+ affinity_broken = migrate_one_irq(desc);
+ raw_spin_unlock(&desc->lock);
+
+ if (affinity_broken)
+ pr_warn_ratelimited("IRQ%u no longer affine to CPU%u\n",
+ irq, smp_processor_id());
+ }
+
+ local_irq_restore(flags);
+}
+#endif /* CONFIG_HOTPLUG_CPU */
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Date | 2015-09-17 18:50 +0200 |
| Message-ID | <q9KxI-W9-13@gated-at.bofh.it> |
| In reply to | #1226673 |
On 17/09/15 06:19, Yang Yingliang wrote:
> Add move_irqs() into kernel/irq/migration.c.
> So we can use it to migrate interrupts, when
> cpu is offline.
>
> Cc: Jiang Liu <jiang.liu@linux.intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
> Cc: Hanjun Guo <hanjun.guo@linaro.org>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> include/linux/irq.h | 4 +++
> kernel/irq/migration.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 70 insertions(+)
>
> diff --git a/include/linux/irq.h b/include/linux/irq.h
> index 6f8b340..64e3a02 100644
> --- a/include/linux/irq.h
> +++ b/include/linux/irq.h
> @@ -446,6 +446,10 @@ static inline void irq_move_irq(struct irq_data *data) { }
> static inline void irq_move_masked_irq(struct irq_data *data) { }
> #endif
>
> +#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_IRQ_MIGRATION) && defined(CONFIG_HOTPLUG_CPU)
> +void move_irqs(void);
> +#endif
> +
I don't think having this prototype guarded by this #if is very useful.
You can probably leave it standalone.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2015-09-18 00:10 +0200 |
| Message-ID | <q9Pxo-8wg-15@gated-at.bofh.it> |
| In reply to | #1227206 |
On Thu, 17 Sep 2015, Marc Zyngier wrote:
> On 17/09/15 06:19, Yang Yingliang wrote:
> > Add move_irqs() into kernel/irq/migration.c.
> > So we can use it to migrate interrupts, when
> > cpu is offline.
> >
> > Cc: Jiang Liu <jiang.liu@linux.intel.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Marc Zyngier <marc.zyngier@arm.com>
> > Cc: Mark Rutland <mark.rutland@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
> > Cc: Hanjun Guo <hanjun.guo@linaro.org>
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> > ---
> > include/linux/irq.h | 4 +++
> > kernel/irq/migration.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 70 insertions(+)
> >
> > diff --git a/include/linux/irq.h b/include/linux/irq.h
> > index 6f8b340..64e3a02 100644
> > --- a/include/linux/irq.h
> > +++ b/include/linux/irq.h
> > @@ -446,6 +446,10 @@ static inline void irq_move_irq(struct irq_data *data) { }
> > static inline void irq_move_masked_irq(struct irq_data *data) { }
> > #endif
> >
> > +#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_IRQ_MIGRATION) && defined(CONFIG_HOTPLUG_CPU)
> > +void move_irqs(void);
> > +#endif
> > +
>
> I don't think having this prototype guarded by this #if is very useful.
> You can probably leave it standalone.
Yes, there is no point if the function name is unique. Though
move_irqs() is rather undescriptive. irq_break_affinities() might
describe it quite well, but feel free to come up with soemthing better.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Russell King - ARM Linux <linux@arm.linux.org.uk> |
|---|---|
| Date | 2015-09-18 00:20 +0200 |
| Message-ID | <q9PH4-g0-17@gated-at.bofh.it> |
| In reply to | #1227440 |
On Fri, Sep 18, 2015 at 12:04:06AM +0200, Thomas Gleixner wrote: > On Thu, 17 Sep 2015, Marc Zyngier wrote: > > I don't think having this prototype guarded by this #if is very useful. > > You can probably leave it standalone. > > Yes, there is no point if the function name is unique. Though > move_irqs() is rather undescriptive. irq_break_affinities() might > describe it quite well, but feel free to come up with soemthing better. I don't think "irq_break_affinities" is anywhere near a good name - it's not about always breaking affinities (moving an IRQ off one CPU onto another within the current affinity setting does not break the affinity.) irq_migrate_all() irq_migrate_all_off_this_cpu() irq_this_cpu_hotunplug() irq_cpu_hotunplug() -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Yang Yingliang <yangyingliang@huawei.com> |
|---|---|
| Date | 2015-09-18 03:20 +0200 |
| Message-ID | <q9Svf-4mL-11@gated-at.bofh.it> |
| In reply to | #1227451 |
On 2015/9/18 6:09, Russell King - ARM Linux wrote: > On Fri, Sep 18, 2015 at 12:04:06AM +0200, Thomas Gleixner wrote: >> On Thu, 17 Sep 2015, Marc Zyngier wrote: >>> I don't think having this prototype guarded by this #if is very useful. >>> You can probably leave it standalone. >> >> Yes, there is no point if the function name is unique. Though >> move_irqs() is rather undescriptive. irq_break_affinities() might >> describe it quite well, but feel free to come up with soemthing better. > > I don't think "irq_break_affinities" is anywhere near a good name - it's > not about always breaking affinities (moving an IRQ off one CPU onto > another within the current affinity setting does not break the affinity.) > > irq_migrate_all() > > irq_migrate_all_off_this_cpu() > > irq_this_cpu_hotunplug() > > irq_cpu_hotunplug() > irq_migrate_all_off_this_cpu() describe it well, I will choose it. Thanks, Yang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web