Repository navigation
build(watchdog): build watchdog kmods as packages #2021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
filippocarletti
wants to merge
1
commit into
release-8.9.0
Choose a base branch
from
feat/watchdog-kmods
base: release-8.9.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Hardware watchdog drivers, built as packages and not included in the image. | ||
| # See docs/design/watchdog.md to pick the one matching the hardware. | ||
| CONFIG_PACKAGE_kmod-itco-wdt=m | ||
| CONFIG_PACKAGE_kmod-i6300esb-wdt=m | ||
| CONFIG_PACKAGE_kmod-sp5100-tco=m | ||
| CONFIG_PACKAGE_kmod-it87-wdt=m | ||
| CONFIG_PACKAGE_kmod-w83627hf-wdt=m | ||
| CONFIG_PACKAGE_kmod-f71808e-wdt=m | ||
| CONFIG_PACKAGE_kmod-ib700-wdt=m | ||
| CONFIG_PACKAGE_kmod-softdog=m | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| --- | ||
| layout: default | ||
| title: Hardware watchdog | ||
| parent: Design | ||
| --- | ||
|
|
||
| # Hardware watchdog | ||
|
|
||
| A hardware watchdog resets the machine when the kernel or procd hangs. | ||
| procd opens `/dev/watchdog` at boot, sets a 30 seconds timeout and pings it every 5 seconds: | ||
| if the pings stop, the watchdog resets the machine. | ||
|
|
||
| The x86 image ships no watchdog driver, so the watchdog is off by default. | ||
| The drivers are built as packages (`config/watchdog.conf`) and can be installed | ||
| from the NethSecurity package repository on the hardware that needs them. | ||
|
|
||
| ## Pick the driver | ||
|
|
||
| Install **only one** driver: the one matching the hardware. | ||
| Only the first watchdog device that registers gets `/dev/watchdog`, | ||
| and each package loads its driver at boot on its own. | ||
| If more drivers are installed, the device that procd uses depends on load order. | ||
|
|
||
| | Package | Module | Hardware | | ||
| |---|---|---| | ||
| | `kmod-itco-wdt` | `iTCO_wdt` | Intel chipsets with an ICH or an older PCH, many Atom and Celeron SoCs | | ||
| | `kmod-sp5100-tco` | `sp5100_tco` | AMD chipsets (SP5100, SB800 and newer FCH), e.g. PC Engines APU | | ||
| | `kmod-i6300esb-wdt` | `i6300esb` | QEMU, KVM and Proxmox VE virtual machines with an `i6300esb` watchdog device | | ||
| | `kmod-w83627hf-wdt` | `w83627hf_wdt` | Winbond and Nuvoton Super I/O chips (W836xx, NCT6xxx) | | ||
| | `kmod-it87-wdt` | `it87_wdt` | ITE Super I/O chips (IT87xx) | | ||
| | `kmod-f71808e-wdt` | `f71808e_wdt` | Fintek Super I/O chips (F718xx, F81xxx) | | ||
| | `kmod-ib700-wdt` | `ib700wdt` | IB700 single board computers only | | ||
| | `kmod-softdog` | `softdog` | Any hardware: software watchdog | | ||
|
|
||
| Prefer the chipset driver (`iTCO_wdt`, `sp5100_tco`) when the hardware has one. | ||
| Use a Super I/O driver only when the board documentation says the watchdog is on that chip. | ||
|
|
||
| Identify the hardware: | ||
|
|
||
| ``` | ||
| lspci -nn | grep -iE 'isa bridge|lpc|smbus|watchdog' | ||
| cat /sys/class/dmi/id/sys_vendor /sys/class/dmi/id/product_name | ||
| ``` | ||
|
|
||
| - An Intel `LPC Interface Controller` or `ISA bridge`: `kmod-itco-wdt`. | ||
| - An AMD `FCH SMBus Controller` (`1022:780b`, `1022:790b`): `kmod-sp5100-tco`. | ||
| - `6300ESB Watchdog Timer` (`8086:25ab`): `kmod-i6300esb-wdt`. | ||
|
|
||
| Notes: | ||
|
|
||
| - `iTCO_wdt` on Intel 100-series and newer PCH needs `i2c-i801`, which is not in the image: | ||
| on those systems the module loads but registers no device. | ||
| - `ib700wdt` does not check the hardware: it registers a device on any machine and takes `/dev/watchdog`. | ||
| procd then pings a watchdog that cannot reset the machine. Never install it on other hardware. | ||
| - `softdog` runs inside the kernel: it does not catch hard kernel lockups. | ||
| - `kmod-it87-wdt` passes the `nogameport` and `nocir` parameters, which the current driver does not know: | ||
| the kernel logs a warning and loads the module anyway. | ||
| - VMware and Hyper-V provide no supported virtual watchdog. | ||
| On Proxmox VE, add the device to the virtual machine first: | ||
| `qm set <vmid> --watchdog model=i6300esb,action=reset`. | ||
|
|
||
| ## Enable the watchdog | ||
|
|
||
| Install the package, then reboot: | ||
|
|
||
| ``` | ||
| apk update | ||
| apk add kmod-sp5100-tco | ||
| reboot | ||
| ``` | ||
|
|
||
| The package loads the module right away, but procd opens `/dev/watchdog` only at boot. | ||
| To start the watchdog without a reboot: | ||
|
|
||
| ``` | ||
| ubus call system watchdog '{"stop":false}' | ||
| ``` | ||
|
|
||
| Check that it works: | ||
|
|
||
| ``` | ||
| ls -l /dev/watchdog* | ||
| ubus call system watchdog | ||
| dmesg | grep -iE 'wdt|watchdog|tco' | ||
| ``` | ||
|
|
||
| `status` is `running` when procd pings the watchdog. | ||
| To test the reset, stop the pings without closing the device: | ||
| `ubus call system watchdog '{"stop":true}'`. The machine resets after about 30 seconds. | ||
|
|
||
| ## Disable the watchdog | ||
|
|
||
| Until the next reboot: | ||
|
|
||
| ``` | ||
| ubus call system watchdog '{"magicclose":true,"stop":true}' | ||
| ``` | ||
|
|
||
| Permanently, remove the package and reboot: | ||
|
|
||
| ``` | ||
| apk del kmod-sp5100-tco | ||
| reboot | ||
| ``` | ||
|
|
||
| ## Upgrades | ||
|
|
||
| The driver is an extra package: after a system upgrade it is installed again by | ||
| `ns-restore-extra-packages`, as soon as the WAN is available. | ||
| The watchdog is off until then, and starts at the next reboot or with the `ubus` command above. | ||
|
|
||
| A watchdog started by the BIOS keeps running while no driver is loaded and resets the machine | ||
| after its timeout. Disable it in the BIOS, or install the matching driver: with a driver loaded | ||
| the kernel pings the watchdog until procd opens it (`CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y`). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed, the info is inside the commit message and the dev doc