genirq/cpuhotplug: Use effective affinity mask

If the architecture supports the effective affinity mask, migrating
interrupts away which are not targeted by the effective mask is
pointless.

They can stay in the user or system supplied affinity mask, but won't be
targetted at any given point as the affinity setter functions need to
validate against the online cpu mask anyway.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/20170619235446.328488490@linutronix.de
This commit is contained in:
Thomas Gleixner 2017-06-20 01:37:39 +02:00
parent 0d3f54257d
commit 415fcf1a22
1 changed files with 11 additions and 3 deletions

View File

@ -14,6 +14,14 @@
#include "internals.h" #include "internals.h"
/* For !GENERIC_IRQ_EFFECTIVE_AFF_MASK this looks at general affinity mask */
static inline bool irq_needs_fixup(struct irq_data *d)
{
const struct cpumask *m = irq_data_get_effective_affinity_mask(d);
return cpumask_test_cpu(smp_processor_id(), m);
}
static bool migrate_one_irq(struct irq_desc *desc) static bool migrate_one_irq(struct irq_desc *desc)
{ {
struct irq_data *d = irq_desc_get_irq_data(desc); struct irq_data *d = irq_desc_get_irq_data(desc);
@ -42,9 +50,7 @@ static bool migrate_one_irq(struct irq_desc *desc)
* Note: Do not check desc->action as this might be a chained * Note: Do not check desc->action as this might be a chained
* interrupt. * interrupt.
*/ */
affinity = irq_data_get_affinity_mask(d); if (irqd_is_per_cpu(d) || !irqd_is_started(d) || !irq_needs_fixup(d)) {
if (irqd_is_per_cpu(d) || !irqd_is_started(d) ||
!cpumask_test_cpu(smp_processor_id(), affinity)) {
/* /*
* If an irq move is pending, abort it if the dying CPU is * If an irq move is pending, abort it if the dying CPU is
* the sole target. * the sole target.
@ -69,6 +75,8 @@ static bool migrate_one_irq(struct irq_desc *desc)
*/ */
if (irq_fixup_move_pending(desc, true)) if (irq_fixup_move_pending(desc, true))
affinity = irq_desc_get_pending_mask(desc); affinity = irq_desc_get_pending_mask(desc);
else
affinity = irq_data_get_affinity_mask(d);
/* Mask the chip for interrupts which cannot move in process context */ /* Mask the chip for interrupts which cannot move in process context */
if (maskchip && chip->irq_mask) if (maskchip && chip->irq_mask)