From: Grzegorz Jaszczyk <jaszczyk@chromium.org>
To: tglx@kernel.org
Cc: linux-kernel@vger.kernel.org, dmaluka@chromium.org,
vineethrp@chromium.org, chuanxiao.dong@intel.com,
jaszczyk@google.com, Grzegorz Jaszczyk <jaszczyk@chromium.org>
Subject: [PATCH v2 0/4] x86/apic: Switch to x2apic driver early if x2apic is enabled
Date: Thu, 24 Sep 2026 10:40:17 +0000 [thread overview]
Message-ID: <20260924104102.3534474-1-jaszczyk@chromium.org> (raw)
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/20260910090512.1197517-1-jaszczyk@chromium.org/
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(-)
--
2.56.0.rc1.315.gc6ed9934b7-goog
next reply other threads:[~2026-09-24 10:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 10:40 Grzegorz Jaszczyk [this message]
2026-09-24 10:40 ` [PATCH v2 1/4] x86/apic: Rename init_apic_mappings() to apic_finalize_early_init() Grzegorz Jaszczyk
2026-09-24 10:40 ` [PATCH v2 2/4] x86/apic: Consolidate early APIC initialization into apic_early_init() Grzegorz Jaszczyk
2026-09-24 10:40 ` [PATCH v2 3/4] x86/apic: Remove redundant check from x2apic_phys_probe() Grzegorz Jaszczyk
2026-09-24 10:40 ` [PATCH v2 4/4] x86/apic: Switch to x2apic driver early if x2apic is enabled Grzegorz Jaszczyk
2026-10-17 21:04 ` [PATCH v2 0/4] " Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260924104102.3534474-1-jaszczyk@chromium.org \
--to=jaszczyk@chromium.org \
--cc=chuanxiao.dong@intel.com \
--cc=dmaluka@chromium.org \
--cc=jaszczyk@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=vineethrp@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®