Skip to content

Commit 469ff20

Browse files
xzpeterKAGA-KOKO
authored andcommitted
x86/vector: Remove warning on managed interrupt migration
The vector management code assumes that managed interrupts cannot be migrated away from an online CPU. free_moved_vector() has a WARN_ON_ONCE() which triggers when a managed interrupt vector association on a online CPU is cleared. The CPU offline code uses a different mechanism which cannot trigger this. This assumption is not longer correct because the new CPU isolation feature which affects the placement of managed interrupts must be able to move a managed interrupt away from an online CPU. There are two reasons why this can happen: 1) When the interrupt is activated the affinity mask which was established in irq_create_affinity_masks() is handed in to the vector allocation code. This mask contains all CPUs to which the interrupt can be made affine to, but this does not take the CPU isolation 'managed_irq' mask into account. When the interrupt is finally requested by the device driver then the affinity is checked again and the CPU isolation 'managed_irq' mask is taken into account, which moves the interrupt to a non-isolated CPU if possible. 2) The interrupt can be affine to an isolated CPU because the non-isolated CPUs in the calculated affinity mask are not online. Once a non-isolated CPU which is in the mask comes online the interrupt is migrated to this non-isolated CPU In both cases the regular online migration mechanism is used which triggers the WARN_ON_ONCE() in free_moved_vector(). Case #1 could have been addressed by taking the isolation mask into account, but that would require a massive code change in the activation logic and the eventual migration event was accepted as a reasonable tradeoff when the isolation feature was developed. But even if #1 would be addressed, #2 would still trigger it. Of course the warning in free_moved_vector() was overlooked at that time and the above two cases which have been discussed during patch review have obviously never been tested before the final submission. So keep it simple and remove the warning. [ tglx: Rewrote changelog and added a comment to free_moved_vector() ] Fixes: 11ea68f ("genirq, sched/isolation: Isolate from handling managed interrupts") Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ming Lei <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 985e537 commit 469ff20

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

arch/x86/kernel/apic/vector.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -838,13 +838,15 @@ static void free_moved_vector(struct apic_chip_data *apicd)
838838
bool managed = apicd->is_managed;
839839

840840
/*
841-
* This should never happen. Managed interrupts are not
842-
* migrated except on CPU down, which does not involve the
843-
* cleanup vector. But try to keep the accounting correct
844-
* nevertheless.
841+
* Managed interrupts are usually not migrated away
842+
* from an online CPU, but CPU isolation 'managed_irq'
843+
* can make that happen.
844+
* 1) Activation does not take the isolation into account
845+
* to keep the code simple
846+
* 2) Migration away from an isolated CPU can happen when
847+
* a non-isolated CPU which is in the calculated
848+
* affinity mask comes online.
845849
*/
846-
WARN_ON_ONCE(managed);
847-
848850
trace_vector_free_moved(apicd->irq, cpu, vector, managed);
849851
irq_matrix_free(vector_matrix, cpu, vector, managed);
850852
per_cpu(vector_irq, cpu)[vector] = VECTOR_UNUSED;

0 commit comments

Comments
 (0)