Skip to content

Commit

Permalink
genirq/cpuhotplug: Add support for conditional masking
Browse files Browse the repository at this point in the history
Interrupts which cannot be migrated in process context, need to be masked
before the affinity is changed forcefully.

Add support for that. Will be compiled out for architectures which do not
have this x86 specific issue.

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/20170619235445.604565591@linutronix.de
  • Loading branch information
Thomas Gleixner committed Jun 22, 2017
1 parent f0383c2 commit 47a06d3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion kernel/irq/cpuhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ static bool migrate_one_irq(struct irq_desc *desc)
{
struct irq_data *d = irq_desc_get_irq_data(desc);
struct irq_chip *chip = irq_data_get_irq_chip(d);
bool maskchip = !irq_can_move_pcntxt(d) && !irqd_irq_masked(d);
const struct cpumask *affinity;
bool brokeaff = false;
int err;
Expand Down Expand Up @@ -69,6 +70,10 @@ static bool migrate_one_irq(struct irq_desc *desc)
if (irq_fixup_move_pending(desc, true))
affinity = irq_desc_get_pending_mask(desc);

/* Mask the chip for interrupts which cannot move in process context */
if (maskchip && chip->irq_mask)
chip->irq_mask(d);

if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
affinity = cpu_online_mask;
brokeaff = true;
Expand All @@ -78,8 +83,12 @@ static bool migrate_one_irq(struct irq_desc *desc)
if (err) {
pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n",
d->irq, err);
return false;
brokeaff = false;
}

if (maskchip && chip->irq_unmask)
chip->irq_unmask(d);

return brokeaff;
}

Expand Down

0 comments on commit 47a06d3

Please sign in to comment.