From 1b1e8325ea6b55f4400e6800cd78b6841e4d17b4 Mon Sep 17 00:00:00 2001 From: wangchengdong Date: Wed, 12 Nov 2025 16:41:48 +0800 Subject: [PATCH 1/2] nuttx/arch.h: remove un-needed macro wrapper on tickless functions remove un-needed macro wrapper on tickless functions: up_timer_start/up_alarm_start to fix build issue Signed-off-by: Chengdong Wang --- include/nuttx/arch.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 0a6ae78040230..bd3b1c0d06062 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -1967,11 +1967,8 @@ void up_timer_getmask(FAR clock_t *mask); ****************************************************************************/ #if defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM) -# ifndef CONFIG_SCHED_TICKLESS_TICK_ARGUMENT int up_alarm_cancel(FAR struct timespec *ts); -# else int up_alarm_tick_cancel(FAR clock_t *ticks); -# endif #endif /**************************************************************************** @@ -2000,11 +1997,8 @@ int up_alarm_tick_cancel(FAR clock_t *ticks); ****************************************************************************/ #if defined(CONFIG_SCHED_TICKLESS) && defined(CONFIG_SCHED_TICKLESS_ALARM) -# ifndef CONFIG_SCHED_TICKLESS_TICK_ARGUMENT int up_alarm_start(FAR const struct timespec *ts); -# else int up_alarm_tick_start(clock_t ticks); -# endif #endif /**************************************************************************** @@ -2044,11 +2038,8 @@ int up_alarm_tick_start(clock_t ticks); ****************************************************************************/ #if defined(CONFIG_SCHED_TICKLESS) && !defined(CONFIG_SCHED_TICKLESS_ALARM) -# ifndef CONFIG_SCHED_TICKLESS_TICK_ARGUMENT int up_timer_cancel(FAR struct timespec *ts); -# else int up_timer_tick_cancel(FAR clock_t *ticks); -# endif #endif /**************************************************************************** @@ -2077,11 +2068,8 @@ int up_timer_tick_cancel(FAR clock_t *ticks); ****************************************************************************/ #if defined(CONFIG_SCHED_TICKLESS) && !defined(CONFIG_SCHED_TICKLESS_ALARM) -# ifndef CONFIG_SCHED_TICKLESS_TICK_ARGUMENT int up_timer_start(FAR const struct timespec *ts); -# else int up_timer_tick_start(clock_t ticks); -# endif #endif /**************************************************************************** From 728baf9c1f8d95c953c8259032d8425f049b0ce5 Mon Sep 17 00:00:00 2001 From: wangchengdong Date: Wed, 12 Nov 2025 16:44:58 +0800 Subject: [PATCH 2/2] sched/wdog: Fix tickless watchdog handling issue In tickless mode, if a newly added watchdog has an expiration time earlier than the current system time, the timer interrupt needs to be triggered as soon as possible. Otherwise, it may cause nxsched_reassess_timer() to start the timer with an already expired timeout. Signed-off-by: Chengdong Wang --- sched/wdog/wd_start.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sched/wdog/wd_start.c b/sched/wdog/wd_start.c index 2b4ac7b4d5173..3d0929205bd9c 100644 --- a/sched/wdog/wd_start.c +++ b/sched/wdog/wd_start.c @@ -313,6 +313,16 @@ int wd_start_abstick(FAR struct wdog_s *wdog, clock_t ticks, reassess |= wd_insert(wdog, ticks, wdentry, arg); + if (clock_compare(wdog->expired, clock_systime_ticks())) + { +# ifdef CONFIG_SCHED_TICKLESS_ALARM + up_alarm_tick_start(clock_systime_ticks() + 1); +# else + up_timer_tick_start(clock_systime_ticks() + 1); +# endif + reassess = false; + } + if (!g_wdtimernested && reassess) { /* Resume the interval timer that will generate the next