Skip to contentSkip to conversation

V4 init/main.c Enable watchdog_thresh control from kernel line

PATCH In review Laurence Oberman 3 participants 4 messages Oct 24, 2018 – Oct 30, 2018 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 V4 init/main.c Enable watchdog_thresh control from kernel line

Both graphics and serial consoles are exposed to hard lockups when handling a large amount of messaging. The kernel watchdog_thresh parameter up to now has not been available to be set on the kernel line for early boot.
This patch allows the setting of watchdog_thresh to be increased when needed to avoid the hard lockups in the console code.

---
 Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
 init/main.c                                     | 8 ++++++++
 2 files changed, 15 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +7 -0
index 4cdcd1a..05f76b8 100644
@@ -4932,6 +4932,13 @@
 			or other driver-specific files in the
 			Documentation/watchdog/ directory.
 
+	watchdog_thresh=
+			This parameter allows early boot to change the
+			value of the watchdog timeout threshold from the default
+			of 10 seconds to avoid hard lockups.  Example:
+			 watchdog_thresh=30
+			Default: 10
+
 	workqueue.watchdog_thresh=
 			If CONFIG_WQ_WATCHDOG is configured, workqueue can
 			warn stall conditions and dump internal state to
init/main.c +8 -0
index 1c3f902..ae45291 100644
@@ -1038,6 +1038,14 @@ static int __init set_debug_rodata(char *str)
 __setup("rodata=", set_debug_rodata);
 #endif
 
+static int __init is_watchdog_thresh_setup(char *str)
+{
+	get_option(&str, &watchdog_thresh);
+	return 1;
+}
+__setup("watchdog_thresh=", is_watchdog_thresh_setup);
+
+
 #ifdef CONFIG_STRICT_KERNEL_RWX
 static void mark_readonly(void)
 {
Signature · 1 line
1.8.3.1
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Laurence Oberman

Both graphics and serial consoles are exposed to hard lockups when handling a large amount of messaging. The kernel watchdog_thresh parameter up to now has not been available to be set on the kernel line for early boot.
This patch allows the setting of watchdog_thresh to be increased when needed to avoid the hard lockups in the console code.

Thanks.

Quoted 43 lines
---
 Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
 init/main.c                                     | 8 ++++++++
 2 files changed, 15 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +7 -0
index 4cdcd1a..05f76b8 100644
@@ -4932,6 +4932,13 @@
 			or other driver-specific files in the
 			Documentation/watchdog/ directory.
 
+	watchdog_thresh=
+			This parameter allows early boot to change the
+			value of the watchdog timeout threshold from the default
+			of 10 seconds to avoid hard lockups.  Example:
+			 watchdog_thresh=30
+			Default: 10
+
 	workqueue.watchdog_thresh=
 			If CONFIG_WQ_WATCHDOG is configured, workqueue can
 			warn stall conditions and dump internal state to
init/main.c +8 -0
index 1c3f902..ae45291 100644
@@ -1038,6 +1038,14 @@ static int __init set_debug_rodata(char *str)
 __setup("rodata=", set_debug_rodata);
 #endif
 
+static int __init is_watchdog_thresh_setup(char *str)
+{
+	get_option(&str, &watchdog_thresh);
+	return 1;
+}
+__setup("watchdog_thresh=", is_watchdog_thresh_setup);
+
+
 #ifdef CONFIG_STRICT_KERNEL_RWX
 static void mark_readonly(void)
 {
Signature · 1 line
~Randy
reviewer
#2 lore raw
In reply to Laurence Oberman
Quoted 7 lines · Laurence Oberman

Both graphics and serial consoles are exposed to hard lockups when handling a large amount of messaging. The kernel watchdog_thresh parameter up to now has not been available to be set on the kernel line for early boot.
This patch allows the setting of watchdog_thresh to be increased when needed to avoid the hard lockups in the console code.

Quoted 6 lines
---
 Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
 init/main.c                                     | 8 ++++++++
 2 files changed, 15 insertions(+)

Laurence,
Here are a few more changes for you to consider.

Documentation/admin-guide/kernel-parameters.txt line 4939

Quoted 13 lines
Documentation/admin-guide/kernel-parameters.txt +5 -0
index 4cdcd1a..05f76b8 100644
@@ -4932,6 +4932,13 @@
 			or other driver-specific files in the
 			Documentation/watchdog/ directory.
 
+	watchdog_thresh=
+			This parameter allows early boot to change the
+			value of the watchdog timeout threshold from the default
+			of 10 seconds to avoid hard lockups.  Example:
+			 watchdog_thresh=30

No extra char indent above.

init/main.c static int __init set_debug_rodata(char *str) · line 1040

Quoted 13 lines
Documentation/admin-guide/kernel-parameters.txt +2 -0
+			Default: 10
+
 	workqueue.watchdog_thresh=
 			If CONFIG_WQ_WATCHDOG is configured, workqueue can
 			warn stall conditions and dump internal state to
init/main.c +0 -0
index 1c3f902..ae45291 100644
@@ -1038,6 +1038,14 @@ static int __init set_debug_rodata(char *str)
 __setup("rodata=", set_debug_rodata);
 #endif
 

#ifdef CONFIG_LOCKUP_DETECTOR

extern int watchdog_thresh;

init/main.c static int __init set_debug_rodata(char *str) · line 1047

Quoted 7 lines
init/main.c +7 -0
+static int __init is_watchdog_thresh_setup(char *str)
+{
+	get_option(&str, &watchdog_thresh);
+	return 1;
+}
+__setup("watchdog_thresh=", is_watchdog_thresh_setup);
+

#endif

and I would change the function name above to just watchdog_thresh_setup() or setup_watchdog_thresh().

Quoted 5 lines
init/main.c +1 -0
+
 #ifdef CONFIG_STRICT_KERNEL_RWX
 static void mark_readonly(void)
 {
Signature · 1 line
~Randy
#3 lore raw
In reply to Laurence Oberman
Thank you for the patch! Yet something to improve:

Hi Laurence,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux-sof-driver/master]
[also build test ERROR on v4.19 next-20181029]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Laurence-Oberman/V4-init-main-c-Enable-watchdog_thresh-control-from-kernel-line/20181025-040136
base:   https://github.com/thesofproject/linux master
config: i386-randconfig-k3-10291547 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

init/main.c: In function 'is_watchdog_thresh_setup':

>> init/main.c:1036:20: error: 'watchdog_thresh' undeclared (first use in this function); did you mean 'proc_watchdog_thresh'?
     get_option(&str, &watchdog_thresh);
                       ^~~~~~~~~~~~~~~
                       proc_watchdog_thresh

init/main.c:1036:20: note: each undeclared identifier is reported only once for each function it appears in

vim +1036 init/main.c

1033
1034 static int __init is_watchdog_thresh_setup(char *str)
1035 {

> 1036		get_option(&str, &watchdog_thresh);

1037 return 1;
1038 }
1039 __setup("watchdog_thresh=", is_watchdog_thresh_setup);
1040
1041

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation