linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
To: corbet@lwn.net, mcgrof@kernel.org, keescook@chromium.org,
	yzaikin@google.com, linux-fsdevel@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, linux@rasmusvillemoes.dk,
	ebiggers@google.com, peterz@infradead.org, ying.huang@intel.com,
	gpiccoli@igalia.com, mchehab+huawei@kernel.org, Jason@zx2c4.com,
	daniel@iogearbox.net, robh@kernel.org, wangqing@vivo.com,
	prestwoj@gmail.com, dsahern@kernel.org,
	stephen.s.brennan@oracle.com, alejandro.j.jimenez@oracle.com
Subject: [RFC 1/1] kernel/sysctl: Add sysctl entry for crash_kexec_post_notifiers
Date: Fri,  1 Apr 2022 16:23:00 -0400	[thread overview]
Message-ID: <20220401202300.12660-2-alejandro.j.jimenez@oracle.com> (raw)
In-Reply-To: <20220401202300.12660-1-alejandro.j.jimenez@oracle.com>

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


  reply	other threads:[~2022-04-01 20:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 20:22 [RFC 0/1] Add sysctl entry for controlling crash_kexec_post_notifiers Alejandro Jimenez
2022-04-01 20:23 ` Alejandro Jimenez [this message]
2022-04-01 21:35   ` [RFC 1/1] kernel/sysctl: Add sysctl entry for crash_kexec_post_notifiers Luis Chamberlain
2022-04-02 14:01 ` [RFC 0/1] Add sysctl entry for controlling crash_kexec_post_notifiers Guilherme G. Piccoli
2022-04-04 20:43   ` Alejandro Jimenez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220401202300.12660-2-alejandro.j.jimenez@oracle.com \
    --to=alejandro.j.jimenez@oracle.com \
    --cc=Jason@zx2c4.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=dsahern@kernel.org \
    --cc=ebiggers@google.com \
    --cc=gpiccoli@igalia.com \
    --cc=keescook@chromium.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mcgrof@kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=peterz@infradead.org \
    --cc=prestwoj@gmail.com \
    --cc=robh@kernel.org \
    --cc=stephen.s.brennan@oracle.com \
    --cc=wangqing@vivo.com \
    --cc=ying.huang@intel.com \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).