* [PATCH 0/1] sparc64: Fix tick/stick comparator equal-compare hazard
@ 2026-05-18 23:56 Tony Rodriguez
2026-05-18 23:56 ` [PATCH 1/1] " Tony Rodriguez
0 siblings, 1 reply; 3+ messages in thread
From: Tony Rodriguez @ 2026-05-18 23:56 UTC (permalink / raw)
To: davem, sparclinux
Cc: linux-kernel, andreas, tglx, thomas.weissschuh, regressions,
glaubitz, linux, torvalds, Tony Rodriguez
sparc64: avoid missed timer interrupts when comparator equals counter
This patch fixes an equal‑compare hazard in the SPARC64 tick/stick comparator
logic that can cause missed timer interrupts and stalled hrtimers.
Full dmesg and crash dumps:
https://github.com/unixpro1970/Sparc64-Kernel-Debugging-Dumps/blob/main/s7-2-05122026-dump.tar.gz
Debugging discussion:
https://lore.kernel.org/all/87tssb6olo.ffs@tglx/
https://lore.kernel.org/all/871pfcznw0.ffs@tglx/
Short dmesg excerpt:
[ 48.632215] rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
[ 48.676018] rcu: rcu_sched kthread timer wakeup didn't happen for 5259 jiffies!
[ 48.743621] rcu: Possible timer handling issue on cpu=100 timer-softirq=15
Test summary:
After applying this patch, S7-2 and T7-1 systems no longer hang on v7 and v7.1 kernels.
Tony Rodriguez (1):
sparc64: Fix tick/stick comparator equal-compare hazard
arch/sparc/kernel/time_64.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] sparc64: Fix tick/stick comparator equal-compare hazard
2026-05-18 23:56 [PATCH 0/1] sparc64: Fix tick/stick comparator equal-compare hazard Tony Rodriguez
@ 2026-05-18 23:56 ` Tony Rodriguez
2026-05-19 2:39 ` Tony Rodriguez
0 siblings, 1 reply; 3+ messages in thread
From: Tony Rodriguez @ 2026-05-18 23:56 UTC (permalink / raw)
To: davem, sparclinux
Cc: linux-kernel, andreas, tglx, thomas.weissschuh, regressions,
glaubitz, linux, torvalds, Tony Rodriguez
On SPARC64 the timer interrupt is generated only when the counter
equals the comparator (tick == tick_cmpr). There is a latency between
writing the comparator register and the comparator becoming active.
If the counter reaches the comparator value before the comparator is
armed, the equality moment can be missed and the hardware may not
generate the interrupt.
Previously the helper treated equality as success:
return ((long)(new_tick - (orig_tick + adj))) > 0L;
Here `exp` is the expected comparator value (orig_tick + adj). If
new_tick == exp the code considered the event scheduled, but the
hardware may already have missed the equality window. Treat equality
as failure so the caller will retry with a later expiration:
return ((long)(new_tick - (orig_tick + adj))) >= 0L;
This prevents missed timer interrupts and stalled hrtimers on affected
SPARC64 systems.
Signed-off-by: Tony Rodriguez <unixpro1970@gmail.com>
---
arch/sparc/kernel/time_64.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 87b267043ccd..783b60e547c4 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -146,7 +146,7 @@ static int tick_add_compare(unsigned long adj)
: "=r" (new_tick));
new_tick &= ~TICKCMP_IRQ_BIT;
- return ((long)(new_tick - (orig_tick+adj))) > 0L;
+ return ((long)(new_tick - (orig_tick+adj))) >= 0L;
}
static unsigned long tick_add_tick(unsigned long adj)
@@ -277,7 +277,7 @@ static int stick_add_compare(unsigned long adj)
: "=r" (new_tick));
new_tick &= ~TICKCMP_IRQ_BIT;
- return ((long)(new_tick - (orig_tick+adj))) > 0L;
+ return ((long)(new_tick - (orig_tick+adj))) >= 0L;
}
static unsigned long stick_get_frequency(void)
@@ -411,7 +411,7 @@ static int hbtick_add_compare(unsigned long adj)
val2 = __hbird_read_stick() & ~TICKCMP_IRQ_BIT;
- return ((long)(val2 - val)) > 0L;
+ return ((long)(val2 - val)) >= 0L;
}
static unsigned long hbtick_get_frequency(void)
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] sparc64: Fix tick/stick comparator equal-compare hazard
2026-05-18 23:56 ` [PATCH 1/1] " Tony Rodriguez
@ 2026-05-19 2:39 ` Tony Rodriguez
0 siblings, 0 replies; 3+ messages in thread
From: Tony Rodriguez @ 2026-05-19 2:39 UTC (permalink / raw)
To: davem, sparclinux
Cc: linux-kernel, andreas, tglx, thomas.weissschuh, regressions,
glaubitz, linux, torvalds
Created a new patch regarding this topic.
Please see:
https://lore.kernel.org/all/20260519022421.5978-2-unixpro1970@gmail.com/
https://lore.kernel.org/all/20260519022421.5978-1-unixpro1970@gmail.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-19 2:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-18 23:56 [PATCH 0/1] sparc64: Fix tick/stick comparator equal-compare hazard Tony Rodriguez
2026-05-18 23:56 ` [PATCH 1/1] " Tony Rodriguez
2026-05-19 2:39 ` Tony Rodriguez
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®