mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jiaming Fan" <fan.jiaming@hotmail.com>
To: "Thomas Gleixner" <tglx@kernel.org>,
	 "Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	 "Dave Hansen" <dave.hansen@linux.intel.com>
Cc: <x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	 <linux-kernel@vger.kernel.org>
Subject: [RFC PATCH 2/2] x86/apic: Honor noapictimer on SMP with the TSC deadline timer
Date: Sun, 22 Nov 2026 10:30:50 +0000	[thread overview]
Message-ID: <OS3PR01MB102516718F4CCEC2E3F43AF94E7462@OS3PR01MB10251.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <OS3PR01MB10251F5C8A7346BFEE8448F14E7462@OS3PR01MB10251.jpnprd01.prod.outlook.com>

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@hotmail.com>
---
 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



      parent reply	other threads:[~2026-11-22 10:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 10:29 [PATCH 0/2] x86/apic: Make noapictimer work " Jiaming Fan
2026-11-22 10:30 ` [PATCH 1/2] x86/timer: Don't skip PIT setup on UP when the local APIC timer is disabled Jiaming Fan
2026-11-22 10:30 ` Jiaming Fan [this message]

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=OS3PR01MB102516718F4CCEC2E3F43AF94E7462@OS3PR01MB10251.jpnprd01.prod.outlook.com \
    --to=fan.jiaming@hotmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.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®