Changeset View
Standalone View
sys/x86/x86/intr_machdep.c
| Show First 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | intr_register_source(struct intsrc *isrc) | ||||
| } | } | ||||
| intrcnt_register(isrc); | intrcnt_register(isrc); | ||||
| interrupt_sources[vector] = isrc; | interrupt_sources[vector] = isrc; | ||||
| isrc->is_handlers = 0; | isrc->is_handlers = 0; | ||||
| sx_xunlock(&intrsrc_lock); | sx_xunlock(&intrsrc_lock); | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| void | |||||
| intr_disable_all(void) | |||||
| { | |||||
| /* | |||||
| * Disable all external interrupts. This is used by kexec_reboot() to | |||||
| * prevent problems on the other side when APs are brought up. | |||||
| */ | |||||
| for (int v = 0; v < num_io_irqs; v++) { | |||||
| struct intsrc *is; | |||||
| is = interrupt_sources[v]; | |||||
| if (is == NULL) | |||||
| continue; | |||||
| if (is->is_pic->pic_disable_intr != NULL) { | |||||
ehem_freebsd_m5p.com: This condition cannot ever be false. Any x86 interrupt controller which has actual interrupts… | |||||
| is->is_pic->pic_disable_source(is, PIC_EOI); | |||||
Not Done Inline ActionsWhy it is not enough to do cli on all cpus? Your stop code does that on all other cores. kib: Why it is not enough to do cli on all cpus? Your stop code does that on all other cores. | |||||
Done Inline ActionsThis disables the interrupt at the IO-APIC, in case the driver didn't do so in the shutdown handler. This avoids the "reserved" interrupt panics in the new kernel. jhibbits: This disables the interrupt at the IO-APIC, in case the driver didn't do so in the shutdown… | |||||
Not Done Inline ActionsAt least add a comment. But, shouldn't the reinit of IOAPICs in the exec-ed kernel prevent this problem? kib: At least add a comment.
But, shouldn't the reinit of IOAPICs in the exec-ed kernel prevent… | |||||
Done Inline ActionsI may be wrong, but my reading of the reference is that the APIC can only be completely reset by a hardware reset, and a software reset doesn't clear pending interrupts. jhibbits: I may be wrong, but my reading of the reference is that the APIC can only be completely reset… | |||||
Not Done Inline ActionsWhich APICs? LAPICs or IOAPICs? BTW, IOAPICs in modern times are often pci devices, so there is chance that they might be reset by some of the normal pci methods (FLR or power reset, or even line re-training), see pci_reset_child(). kib: Which APICs? LAPICs or IOAPICs?
BTW, IOAPICs in modern times are often pci devices, so there… | |||||
Done Inline ActionsFor the LAPIC, 10.4.7.2 (Page 10-10) says pending interrupts are held and require masking or handling by the CPU. Though, 10.4.7.3 states that post-INIT reset state is the same as power-on reset, modulo the APIC ID, so the problem we saw may be caused by IO APIC, and the document I have access to right now doesn't include I/O APIC state after reset, or how to reset the I/O APIC, so I'm mostly going empirically. I just double-checked the Linux source, and it does this to put the I/O APIC back into "legacy mode" jhibbits: For the LAPIC, 10.4.7.2 (Page 10-10) says pending interrupts are held and require masking or… | |||||
Not Done Inline ActionsIs PIC_EOI appropriate here? Unless a driver leaves an interrupt behind there shouldn't be a need and PIC_NO_EOI would be appropriate. ehem_freebsd_m5p.com: Is `PIC_EOI` appropriate here? Unless a driver leaves an interrupt behind there shouldn't be a… | |||||
| is->is_pic->pic_disable_intr(is); | |||||
| } | |||||
| } | |||||
| } | |||||
| struct intsrc * | struct intsrc * | ||||
| intr_lookup_source(int vector) | intr_lookup_source(int vector) | ||||
| { | { | ||||
| if (vector < 0 || vector >= num_io_irqs) | if (vector < 0 || vector >= num_io_irqs) | ||||
| return (NULL); | return (NULL); | ||||
| return (interrupt_sources[vector]); | return (interrupt_sources[vector]); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 525 Lines • Show Last 20 Lines | |||||
This condition cannot ever be false. Any x86 interrupt controller which has actual interrupts must implement this function (ie the lapic pseudo-PIC omits, but it doesn't handle actual interrupts).