wiki:watchdog

Watchdog Timer

Gateworks boards provide both a hardware boot watchdog timer that power cycles the board if boot firmware failed to run as well as SoC watchdogs.

Please see details below on the various differences between hardware watchdogs available and software watchdog daemons.

Terminology used here:

  • SoC (System on Chip) - refers to the chip containing the CPU core as well as vendor peripherals. This is often referred to as the CPU but technically the chips used on Gateworks products are SoC's which marry ARM CPU cores with other perhiperhals inside the chip.
  • resetting the watchdog (aka tickling or petting) refers to restarting the 'countdown timer' in a watchdog.
  • watchdog reset, trigger or expiration - the event that occurs when the internal countdown timer of a watchdog expires which usually results in a chip-level reset, a board-level reset, or a board power-cycle depending on the board and watchdog used.
  • timeout or timeout period - the time before the watchdog will trigger.
  • frequency - the period at which the watchdog will be reset or tickled.

Hardware

GSC Boot Watchdog

This is the most bulletproof watchdog because it runs on the Gateworks System Controller and results in a power-cycle of the board's primary power supply when tripped. Note that this feature is Gateworks specific.

Deficiencies of CPU/SoC watchdogs:

  • they are not enabled at powerup and often not enabled until fairly late when the Linux kernel driver that controls them initializes so if the board hangs (because of software issues or even CPU chip errata) before that, they do not help.
  • they issue a chip-level reset. Depending on the CPU and board design they may also assert an output signal from the chip, but often this does not or can not reach every peripheral chip in the system. This can result in hangs following chip-level reset.

In contrast the GSC boot watchdog benefits are:

  • when expired it momentarily disable the board's primary power supply thus acting as a full board power cycle.
  • is enabled when the board comes out of reset thus it can protect against any software or hardware issue from power-on until your software starts monitoring itself.
  • no driver is needed.

For more info:

Venice(i.MX8M Mini) CPU watchdog

The i.MX8M Mini SoC watchdog will communicate to the Gateworks GSC chip, which will issue a full power reset. This can be reconfigured to be a chip level reset only if desired.

Newport (ARM SBSA) CPU watchdog

The Cavinum CN80XX SoC uses the ARM SBSA watchdog. The CN80XX external watchdog reset output is also an input to the GSC so that the GSC can power-cycle the board if the SoC watchdog expires.

The linux kernel driver(drivers/watchdog/sbsa_gwdt.c) defaults to a 10 second timeout

Ventana (imx6) CPU watchdog

The IMX6 SoC watchdog has an 8bit timeout configuration ranging from 500ms to 128s in 500ms intervals and will issue a chip-level SoC reset. On some boards an external output can also be present to reset other peripherals.

The linux kernel driver (drivers/watchdog/imx2_wdt.c) defaults to 60 seconds and allows a timeout period between 1 and 128 seconds.

Due to some IMX6 chip errata resulting in occasional boot failures when booting from NAND flash (which is used as the primary boot device on all Ventana boards) a GSC 'boot' watchdog is used in a special mode to protect against boot failures. In this mode, the GSC 'boot' watchdog is disabled in the bootloader before launching the OS. If the GSC watchdog is enabled (not to be confused with the GSC 'boot' watchdog which can not be disabled) then the watchdog remains enabled from power-up and must be handled by software in the OS to avoid tripping.

Software

The software side of a watchdog involves the software that is responsible for periodically resetting the watchdog timer (aka tickling or petting) to avoid it triggering. This can be as simple as resetting it based on a timer (without any additional checks) or can be very complex based on a series of complicated system checks.

This is not to be confused with the concept of a 'software watchdog' which is simply code that will perform checks and issue a soft reboot if they are not met. This is usually useful when using boards that have no hardware watchdog(s) available which is not the case for Gateworks products.

The rule of thumb is typically to tickle the watchdog at least twice as fast as its timeout however you may find that you want to increase this frequency if you are heavily loading your system and the watchdog process is not getting enough attention (this varies greatly on your CPU, application load, and kernel configuration).

Linux Kernel Drivers and nowayout

The Linux kernel has a watchdog driver API that can be implemented to provide a common userspace API to a hardware watchdog.

Most Linux watchdog drivers have a nowayout kernel parameter which can be defaulted at build time via the kernel config CONFIG_WATCHDOG_NOWAYOUT or passed in via a parameter during module loading or via bootargs. If nowayout=1 the driver does not allow the watchdog to be disabled (no way out of the situation). This is desirable in high reliability cases as the normal API behavior is to start the watchdog when /dev/watchdog is opened by the userspace app, and stop/disable the watchdog when it is closed (which can happen if the userspace watchdog process is killed or even crashes).

Examples:

  • IMX SoC:
    • enabling nowayout via U-Boot bootargs:
      u-boot=> setenv bootargs "$bootargs imx2_wdt.nowayout=1"; saveenv
      
    • show watchdog source/driver:
      # cat /sys/class/watchdog/watchdog0/identity 
      imx2+ watchdog
      
    • show nowayout:
      # cat /sys/class/watchdog/watchdog0/nowayout 
      1
      
    • show module details for imx2_wdt (watchdog found in IMX SoC's)
      # modinfo imx2_wdt
      name:           imx2_wdt
      filename:       (builtin)
      alias:          platform:imx2-wdt
      license:        GPL v2
      file:           drivers/watchdog/imx2_wdt
      description:    Watchdog driver for IMX2 and later
      author:         Wolfram Sang
      parm:           nowayout:Watchdog cannot be stopped once started (default=0) (bool)
      parm:           timeout:Watchdog timeout in seconds (default=60) (uint)
      
    • killing watchdog process
      root@noble-venice:~# echo 8 > /proc/sys/kernel/printk
      root@noble-venice:~# fuser /dev/watchdog
      /dev/watchdog:         507
      root@noble-venice:~# ps -ef  | grep 507
      root         507       1  0 19:37 ?        00:00:00 /usr/sbin/watchdog
      root         557     538  0 19:38 ttymxc1  00:00:00 grep --color=auto 507
      root@noble-venice:~# kill -9 507
      root@noble-venice:~# [   55.457477] watchdog: watchdog0: watchdog did not stop!
      root@noble-venice:~# fuser /dev/watchdog
      /dev/watchdog:         567
      root@noble-venice:~# ps -ef  | grep 567
      root         567       1  0 19:38 ?        00:00:00 /usr/sbin/wd_keepalive
      root         574     538  0 19:38 ttymxc1  00:00:00 grep --color=auto 567
      root@noble-venice:~# kill -9 567
      root@noble-venice:~# [   68.062109] watchdog: watchdog0: watchdog did not stop!
      [  117.146646] watchdog: watchdog0: watchdog did not stop!
      ...
      U-Boot SPL 2024.10-00060-g6b9a0425420c (Jan 29 2026 - 17:17:43 -0800)
      GSCv3   : v65 0x42a7 RST:CPU Thermal protection:enabled at 96C 
      
    • Within 30 seconds of killing the watchdog processes the board reboots with a RST:CPU which indicates CPU watchdog
    • Note on Ubuntu root filesystems typically once /sbin/watchdog dies systemd launches /usr/sbin/wd_keepalive

For more info:

Traditional Linux userpsace watchdog daemon (Yocto / Ubuntu)

The traditional linux userspace watchdog daemon (such as http://watchdog.sourceforge.net/) is an example of a very full featured watchdog daemon that can be configured to do controlled shutdowns before tipping the watchdog and can add all kinds of system level checks which need to pass before ticking the watchdog such as:

  • temperature checks
  • load checks
  • memory usage checks
  • process checks
  • network checks

On the Gateworks Ubuntu based pre-built images the watchdog package is installed and configured to start on boot as below, however if you are using a different OS you may need to do these steps manually.

To configure the watchdog daemon to run on boot, setup the watchdog for a 30sec timeout and simply tickle the watchdog every 5 seconds:

  1. Create a conf file:
    cat << EOF > /etc/watchdog.conf
    watchdog-device = /dev/watchdog
    realtime = yes
    priority = 1
    interval = 5
    watchdog-timeout = 30
    EOF
    
  2. create an executable init script (if not already present in your filesystem):
    cat << EOF > /etc/init.d/watchdog
    #!/bin/sh
    
    watchdog
    EOF
    chmod +x /etc/init.d/watchdog
    
  3. configure as a system service to start on boot, priority 1 (if not already present in your filesyste):
    update-rc.d watchdog defaults 1
    sync
    

For more details on configuring the traditional linux userspace watchdog see the man pages:

OpenWrt procd Watchdog

While older versions of OpenWrt used the watchdog daemon from busybox, newer versions (including the Gateworks BSP's from 13-06 and forward) implement the watchdog daemon via procd, which is the init process (PID1). Therefore on modern OpenWrt, you will never see the watchdog process when doing a ps.

Note that the procd watchdog functionality does not implement any specific system checks - if procd is simply running, it will tickle/reset the watchdog based on its configured period.

The procd watchdog code always uses the primary watchdog device /dev/watchdog. You can configure what watchdog that is (ie GSC Watchdog or SoC watchdog) by disabling all but the desired watchdog in the kernel configuration.

You can see the current configuration of the watchdog service via ubus:

root@OpenWrt:/# ubus call system watchdog
{
        "status": "running",
        "timeout": 30,
        "frequency": 5
}

While there is no uci configuration available for these options you could change them in an rc script such as rc.local if you wish:

ubus call system watchdog '{ "timeout": 60 }'   # change to 60s timeout
ubus call system watchdog '{ "frequency": 1 }'   # change to 1s frequency

To sop the service:

ubus call system watchdog '{ "stop": true }'   # watchdog will cause a reset after it expires

Android watchdog daemon

The Android OS watchdog daemon is /sbin/watchdog and is implemented in /system/core/init/watchdogd.c. It is kicked off by init and does not perform any specific checks.

Last modified 3 days ago Last modified on 02/03/2026 07:40:10 PM
Note: See TracWiki for help on using the wiki.