This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 91008cf1b1a sched/clock: keep the seqlock sequence in uint32_t
91008cf1b1a is described below
commit 91008cf1b1a411e8d1cdd8ae17548a7e919be523
Author: Alan Carvalho de Assis <[email protected]>
AuthorDate: Wed Sep 30 14:23:40 2026 -0300
sched/clock: keep the seqlock sequence in uint32_t
clock_get_sched_ticks() stored the value of read_seqbegin(), a
uint32_t, in an unsigned int and passed it back to read_seqretry().
Where int is 16 bits the copy is truncated, so once the 32-bit
sequence number passes 65535 read_seqretry() always reports a change
and the loop never ends. The sequence advances once per tick, so after
65536 ticks (11 minutes at 100 Hz) the next caller, the timer interrupt
itself, spins forever with interrupts disabled and the system stops.
Seen on the CDP1802 (16-bit int): NSH stopped answering after 55
minutes at 20 Hz. AVR has the same problem. hrtimer's readers of the
same lock already use uint32_t. Don't assume int is 32-bit :-D
Signed-off-by: Alan Carvalho de Assis <[email protected]>
Assisted-by: Claude Opus 5.5 (claude-opus-5-5)
---
sched/clock/clock_sched_ticks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sched/clock/clock_sched_ticks.c b/sched/clock/clock_sched_ticks.c
index 282a51450f7..48de47c272d 100644
--- a/sched/clock/clock_sched_ticks.c
+++ b/sched/clock/clock_sched_ticks.c
@@ -117,7 +117,7 @@ void clock_increase_sched_ticks(clock_t ticks)
clock_t clock_get_sched_ticks(void)
{
clock_t ret;
- unsigned int seq;
+ uint32_t seq;
do
{