From e1070bf509b3610baaa337af6bd075cce5b92eab Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 23 Dec 2010 15:17:28 +0000 Subject: [PATCH] Drop the icu_lock spinlock while pausing briefly after masking the interrupt in the I/O APIC before moving it to a different CPU. If the interrupt had been triggered by the I/O APIC after locking icu_lock but before we masked the pin in the I/O APIC, then this could cause the interrupt to be pending on the "old" CPU and it would finally trigger after we had moved the interrupt to the new CPU. This could cause us to panic as there was no interrupt source associated with the old IDT vector on the old CPU. Dropping the lock after the interrupt is masked but before it is moved allows the interrupt to fire and be handled in this case before it is moved. Tested by: Daniel Braniss danny of cs huji ac il MFC after: 1 week --- sys/x86/x86/io_apic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/x86/x86/io_apic.c b/sys/x86/x86/io_apic.c index da97def5324..772aeaabfbe 100644 --- a/sys/x86/x86/io_apic.c +++ b/sys/x86/x86/io_apic.c @@ -359,7 +359,9 @@ ioapic_assign_cpu(struct intsrc *isrc, u_int apic_id) if (!intpin->io_masked && !intpin->io_edgetrigger) { ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), intpin->io_lowreg | IOART_INTMSET); + mtx_unlock_spin(&icu_lock); DELAY(100); + mtx_lock_spin(&icu_lock); } intpin->io_cpu = apic_id;