parisc: Mark cr16 CPU clocksource unstable on all SMP machines

In commit c8c3735997 ("parisc: Enhance detection of synchronous cr16
clocksources") I assumed that CPUs on the same physical core are syncronous.
While booting up the kernel on two different C8000 machines, one with a
dual-core PA8800 and one with a dual-core PA8900 CPU, this turned out to be
wrong. The symptom was that I saw a jump in the internal clocks printed to the
syslog and strange overall behaviour.  On machines which have 4 cores (2
dual-cores) the problem isn't visible, because the current logic already marked
the cr16 clocksource unstable in this case.

This patch now marks the cr16 interval timers unstable if we have more than one
CPU in the system, and it fixes this issue.

Fixes: c8c3735997 ("parisc: Enhance detection of synchronous cr16 clocksources")
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: <stable@vger.kernel.org> # v5.15+
This commit is contained in:
Helge Deller 2021-12-04 21:21:46 +01:00
parent 0f9fee4cde
commit afdb4a5b1d
1 changed files with 7 additions and 21 deletions

View File

@ -249,30 +249,16 @@ void __init time_init(void)
static int __init init_cr16_clocksource(void) static int __init init_cr16_clocksource(void)
{ {
/* /*
* The cr16 interval timers are not syncronized across CPUs on * The cr16 interval timers are not syncronized across CPUs, even if
* different sockets, so mark them unstable and lower rating on * they share the same socket.
* multi-socket SMP systems.
*/ */
if (num_online_cpus() > 1 && !running_on_qemu) { if (num_online_cpus() > 1 && !running_on_qemu) {
int cpu; /* mark sched_clock unstable */
unsigned long cpu0_loc; clear_sched_clock_stable();
cpu0_loc = per_cpu(cpu_data, 0).cpu_loc;
for_each_online_cpu(cpu) { clocksource_cr16.name = "cr16_unstable";
if (cpu == 0) clocksource_cr16.flags = CLOCK_SOURCE_UNSTABLE;
continue; clocksource_cr16.rating = 0;
if ((cpu0_loc != 0) &&
(cpu0_loc == per_cpu(cpu_data, cpu).cpu_loc))
continue;
/* mark sched_clock unstable */
clear_sched_clock_stable();
clocksource_cr16.name = "cr16_unstable";
clocksource_cr16.flags = CLOCK_SOURCE_UNSTABLE;
clocksource_cr16.rating = 0;
break;
}
} }
/* register at clocksource framework */ /* register at clocksource framework */