[PATCH] x86-64: Fix race in IO-APIC routing entry setup.
Interrupt could happen between setting the IO-APIC entry and setting its interrupt data. Pointed out by Linus. Signed-off-by: Andi Kleen <ak@suse.de>
This commit is contained in:
parent
d15512f442
commit
516d283643
1 changed files with 10 additions and 4 deletions
|
@ -174,14 +174,20 @@ static struct IO_APIC_route_entry ioapic_read_entry(int apic, int pin)
|
||||||
* the interrupt, and we need to make sure the entry is fully populated
|
* the interrupt, and we need to make sure the entry is fully populated
|
||||||
* before that happens.
|
* before that happens.
|
||||||
*/
|
*/
|
||||||
|
static void
|
||||||
|
__ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e)
|
||||||
|
{
|
||||||
|
union entry_union eu;
|
||||||
|
eu.entry = e;
|
||||||
|
io_apic_write(apic, 0x11 + 2*pin, eu.w2);
|
||||||
|
io_apic_write(apic, 0x10 + 2*pin, eu.w1);
|
||||||
|
}
|
||||||
|
|
||||||
static void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e)
|
static void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
union entry_union eu;
|
|
||||||
eu.entry = e;
|
|
||||||
spin_lock_irqsave(&ioapic_lock, flags);
|
spin_lock_irqsave(&ioapic_lock, flags);
|
||||||
io_apic_write(apic, 0x11 + 2*pin, eu.w2);
|
__ioapic_write_entry(apic, pin, e);
|
||||||
io_apic_write(apic, 0x10 + 2*pin, eu.w1);
|
|
||||||
spin_unlock_irqrestore(&ioapic_lock, flags);
|
spin_unlock_irqrestore(&ioapic_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue