lkml.org 
[lkml]   [2022]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 1/1] kernel/sysctl: Add sysctl entry for crash_kexec_post_notifiers
Date
Introduce a new sysctl:

/proc/sys/kernel/crash_kexec_post_notifiers

that allows the crash_kexec_post_notifiers tunable to be listed, read, and
modified via sysctl(8) at runtime.

crash_kexec_post_notifiers can now be set via sysctl:

# sysctl -w kernel.crash_kexec_post_notifiers=1

or using the sysfs entry:

# echo 0 > /sys/module/kernel/parameters/crash_kexec_post_notifiers

which is also available for other core kernel parameters like panic,
panic_print, and panic_on_warn.

Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
---
Documentation/admin-guide/sysctl/kernel.rst | 8 ++++++++
include/uapi/linux/sysctl.h | 1 +
kernel/sysctl.c | 7 +++++++
3 files changed, 16 insertions(+)

diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
index 1144ea3229a3..8e07121e2a58 100644
--- a/Documentation/admin-guide/sysctl/kernel.rst
+++ b/Documentation/admin-guide/sysctl/kernel.rst
@@ -213,6 +213,14 @@ If `core_pattern`_ does not include "%p" (default does not)
and ``core_uses_pid`` is set, then .PID will be appended to
the filename.

+crash_kexec_post_notifiers
+============
+
+Allow the callbacks in panic notifier list to be called before kdump and dumping
+kmsg.
+
+0 Do not call panic notifier list callbacks before kdump (default).
+1 Call panic notifier list callbacks before kdump.

ctrl-alt-del
============
diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
index 6a3b194c50fe..921e3ea01881 100644
--- a/include/uapi/linux/sysctl.h
+++ b/include/uapi/linux/sysctl.h
@@ -154,6 +154,7 @@ enum
KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
KERN_PANIC_ON_WARN=77, /* int: call panic() in WARN() functions */
KERN_PANIC_PRINT=78, /* ulong: bitmask to print system info on panic */
+ KERN_CRASH_KEXEC_POST_NOTIFIERS=79, /* bool: call panic notifier list before kdump */
};


diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 830aaf8ca08e..8e0be72b5fba 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2339,6 +2339,13 @@ static struct ctl_table kern_table[] = {
.extra2 = SYSCTL_INT_MAX,
},
#endif
+ {
+ .procname = "crash_kexec_post_notifiers",
+ .data = &crash_kexec_post_notifiers,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dobool,
+ },
{ }
};

--
2.34.1
\
 
 \ /
  Last update: 2022-04-01 22:29    [W:0.050 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site