Skip to content

Commit 0ca4b6b

Browse files
Matthew Wilcoxtorvalds
authored andcommitted
x86: Fix interrupt leak due to migration
When we migrate an interrupt from one CPU to another, we set the move_in_progress flag and clean up the vectors later once they're not being used. If you're unlucky and call destroy_irq() before the vectors become un-used, the move_in_progress flag is never cleared, which causes the interrupt to become unusable. This was discovered by Jesse Brandeburg for whom it manifested as an MSI-X device refusing to use MSI-X mode when the driver was unloaded and reloaded repeatedly. Signed-off-by: Matthew Wilcox <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 23918b0 commit 0ca4b6b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arch/x86/kernel/io_apic.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,20 @@ static void __clear_irq_vector(int irq)
11401140

11411141
cfg->vector = 0;
11421142
cpus_clear(cfg->domain);
1143+
1144+
if (likely(!cfg->move_in_progress))
1145+
return;
1146+
cpus_and(mask, cfg->old_domain, cpu_online_map);
1147+
for_each_cpu_mask_nr(cpu, mask) {
1148+
for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS;
1149+
vector++) {
1150+
if (per_cpu(vector_irq, cpu)[vector] != irq)
1151+
continue;
1152+
per_cpu(vector_irq, cpu)[vector] = -1;
1153+
break;
1154+
}
1155+
}
1156+
cfg->move_in_progress = 0;
11431157
}
11441158

11451159
void __setup_vector_irq(int cpu)

0 commit comments

Comments
 (0)