[PATCH v4] docs/zh_CN: Add zh_CN/admin-guide/lockup-watchdogs.rst

STALE1902d LANDED

Landed in mainline as b0cbba2e44c6 on 2021-06-04.

2 messages, 2 authors, 2021-06-04 · open the first message on its own page

[PATCH v4] docs/zh_CN: Add zh_CN/admin-guide/lockup-watchdogs.rst

From: Hailong Liu <hidden>
Date: 2021-06-03 14:53:04

From: Hailong Liu <redacted>

Add translation zh_CN/admin-guide/lockup-watchdogs.rst and link it to
zh_CN/admin-guide/index.rst while clean its todo entry.

Reviewed-by: Yanteng Si <redacted>
Signed-off-by: Hailong Liu <redacted>
---

changes since v3:
 - add "Reviewed-by" tag and change log

changes since v2:
 - fix the "Original:" item and the title of this tranlation
   which suggested by Yanteng.

changes since v1:
 - fix the quite a lot of style issues and poor translation issues.

Big thanks to Yanteng for review and suggestions.
---
 .../translations/zh_CN/admin-guide/index.rst  |  2 +-
 .../zh_CN/admin-guide/lockup-watchdogs.rst    | 66 +++++++++++++++++++
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/translations/zh_CN/admin-guide/lockup-watchdogs.rst
diff --git a/Documentation/translations/zh_CN/admin-guide/index.rst b/Documentation/translations/zh_CN/admin-guide/index.rst
index be835ec8e632..460034cbc2ab 100644
--- a/Documentation/translations/zh_CN/admin-guide/index.rst
+++ b/Documentation/translations/zh_CN/admin-guide/index.rst
@@ -65,6 +65,7 @@ Todolist:
 
    clearing-warn-once
    cpu-load
+   lockup-watchdogs
    unicode
 
 Todolist:
@@ -100,7 +101,6 @@ Todolist:
    laptops/index
    lcd-panel-cgram
    ldm
-   lockup-watchdogs
    LSM/index
    md
    media/index
diff --git a/Documentation/translations/zh_CN/admin-guide/lockup-watchdogs.rst b/Documentation/translations/zh_CN/admin-guide/lockup-watchdogs.rst
new file mode 100644
index 000000000000..55ed3f4af442
--- /dev/null
+++ b/Documentation/translations/zh_CN/admin-guide/lockup-watchdogs.rst
@@ -0,0 +1,66 @@
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: Documentation/admin-guide/lockup-watchdogs.rst
+:Translator: Hailong Liu <liu.hailong6@zte.com.cn>
+
+.. _cn_lockup-watchdogs:
+
+
+=================================================
+Softlockup与hardlockup检测机制(又名:nmi_watchdog)
+=================================================
+
+Linux中å†
核实现了一种用以检测系统发生softlockup和hardlockup的看门狗机制。
+
+Softlockup是一种会引发系统在å†
核态中一直循环è¶
过20秒(详见下面“实现”小节)导致
+å
¶ä»–任务没有机会得到运行的BUG。一旦检测到'softlockup'发生,默认æƒ
况下系统会打
+印当前堆栈跟踪信息并进å
¥é”å®šçŠ¶æ€ã€‚ä¹Ÿå¯é
ç½®ä½¿å
¶åœ¨æ£€æµ‹åˆ°'softlockup'后进å
¥panic
+状态;通过sysctl命令设置“kernel.softlockup_panic”、使用å†
核启动参数
+“softlockup_panic”(详见Documentation/admin-guide/kernel-parameters.rst)以及使
+能å†
核编译选项“BOOTPARAM_SOFTLOCKUP_PANIC”都可实现这种é
ç½®ã€‚
+
+而'hardlockup'是一种会引发系统在å†
核态一直循环è¶
过10秒钟(详见"实现"小节)导致å
¶
+他中断没有机会运行的缺陷。与'softlockup'æƒ
况类似,除了使用sysctl命令设置
+'hardlockup_panic'、使能å†
核选项“BOOTPARAM_HARDLOCKUP_PANIC”以及使用å†
核参数
+"nmi_watchdog"(详见:”Documentation/admin-guide/kernel-parameters.rst“)外,一旦检
+测到'hardlockup'默认æƒ
况下系统打印当前堆栈跟踪信息,然后进å
¥é”å®šçŠ¶æ€ã€‚
+
+这个panic选项也可以与panic_timeout结合使用(这个panic_timeout是通过稍å
·è¿·æƒ‘性的
+sysctl命令"kernel.panic"来设置),使系统在panic指定时间后自动重启。
+
+实现
+====
+
+Softlockup和hardlockup分别建立在hrtimer(高精度定时器)和perf两个子系统上而实现。
+这也就意味着理论上任何架构只要实现了这两个子系统就支持这两种检测机制。
+
+Hrtimer用于周期性产生中断并唤醒watchdog线程;NMI perf事件则以”watchdog_thresh“
+(编译时默认初始化为10秒,也可通过”watchdog_thresh“这个sysctl接口来进行é
ç½®ä¿®æ”¹)
+为间隔周期产生以检测 hardlockups。如果一个CPU在这个时间段å†
没有检测到hrtimer中
+断发生,'hardlockup 检测器'(即NMI perf事件处理函数)将会视系统é
ç½®è€Œé€‰æ‹©äº§ç”Ÿå†
æ ¸
+警告或è€
直接panic。
+
+而watchdog线程本质上是一个高优å
ˆçº§å†
核线程,每调度一次就对时间戳进行一次更新。
+如果时间戳在2*watchdog_thresh(这个是softlockup的触发门限)这段时间都未更新,那么
+"softlocup 检测器"(å†
部hrtimer定时器回调函数)会将相å
³çš„调试信息打印到系统日志中,
+然后如果系统é
ç½®äº†è¿›å
¥panic流程则进å
¥panic,否则å†
核继续执行。
+
+Hrtimer定时器的周期是2*watchdog_thresh/5,也就是说在hardlockup被触发前hrtimer有
+2~3次机会产生时钟中断。
+
+如上所述,å†
核相当于为系统管理员提供了一个可调节hrtimer定时器和perf事件周期长度
+的调节旋钮。如何通过这个旋钮为特定使用场景é
ç½®ä¸€ä¸ªåˆç†çš„周期值要对lockups检测的
+响应速度和lockups检测开销这二è€
之间进行权衡。
+
+默认æƒ
况下所有在线cpu上都会运行一个watchdog线程。不过在å†
æ ¸é
ç½®äº†â€NO_HZ_FULL“的
+æƒ
况下watchdog线程默认只会运行在管家(housekeeping)cpu上,而”nohz_full“启动参数指
+定的cpu上则不会有watchdog线程运行。试想,如果我们å
è®¸watchdog线程在”nohz_full“指
+定的cpu上运行,这些cpu上å¿
须得运行时钟定时器来激发watchdog线程调度;这样一来就会
+使”nohz_full“保护用户程序å
å—å†
核干扰的功能失效。当然,副作用就是”nohz_full“指定
+的cpu即使在å†
核产生了lockup问题我们也无法检测到。不过,至少我们可以å
è®¸watchdog
+线程在管家(non-tickless)核上继续运行以便我们能继续正常的监测这些cpus上的lockups
+事件。
+
+不论哪种æƒ
况都可以通过sysctl命令kernel.watchdog_cpumask来对没有运行watchdog线程
+的cpu集合进行调节。对于nohz_full而言,如果nohz_full cpu上有异常挂住的æƒ
况,通过
+这种方式打开这些cpu上的watchdog进行调试可能会有所作用。
-- 
2.17.1

Re: [PATCH v4] docs/zh_CN: Add zh_CN/admin-guide/lockup-watchdogs.rst

From: Jonathan Corbet <corbet@lwn.net>
Date: 2021-06-04 17:19:39

Hailong Liu [off-list ref] writes:
From: Hailong Liu <redacted>

Add translation zh_CN/admin-guide/lockup-watchdogs.rst and link it to
zh_CN/admin-guide/index.rst while clean its todo entry.

Reviewed-by: Yanteng Si <redacted>
Signed-off-by: Hailong Liu <redacted>
---

changes since v3:
 - add "Reviewed-by" tag and change log

changes since v2:
 - fix the "Original:" item and the title of this tranlation
   which suggested by Yanteng.

changes since v1:
 - fix the quite a lot of style issues and poor translation issues.

Big thanks to Yanteng for review and suggestions.
---
 .../translations/zh_CN/admin-guide/index.rst  |  2 +-
 .../zh_CN/admin-guide/lockup-watchdogs.rst    | 66 +++++++++++++++++++
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/translations/zh_CN/admin-guide/lockup-watchdogs.rst
Applied, thanks.

jon
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help