daniel-p-carvalho commented on code in PR #20782:
URL: https://github.com/apache/nuttx/pull/20782#discussion_r4373363602


##########
drivers/timers/watchdog.c:
##########
@@ -466,12 +510,266 @@ static int wdog_notifier(FAR struct notifier_block *nb, 
unsigned long action,
 }
 #endif
 
-static void wdog_callback(wdparm_t arg)
+#ifdef CONFIG_WATCHDOG_TASKMONITOR
+/* Restart the timeout of a channel, if it is armed */
+
+static void watchdog_taskmonitor_feed(FAR struct watchdog_user_s *user)
+{
+  if (user->armed)
+    {
+      user->deadline = clock_systime_ticks() + user->timeout;
+    }
+}
+
+/* Feed the lower half while no armed channel timed out.  Running from the
+ * low priority work queue also makes the hardware reset the system if that
+ * queue stops.

Review Comment:
   Done in the new head. The task supervision is now part of the auto-monitor: 
WATCHDOG_TASKMONITOR and the choice are gone, and the per-task channels are a 
sub-option, WATCHDOG_AUTOMONITOR_TASKS (default n, so the auto-monitor is 
unchanged without it), with _TIMEOUT and _PANIC.
   
   Every keepalive method (capture, oneshot, timer, wdog, worker, idle) now 
goes through one function that feeds the lower half only while no armed channel 
timed out, so the keepalive logic and the Kconfig (timeout, ping interval) are 
shared. The channel list is protected by a spinlock instead of the mutex, since 
wdog/timer/oneshot/capture run in interrupt context.
   
   The method decides what else resets the system, so I documented it in 
watchdog.rst: the worker also catches a stopped work queue or a locked 
scheduler, the wdog/timer/oneshot ones only a stopped tick or timer, capture 
only checks the channels at the early warning interrupt, idle needs the system 
to go idle.
   
   Tested on the simulator (worker and wdog) and on the EV49N51A with the 
worker; capture and idle are only built. The PR title and description are 
updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to