[RFC PATCH 2/2] x86/apic: Honor noapictimer on SMP with the TSC deadline timer
From: Jiaming Fan
Date: Sun Nov 22 2026 - 05:31:02 EST
On SMP with "noapictimer", setup_boot_APIC_clock() leaves
CLOCK_EVT_FEAT_DUMMY set so that the local APIC clockevents become dummy
devices driven by the broadcast device. But the TSC deadline branch of
setup_APIC_timer() clears that flag unconditionally, so the option has no
effect on TSC deadline CPUs.
When the local APIC timer is in use and the boot CPU has the TSC deadline
timer, setup_boot_APIC_clock() has already cleared the flag, so clearing
it again there is redundant. Stop doing that, and ask for the PIT on SMP
too so that it can provide the broadcast tick when available.
This changes behaviour for SMP systems booted with "noapictimer": with a
working HPET or PIT the tick moves there, but without one a boot that
works today panics in check_timer() or hangs. Is that acceptable, or
should the option keep being ignored here?
Fixes: 279f1461432c ("x86: apic: Use tsc deadline for oneshot when available")
Signed-off-by: Jiaming Fan <fan.jiaming@xxxxxxxxxxx>
---
arch/x86/kernel/apic/apic.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 6b2e61ae7e240..b25353fe88892 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -592,7 +592,7 @@ static void setup_APIC_timer(void)
if (this_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER)) {
levt->name = "lapic-deadline";
- levt->features &= ~(CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_DUMMY);
+ levt->features &= ~CLOCK_EVT_FEAT_PERIODIC;
levt->features |= CLOCK_EVT_FEAT_CLOCKSOURCE_COUPLED;
levt->cs_id = CSID_X86_TSC;
levt->set_next_event = lapic_next_deadline;
@@ -782,16 +782,14 @@ bool __init apic_needs_pit(void)
if (!boot_cpu_has(X86_FEATURE_ARAT))
return true;
- if (disable_apic_timer && num_possible_cpus() == 1)
+ /* APIC timer disabled? */
+ if (disable_apic_timer)
return true;
/* Deadline timer is based on TSC so no further PIT action required */
if (boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER))
return false;
- /* APIC timer disabled? */
- if (disable_apic_timer)
- return true;
/*
* The APIC timer frequency is known already, no PIT calibration
* required. If unknown, let the PIT be initialized.
--
2.56.1