Page MenuHomeFreeBSD

Mask local APIC vectors on init, before enabling interrupts
ClosedPublic

Authored by kib on Mon, Jan 5, 11:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 23, 1:58 AM
Unknown Object (File)
Mon, Jan 19, 5:11 PM
Unknown Object (File)
Sat, Jan 17, 11:39 PM
Unknown Object (File)
Wed, Jan 14, 1:59 AM
Unknown Object (File)
Tue, Jan 13, 4:06 AM
Unknown Object (File)
Mon, Jan 12, 2:06 AM
Unknown Object (File)
Sat, Jan 10, 5:35 PM
Unknown Object (File)
Fri, Jan 9, 9:30 PM
Subscribers

Details

Summary

If APIC is left in somewhat bad state, with some source hot (not masked and active, e.g. timers after kexec or due to BIOS bug), we get the interrupt too early.

x86/local_apic.c: convert lvts[] and elvts[] arrays to designated initializers


x88/local_apic.c: for each lvt element, add LVT register index


x86: mask all LAPIC vectors early, before BSP interrupts are enabled

Reported by: jmg

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Mon, Jan 5, 11:34 PM

If APIC is left in somewhat bad state, with some source hot (not masked and active, e.g. timers after kexec or due to BIOS bug), we get the interrupt too early.

Shouldn't kexec be masking all interrupt sources before starting the new kernel?

sys/x86/x86/local_apic.c
150–208

Can we keep the const party going?

kib marked an inline comment as done.EditedTue, Jan 6, 12:25 AM

If APIC is left in somewhat bad state, with some source hot (not masked and active, e.g. timers after kexec or due to BIOS bug), we get the interrupt too early.

Shouldn't kexec be masking all interrupt sources before starting the new kernel?

I (strongly) believe that this is the wrong side. Kexec kernel should not care, it is the booting kernel that suffer, and it should be prepared for arbitrary state. I also mentioned the broken BIOS or VMM as an example.

To reformulate, we must correctly initialize hardware. In this case, it is currently not correct, and doing it correct is not hard.

sys/x86/x86/local_apic.c
150–208

I tried that, it does not work. E.g. lapic_enable_pcint() modifies the elements of the array.

This revision is now accepted and ready to land.Tue, Jan 6, 1:23 AM