]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/apic: Enable TSC coupled programming mode
authorThomas Gleixner <tglx@kernel.org>
Tue, 24 Feb 2026 16:36:49 +0000 (17:36 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 27 Feb 2026 15:40:09 +0000 (16:40 +0100)
commitf246ec3478cfdab830ee0815209f48923e7ee5e2
tree27baa4e3b762a4d86965c2eae68a76190105a8bf
parent89f951a1e8ad781e7ac70eccddab0e0c270485f9
x86/apic: Enable TSC coupled programming mode

The TSC deadline timer is directly coupled to the TSC and setting the next
deadline is tedious as the clockevents core code converts the
CLOCK_MONOTONIC based absolute expiry time to a relative expiry by reading
the current time from the TSC. It converts that delta to cycles and hands
the result to lapic_next_deadline(), which then has read to the TSC and add
the delta to program the timer.

The core code now supports coupled clock event devices and can provide the
expiry time in TSC cycles directly without reading the TSC at all.

This obviouly works only when the TSC is the current clocksource, but
that's the default for all modern CPUs which implement the TSC deadline
timer. If the TSC is not the current clocksource (e.g. early boot) then the
core code falls back to the relative set_next_event() callback as before.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260224163430.076565985@kernel.org
arch/x86/Kconfig
arch/x86/include/asm/clock_inlined.h
arch/x86/kernel/apic/apic.c
arch/x86/kernel/tsc.c