Page MenuHomeFreeBSD

Enable interrupts on the BSP once all PICs are initialized.
ClosedPublic

Authored by jhb on Mar 22 2016, 9:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 2, 3:54 PM
Unknown Object (File)
Sep 22 2024, 11:19 AM
Unknown Object (File)
Sep 18 2024, 4:53 PM
Unknown Object (File)
Sep 17 2024, 8:17 PM
Unknown Object (File)
Sep 17 2024, 8:13 AM
Unknown Object (File)
Sep 17 2024, 3:18 AM
Unknown Object (File)
Sep 16 2024, 1:01 AM
Unknown Object (File)
Sep 15 2024, 2:44 PM
Subscribers

Details

Summary

Enable interrupts on the BSP once all PICs are initialized.

This moves the enabling of interrupts slightly earlier (the old location
was still before devices were enumerated and probed) and does it in the
interrupt code (rather than in the device configuration code). This
also avoids tripping over an assertion on the first TLB shootdown with
earlier AP startup.

Test Plan
  • booted in kernels both with and without early AP startup enabled in both VMs and real hardware

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb retitled this revision from to Enable interrupts on the BSP once all PICs are initialized..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added a reviewer: kib.

Seems sane to me.

Do we need code on other platforms though to do something similar? this is an area I'd think we'd want to keep as uniform as possible across the stable of architectures we have.

kib edited edge metadata.

So the goal is to avoid the

	if (!(read_eflags() & PSL_I))
		panic("%s: interrupts disabled", __func__);

with earlier TLB shootdown ? I am fine with this.

As a side note, TLB shootdowns are meaningless until APs are started in scheduler, and probably cannot even work. E.g., the interrupt handlers must send EOI, but we only configure LAPIC, including properly setting x2APIC mode, only after the APs are unfrozen. We even do not configure MTRRs before that point, which probably have 'interesting' consequences for early TLB shootdowns.

APs implicitely flush TLB on the route to full operation after unreeze.

This revision is now accepted and ready to land.Mar 23 2016, 10:14 AM
In D5710#121985, @imp wrote:

Seems sane to me.

Do we need code on other platforms though to do something similar? this is an area I'd think we'd want to keep as uniform as possible across the stable of architectures we have.

Well, this part of startup is typically MD. However, I would expect other platforms might need a similar change as they switch to EARLY_AP_STARTUP. I don't think it can be done in a centralized place. OTOH, doing it in SI_SUB_INTR is probably more consistent overall.

In D5710#122059, @kib wrote:

So the goal is to avoid the

	if (!(read_eflags() & PSL_I))
		panic("%s: interrupts disabled", __func__);

with earlier TLB shootdown ? I am fine with this.

Correct.

As a side note, TLB shootdowns are meaningless until APs are started in scheduler, and probably cannot even work. E.g., the interrupt handlers must send EOI, but we only configure LAPIC, including properly setting x2APIC mode, only after the APs are unfrozen. We even do not configure MTRRs before that point, which probably have 'interesting' consequences for early TLB shootdowns.

APs implicitely flush TLB on the route to full operation after unreeze.

Yes, we already conditionalize TLB shootdowns on 'smp_started' which isn't set until the APs are out of the pen. However, in the pending patches to move AP unpenning earlier (before device probe), the APs are now unpenned and running before the old SYSINIT ran which triggered the panic.

This revision was automatically updated to reflect the committed changes.