x86/apic: Switch to x2apic driver early if x2apic is enabled
Status from this message: The following commit has been merged into the x86/apic branch of tip:
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest4 patches 1 replyApplied
- v11 patch 6 repliesSuperseded
Changes in v2 from the cover letter
- Reworked v1 based on Thomas Gleixner's feedback and suggested draft, splitting it into a 4-patch series and addressing several issues from the initial draft (!CONFIG_X86_LOCAL_APIC stubs, handling early apic_is_disabled in apic_early_init(), and avoiding duplicate routing log messages and the 'apic->probed' flag by dropping the dead check in x2apic_phys_probe()):
- Rename init_apic_mappings() to apic_finalize_early_init().
- Consolidate acpi_mps_check(), check_x2apic(), and apic_setup_apic_calls() from setup_arch() into apic_early_init().
- Remove the redundant 'return apic == &apic_x2apic_phys;' check from x2apic_phys_probe() (dead code since commit cb214ede7657), which allows apic_x2apic_phys to be used as the early default driver without needing an extra 'apic->probed' flag in struct apic for x2apic_cluster to probe later.
- Replace apic_setup_apic_calls() with apic_install_default_driver() and install apic_x2apic_phys or apic_noop as the early default driver in apic_early_init().
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | x86/apic: Rename init_apic_mappings() to apic_finalize_early_init()arch/ arch/ arch/ | +4 | 0 replies | |
| 2/4 | x86/apic: Consolidate early APIC initialization into apic_early_init()arch/ arch/ arch/ | +17 | 0 replies | |
| 3/4 | x86/apic: Remove redundant check from x2apic_phys_probe()arch/ | +1 | 0 replies | |
| 4/4 | x86/apic: Switch to x2apic driver early if x2apic is enabledarch/ arch/ arch/ +2 more | +41 | 0 replies |
Reviews trailers per patch
None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Thomas Gleixner |
|---|---|
| Series | R-b |
| 1/4 | |
| 2/4 | |
| 3/4 | |
| 4/4 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/4] x86/apic: Switch to x2apic driver early if x2apic is enabled
During early boot, the generic x86 kernel defaults to the MMIO-based APIC driver (apic_physflat). When booting (e.g., via kexec into a crashdump kernel) with x2APIC already enabled in hardware and without ACPI MADT probing (e.g., !CONFIG_ACPI), the APIC driver pointer remains set to apic_physflat until late_time_init() runs x86_64_probe_apic().
Because check_x2apic() detects hardware x2APIC mode and sets x2apic_mode = 1, the APIC MMIO fixmap is not mapped. If a pending interrupt fires in the window between local_irq_enable() and late_time_init(), native_apic_mem_eoi() attempts to write to the unmapped APIC EOI MMIO address, resulting in an early boot page fault (#PF).
This series restructures early APIC initialization and installs apic_x2apic_phys (or apic_noop if the APIC is disabled or built without CONFIG_X86_X2APIC) as the default APIC driver in apic_early_init(), ensuring safe MSR-based or no-op APIC accesses while still allowing later APIC probing (e.g., upgrading to apic_x2apic_cluster) to proceed normally.
Changes in v2:
- Reworked v1 based on Thomas Gleixner's feedback and suggested draft, splitting it into a 4-patch series and addressing several issues from the initial draft (!CONFIG_X86_LOCAL_APIC stubs, handling early apic_is_disabled in apic_early_init(), and avoiding duplicate routing log messages and the 'apic->probed' flag by dropping the dead check in x2apic_phys_probe()):
- Rename init_apic_mappings() to apic_finalize_early_init().
- Consolidate acpi_mps_check(), check_x2apic(), and apic_setup_apic_calls() from setup_arch() into apic_early_init().
- Remove the redundant 'return apic == &apic_x2apic_phys;' check from x2apic_phys_probe() (dead code since commit cb214ede7657), which allows apic_x2apic_phys to be used as the early default driver without needing an extra 'apic->probed' flag in struct apic for x2apic_cluster to probe later.
- Replace apic_setup_apic_calls() with apic_install_default_driver() and install apic_x2apic_phys or apic_noop as the early default driver in apic_early_init().
v1: https://lore.kernel.org/all/[email protected]/
Grzegorz Jaszczyk (4):
x86/apic: Rename init_apic_mappings() to apic_finalize_early_init() x86/apic: Consolidate early APIC initialization into apic_early_init() x86/apic: Remove redundant check from x2apic_phys_probe() x86/apic: Switch to x2apic driver early if x2apic is enabled
arch/x86/include/asm/apic.h | 11 ++++------ arch/x86/kernel/apic/apic.c | 33 +++++++++++++++++++++++------- arch/x86/kernel/apic/init.c | 32 ++++++++++++++++++----------- arch/x86/kernel/apic/local.h | 4 ++++ arch/x86/kernel/apic/x2apic_phys.c | 9 ++------ arch/x86/kernel/setup.c | 12 ++--------- 6 files changed, 58 insertions(+), 43 deletions(-)
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog