-
Notifications
You must be signed in to change notification settings - Fork 64
feat: add wathdog #684
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
base: main
Are you sure you want to change the base?
feat: add wathdog #684
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
在嵌入式 Linux 系统中,看门狗(Watchdog Timer,简称 WDT)是一种用于 监控系统运行状态的硬件与软件结合的机制,主要目的是在系统出现故障(如死机、卡死或程序失控)时自动触发重启,确保系统能从异常状态中恢复。 | ||
|
||
### 开启 watchdog | ||
|
||
硬件 watchdog 默认没有开启, 需要通过 <a href={props.rsetup_path} alt="rsetup path" > rsetup </a> 开启 watchdog 的 overlay, | ||
|
||
### 测试 watchdog | ||
|
||
- 输入如下命令后,系统不再喂狗, watchdog 会自动重启 | ||
|
||
```bash | ||
|
||
echo B > /dev/watchdog | ||
|
||
``` | ||
|
||
:::warning | ||
|
||
这里可以写入除大写 V 之外的任意字符,因为大写 V 是用来关闭 watchdog 的。 | ||
|
||
::: | ||
|
||
- 关闭系统 panic 重启 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 所以你这是三种不同的测试场景。我刚开始看以为是要三个命令一次性都执行 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 那我们这里需要写几种场景? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 意思是你不要写成列表,用###之类变成子章节。列表中的内容是有逻辑相关性的,你这是三个独立的测试场景 |
||
|
||
```bash | ||
|
||
echo 0 > /sys/module/kernel/parameters/panic | ||
|
||
``` | ||
|
||
- 模拟系统卡住 | ||
|
||
```bash | ||
|
||
echo c > proc/sysrq-trigger | ||
|
||
``` | ||
|
||
- 等待 30 秒左右,看系统是否重启,如果系统能够重启,则表示 watchdog 正常工作 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 所以是每个场景都需要等30s |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
In embedded Linux systems, a Watchdog Timer (WDT) is a hardware and software mechanism used to monitor the system's operational state. Its main purpose is to automatically trigger a reboot when the system encounters failures (such as a crash, freeze, or program hang), ensuring the system recovers from abnormal states. | ||
|
||
### Enablethe Watchdog | ||
|
||
The hardware watchdog is disabled by default. It needs to be enabled using the <a href={props.rsetup_path} alt="rsetup path" > rsetup </a> to activate the watchdog overlay. | ||
|
||
### Testing the Watchdog | ||
|
||
- Run the following command to stop feeding the watchdog. The watchdog will automatically reboot the system: | ||
|
||
```bash | ||
|
||
echo B > /dev/watchdog | ||
|
||
``` | ||
|
||
:::warning | ||
|
||
You can write any character except for uppercase V, as uppercase V is used to disable the watchdog. | ||
|
||
::: | ||
|
||
- Disable system panic reboot: | ||
|
||
```bash | ||
|
||
echo 0 > /sys/module/kernel/parameters/panic | ||
|
||
``` | ||
|
||
- Simulate a system freeze: | ||
|
||
```bash | ||
|
||
echo c > proc/sysrq-trigger | ||
|
||
``` | ||
|
||
- Wait for approximately 30 seconds to see if the system reboots. If the system successfully reboots, it indicates that the watchdog is functioning correctly. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 20 | ||
--- | ||
|
||
import WDT from "../../../../common/dev/\_watchdog.mdx"; | ||
|
||
# Watchdog | ||
|
||
<WDT rsetup="../../radxa-os/rsetup" /> |
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.
只是测试,就别告诉用户输入别的乱七八糟东西了。谁知道以后这个接口会不会改