Commit 340233dcc016 ("parisc: Mark cr16 clock unstable on all SMP machines") stopped the kernel from using cr16 as its clocksource on SMP, because the cr16 interval timers of different CPUs are not synchronized. Commit b5ff52be8913 ("parisc: Convert to generic clockevents") moved the clocksource registration into time_init() and dropped that check, so SMP machines use cr16 for timekeeping again. On a C8000 with two PA-8900s, the cr16 timers of all four CPUs differ, by 0.5 seconds between the cores of one processor and by almost 3 seconds across processors. With cr16 as the clocksource, time jumps backwards whenever a task moves to another CPU, and systemd-journald keeps rotating its journal with "Time jumped backwards". Register the clocksource from a device_initcall() again, once the secondary CPUs are online, and mark it unstable on SMP as before. Fixes: b5ff52be8913 ("parisc: Convert to generic clockevents") Cc: stable@vger.kernel.org # v6.12+ Signed-off-by: Matt Turner --- arch/parisc/kernel/time.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index 71c9d5426995..c14fb9002cdd 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c @@ -229,7 +229,23 @@ void __init time_init(void) /* check for free-running 64-bit platform counter */ parisc_find_64bit_counter(); - - /* register at clocksource framework */ - clocksource_register_hz(&clocksource_cr16, cr16_clock_freq); } + +/* + * Registered once the secondary CPUs are up: time_init() runs before that, + * when num_online_cpus() is still 1. + */ +static int __init init_cr16_clocksource(void) +{ + /* The cr16 interval timers are not synchronized across CPUs. */ + if (num_online_cpus() > 1 && !running_on_qemu) { + clocksource_cr16.name = "cr16_unstable"; + clocksource_cr16.flags = CLOCK_SOURCE_UNSTABLE; + clocksource_cr16.rating = 0; + } + + clocksource_register_hz(&clocksource_cr16, cr16_clock_freq); + + return 0; +} +device_initcall(init_cr16_clocksource); --- base-commit: 9437ee8b6cf607e883b36e44bd755968daaebd48 change-id: 20261126-parisc-cr16-smp-c6327c4c178e Best regards, -- Matt Turner