Index: sys/x86/x86/local_apic.c =================================================================== --- sys/x86/x86/local_apic.c +++ sys/x86/x86/local_apic.c @@ -1641,6 +1641,7 @@ native_apic_free_vector(u_int apic_id, u_int vector, u_int irq) { struct thread *td; + int prev; KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS, @@ -1661,7 +1662,9 @@ if (!rebooting) { thread_lock(td); if (sched_is_bound(td)) - panic("apic_free_vector: Thread already bound.\n"); + prev = PCPU_GET(cpuid); + else + prev = -1; sched_bind(td, apic_cpuid(apic_id)); thread_unlock(td); } @@ -1670,7 +1673,10 @@ mtx_unlock_spin(&icu_lock); if (!rebooting) { thread_lock(td); - sched_unbind(td); + if (prev == -1) + sched_unbind(td); + else + sched_bind(td, prev); thread_unlock(td); } }