Page MenuHomeFreeBSD

x86: Fix booting on systems without an APIC
ClosedPublic

Authored by markj on Dec 27 2021, 3:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 11:43 PM
Unknown Object (File)
Thu, Dec 5, 12:52 PM
Unknown Object (File)
Sat, Nov 30, 6:51 PM
Unknown Object (File)
Nov 11 2024, 4:20 PM
Unknown Object (File)
Nov 4 2024, 12:13 PM
Unknown Object (File)
Oct 24 2024, 5:06 AM
Unknown Object (File)
Oct 19 2024, 11:06 AM
Unknown Object (File)
Oct 19 2024, 11:06 AM
Subscribers
None

Details

Summary

Reported and tested by: Michael Butler <imb@protected-networks.net>
Fixes: 62d09b46ad75 ("x86: Defer LAPIC calibration until after timecounters are available")

Diff Detail

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

Event Timeline

markj requested review of this revision.Dec 27 2021, 3:42 PM
markj created this revision.

This sounds very much as something i386-specific, i.e. relevant for Pentium-class machines, or older. Should it be under #ifdef i386? And then x2apic_mode check is not needed.

In D33669#760743, @kib wrote:

This sounds very much as something i386-specific, i.e. relevant for Pentium-class machines, or older.

Indeed, the problem was reported with a pentium 3.

Should it be under #ifdef i386? And then x2apic_mode check is not needed.

I reused the check already present in, e.g., native_lapic_enable_{pmc,cmc}(). I suspect they should all be changed, then.

Should it be under #ifdef i386? And then x2apic_mode check is not needed.

I reused the check already present in, e.g., native_lapic_enable_{pmc,cmc}(). I suspect they should all be changed, then.

Interesting, native_lapic_enable_cmc() uses DEV_ATPIC as the guard. Perhaps all other cases should do the same, there must be lapic if there is no atpic.
And I was wrong that x2apic excludes i386, we do support x2apic mode for i386, just that nobody would run i386 kernel on such machine.

In D33669#760753, @kib wrote:

Should it be under #ifdef i386? And then x2apic_mode check is not needed.

I reused the check already present in, e.g., native_lapic_enable_{pmc,cmc}(). I suspect they should all be changed, then.

Interesting, native_lapic_enable_cmc() uses DEV_ATPIC as the guard. Perhaps all other cases should do the same, there must be lapic if there is no atpic.

And I was wrong that x2apic excludes i386, we do support x2apic mode for i386, just that nobody would run i386 kernel on such machine.

In D33669#760753, @kib wrote:

Should it be under #ifdef i386? And then x2apic_mode check is not needed.

I reused the check already present in, e.g., native_lapic_enable_{pmc,cmc}(). I suspect they should all be changed, then.

Interesting, native_lapic_enable_cmc() uses DEV_ATPIC as the guard. Perhaps all other cases should do the same, there must be lapic if there is no atpic.

Hmm, ok. It looks a bit weird to me: the 8259 does not provide a timer, and the code size reduction on amd64 is minimal.

And I was wrong that x2apic excludes i386, we do support x2apic mode for i386, just that nobody would run i386 kernel on such machine.

Sprinkle DEV_ATPIC guards.

This revision is now accepted and ready to land.Dec 27 2021, 5:37 PM

I think the reason for DEV_ATPIC guards is as kib@ noted: we require a local APIC if device atpic isn't present. I think it is not about the code size so much as you'd rather it crash and burn hard early on if for some reason the local APIC isn't found on a system that assumes a local APIC. The reason for DEV_ATPIC vs __i386__ is that in theory one can add device atpic to an amd64 kernel (though it's been several years since I've tested that and at this point that's probably not worth testing).