From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: linux-kernel@vger.kernel.org
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>,
Andi Kleen <ak@linux.intel.com>, Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
John Ogness <john.ogness@linutronix.de>
Subject: [PATCH 3/3] clear_warn_once: add a warn_once_reset= boot parameter
Date: Thu, 26 Nov 2020 01:30:29 -0500 [thread overview]
Message-ID: <20201126063029.2030-4-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <20201126063029.2030-1-paul.gortmaker@windriver.com>
In the event debugfs is not mounted, or if built with the .config
setting DEBUG_FS_ALLOW_NONE chosen, this gives the sysadmin access
to reset the WARN_ONCE() state on a periodic basis.
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
.../admin-guide/kernel-parameters.txt | 8 +++++++
kernel/panic.c | 21 +++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 44fde25bb221..89f54444fee7 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5863,6 +5863,14 @@
vt.underline= [VT] Default color for underlined text; 0-15.
Default: 3 = cyan.
+ warn_once_reset=
+ [KNL]
+ Set the WARN_ONCE reset period in seconds. Normally
+ a WARN_ONCE() will only ever emit a message once per
+ boot, but for example, setting this to 3600 would
+ effectively rate-limit WARN_ONCE to once per hour.
+ Default: 0 = never.
+
watchdog timers [HW,WDT] For information on watchdog timers,
see Documentation/watchdog/watchdog-parameters.rst
or other driver-specific files in the
diff --git a/kernel/panic.c b/kernel/panic.c
index a23eb239fb17..f813ca3a5cd5 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -716,10 +716,31 @@ static __init int register_warn_debugfs(void)
/* Don't care about failure */
debugfs_create_file_unsafe("clear_warn_once", 0600, NULL,
&warn_once_reset, &clear_warn_once_fops);
+
+ /* if a bootarg was used, set the initial timer */
+ if (warn_once_reset)
+ warn_once_set(NULL, warn_once_reset);
+
return 0;
}
device_initcall(register_warn_debugfs);
+
+static int __init warn_once_setup(char *s)
+{
+ int r;
+
+ if (!s)
+ return -EINVAL;
+
+ r = kstrtoull(s, 0, &warn_once_reset);
+ if (r)
+ return r;
+
+ return 1;
+}
+__setup("warn_once_reset=", warn_once_setup);
+
#endif
#ifdef CONFIG_STACKPROTECTOR
--
2.25.1
next prev parent reply other threads:[~2020-11-26 6:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 6:30 [PATCH 0/3] clear_warn_once: add timed interval resetting Paul Gortmaker
2020-11-26 6:30 ` [PATCH 1/3] clear_warn_once: expand debugfs to include read support Paul Gortmaker
2020-11-26 6:30 ` [PATCH 2/3] clear_warn_once: bind a timer to written reset value Paul Gortmaker
2020-11-30 16:20 ` Steven Rostedt
2020-11-30 17:17 ` Paul Gortmaker
2020-12-01 3:36 ` Steven Rostedt
2020-11-26 6:30 ` Paul Gortmaker [this message]
2020-11-27 16:13 ` [PATCH 0/3] clear_warn_once: add timed interval resetting Petr Mladek
2020-11-27 17:43 ` Paul Gortmaker
2020-12-01 12:59 ` Petr Mladek
2020-11-30 6:02 ` Sergey Senozhatsky
2020-11-30 16:24 ` Steven Rostedt
2020-11-30 3:08 ` Andi Kleen
2020-11-30 17:38 ` Paul Gortmaker
2020-12-01 12:49 ` Petr Mladek
2020-12-01 18:05 ` Paul Gortmaker
2020-12-09 16:37 ` Petr Mladek
2020-12-09 17:21 ` Paul Gortmaker
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=20201126063029.2030-4-paul.gortmaker@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=ak@linux.intel.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.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).