Who is refreshing hardware watchdog in Linux?

前端 未结 5 2202
攒了一身酷
攒了一身酷 2020-12-15 06:54

I have a processor AT91SAM9G20 running a 2.6 kernel. Watchdog is enabled at bootstrap level and configured for 16 seconds. Watchdog mode register can be configured only once

5条回答
  •  天涯浪人
    2020-12-15 07:07

    In July 2016 a commit in the 4.7 kernel to watchdog_dev.c enabled the same behavior as shodanex's answer for all watchdog timer drivers. This doesn't seem to be documented anywhere other than this thread and the source code.

    /*
    * A worker to generate heartbeat requests is needed if all of the
    * following conditions are true.
    * - Userspace activated the watchdog.
    * - The driver provided a value for the maximum hardware timeout, and
    *   thus is aware that the framework supports generating heartbeat
    *   requests.
    * - Userspace requests a longer timeout than the hardware can handle.
    *
    * Alternatively, if userspace has not opened the watchdog
    * device, we take care of feeding the watchdog if it is
    * running.
    */
    
    return (hm && watchdog_active(wdd) && t > hm) ||
           (t && !watchdog_active(wdd) && watchdog_hw_running(wdd));
    

提交回复
热议问题