Skip to content

Commit a0b0bad

Browse files
yu-chen-surfKAGA-KOKO
authored andcommitted
genirq/matrix: Exclude managed interrupts in irq_matrix_allocated()
When a CPU is about to be offlined, x86 validates that all active interrupts which are targeted to this CPU can be migrated to the remaining online CPUs. If not, the offline operation is aborted. The validation uses irq_matrix_allocated() to retrieve the number of vectors which are allocated on the outgoing CPU. The returned number of allocated vectors includes also vectors which are associated to managed interrupts. That's overaccounting because managed interrupts are: - not migrated when the affinity mask of the interrupt targets only the outgoing CPU - migrated to another CPU, but in that case the vector is already pre-allocated on the potential target CPUs and must not be taken into account. As a consequence the check whether the remaining online CPUs have enough capacity for migrating the allocated vectors from the outgoing CPU might fail incorrectly. Let irq_matrix_allocated() return only the number of allocated non-managed interrupts to make this validation check correct. [ tglx: Amend changelog and fixup kernel-doc comment ] Fixes: 2f75d9e ("genirq: Implement bitmap matrix allocator") Reported-by: Wendy Wang <[email protected]> Signed-off-by: Chen Yu <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 41efa43 commit a0b0bad

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/irq/matrix.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -466,16 +466,16 @@ unsigned int irq_matrix_reserved(struct irq_matrix *m)
466466
}
467467

468468
/**
469-
* irq_matrix_allocated - Get the number of allocated irqs on the local cpu
469+
* irq_matrix_allocated - Get the number of allocated non-managed irqs on the local CPU
470470
* @m: Pointer to the matrix to search
471471
*
472-
* This returns number of allocated irqs
472+
* This returns number of allocated non-managed interrupts.
473473
*/
474474
unsigned int irq_matrix_allocated(struct irq_matrix *m)
475475
{
476476
struct cpumap *cm = this_cpu_ptr(m->maps);
477477

478-
return cm->allocated;
478+
return cm->allocated - cm->managed_allocated;
479479
}
480480

481481
#ifdef CONFIG_GENERIC_IRQ_DEBUGFS

0 commit comments

Comments
 (0)