From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@suse.de>
Cc: Ashok Raj <ashok.raj@intel.com>,
Andi Kleen <andi.kleen@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Ricardo Neri <ricardo.neri@intel.com>,
Ricardo Neri <ricardo.neri-calderon@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>, Tony Luck <tony.luck@intel.com>,
Clemens Ladisch <clemens@ladisch.de>,
Arnd Bergmann <arnd@arndb.de>,
Philippe Ombredanne <pombredanne@nexb.com>,
Kate Stewart <kstewart@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Mimi Zohar <zohar@linux.ibm.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Nick Desaulniers <ndesaulniers@google.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Nayna Jain <nayna@linux.ibm.com>
Subject: [RFC PATCH v2 13/14] watchdog/hardlockup/hpet: Only enable the HPET watchdog via a boot parameter
Date: Wed, 27 Feb 2019 08:05:17 -0800 [thread overview]
Message-ID: <1551283518-18922-14-git-send-email-ricardo.neri-calderon@linux.intel.com> (raw)
In-Reply-To: <1551283518-18922-1-git-send-email-ricardo.neri-calderon@linux.intel.com>
Keep the HPET-based hardlockup detector disabled unless explicitly enabled
via a command line argument. If such parameter is not given, the hardlockup
detector will fallback to use the perf-based implementation.
The function hardlockup_panic_setup() is updated to return 0 in order to
to allow __setup functions of specific hardlockup detectors (in this case
hardlockup_detector_hpet_setup()) to inspect the nmi_watchdog boot
parameter.
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Andi Kleen <andi.kleen@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Mimi Zohar <zohar@linux.ibm.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Nayna Jain <nayna@linux.ibm.com>
Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
Cc: x86@kernel.org
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
--
checkpatch gives the following warning:
CHECK: __setup appears un-documented -- check Documentation/admin-guide/kernel-parameters.rst
+__setup("nmi_watchdog=", hardlockup_detector_hpet_setup);
This is a false-positive as the option nmi_watchdog is already
documented. The option is re-evaluated in this file as well.
---
.../admin-guide/kernel-parameters.txt | 6 +++++-
arch/x86/kernel/watchdog_hld_hpet.c | 20 +++++++++++++++++++
kernel/watchdog.c | 2 +-
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index cf8f5877d85f..c6270ddeb130 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2739,7 +2739,7 @@
Format: [state][,regs][,debounce][,die]
nmi_watchdog= [KNL,BUGS=X86] Debugging features for SMP kernels
- Format: [panic,][nopanic,][num]
+ Format: [panic,][nopanic,][num,][hpet]
Valid num: 0 or 1
0 - turn hardlockup detector in nmi_watchdog off
1 - turn hardlockup detector in nmi_watchdog on
@@ -2749,6 +2749,10 @@
please see 'nowatchdog'.
This is useful when you use a panic=... timeout and
need the box quickly up again.
+ When hpet is specified, the NMI watchdog will be driven
+ by an HPET timer, if available in the system. Otherwise,
+ the perf-based implementation will be used. Specifying
+ hpet implies that nmi_watchdog is on.
These settings can be accessed at runtime via
the nmi_watchdog and hardlockup_panic sysctls.
diff --git a/arch/x86/kernel/watchdog_hld_hpet.c b/arch/x86/kernel/watchdog_hld_hpet.c
index 65b4699f249a..4402deff4b77 100644
--- a/arch/x86/kernel/watchdog_hld_hpet.c
+++ b/arch/x86/kernel/watchdog_hld_hpet.c
@@ -20,6 +20,7 @@
#include <asm/hpet.h>
static struct hpet_hld_data *hld_data;
+static bool hardlockup_use_hpet;
/**
* get_count() - Get the current count of the HPET timer
@@ -391,6 +392,22 @@ void hardlockup_detector_hpet_stop(void)
disable_timer(hld_data);
}
+/**
+ * hardlockup_detector_hpet_setup() - Parse command-line parameters
+ * @str: A string containing the kernel command line
+ *
+ * Parse the nmi_watchdog parameter from the kernel command line. If
+ * selected by the user, use this implementation to detect hardlockups.
+ */
+static int __init hardlockup_detector_hpet_setup(char *str)
+{
+ if (strstr(str, "hpet"))
+ hardlockup_use_hpet = true;
+
+ return 0;
+}
+__setup("nmi_watchdog=", hardlockup_detector_hpet_setup);
+
/**
* hardlockup_detector_hpet_init() - Initialize the hardlockup detector
*
@@ -405,6 +422,9 @@ int __init hardlockup_detector_hpet_init(void)
{
int ret;
+ if (!hardlockup_use_hpet)
+ return -ENODEV;
+
if (!is_hpet_enabled())
return -ENODEV;
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 367aa81294ef..28cad7310378 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -78,7 +78,7 @@ static int __init hardlockup_panic_setup(char *str)
nmi_watchdog_user_enabled = 0;
else if (!strncmp(str, "1", 1))
nmi_watchdog_user_enabled = 1;
- return 1;
+ return 0;
}
__setup("nmi_watchdog=", hardlockup_panic_setup);
--
2.17.1
next prev parent reply other threads:[~2019-02-27 16:06 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-27 16:05 [RFC PATCH v2 00/14] Implement an HPET-based hardlockup detector Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 01/14] x86/msi: Add definition for NMI delivery mode Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 02/14] x86/hpet: Expose more functions to read and write registers Ricardo Neri
2019-03-26 21:00 ` Thomas Gleixner
2019-04-09 2:03 ` Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 03/14] x86/hpet: Calculate ticks-per-second in a separate function Ricardo Neri
2019-03-26 21:03 ` Thomas Gleixner
2019-04-09 2:04 ` Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 04/14] x86/hpet: Reserve timer for the HPET hardlockup detector Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 05/14] x86/hpet: Relocate flag definitions to a header file Ricardo Neri
2019-03-26 21:11 ` Thomas Gleixner
2019-04-09 2:04 ` Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 06/14] x86/hpet: Configure the timer used by the hardlockup detector Ricardo Neri
2019-03-26 21:13 ` Thomas Gleixner
2019-04-09 2:04 ` Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 07/14] watchdog/hardlockup: Define a generic function to detect hardlockups Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 08/14] watchdog/hardlockup: Decouple the hardlockup detector from perf Ricardo Neri
2019-03-26 21:18 ` Thomas Gleixner
2019-04-09 2:05 ` Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 09/14] watchdog/hardlockup: Make arch_touch_nmi_watchdog() to hpet-based implementation Ricardo Neri
2019-02-27 16:17 ` Paul E. McKenney
2019-03-01 1:17 ` Ricardo Neri
2019-03-26 21:20 ` Thomas Gleixner
2019-04-09 2:05 ` Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 10/14] kernel/watchdog: Add a function to obtain the watchdog_allowed_mask Ricardo Neri
2019-03-26 21:22 ` Thomas Gleixner
2019-04-09 2:05 ` Ricardo Neri
2019-04-09 11:34 ` Peter Zijlstra
2019-04-11 1:15 ` Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 11/14] x86/watchdog/hardlockup: Add an HPET-based hardlockup detector Ricardo Neri
2019-03-26 20:49 ` Thomas Gleixner
2019-04-09 2:02 ` Ricardo Neri
2019-04-09 10:59 ` Peter Zijlstra
2019-04-10 1:13 ` Ricardo Neri
2019-04-05 16:12 ` Suthikulpanit, Suravee
2019-04-09 2:14 ` Ricardo Neri
2019-04-09 11:03 ` Peter Zijlstra
2019-04-10 1:05 ` Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 12/14] x86/watchdog/hardlockup/hpet: Determine if HPET timer caused NMI Ricardo Neri
2019-03-26 20:55 ` Thomas Gleixner
2019-04-09 2:02 ` Ricardo Neri
2019-04-09 11:28 ` Peter Zijlstra
2019-04-10 1:19 ` Ricardo Neri
2019-04-10 7:01 ` Peter Zijlstra
2019-04-11 1:12 ` Ricardo Neri
2019-02-27 16:05 ` Ricardo Neri [this message]
2019-03-26 21:29 ` [RFC PATCH v2 13/14] watchdog/hardlockup/hpet: Only enable the HPET watchdog via a boot parameter Thomas Gleixner
2019-04-09 2:07 ` Ricardo Neri
2019-02-27 16:05 ` [RFC PATCH v2 14/14] x86/watchdog: Add a shim hardlockup detector Ricardo Neri
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=1551283518-18922-14-git-send-email-ricardo.neri-calderon@linux.intel.com \
--to=ricardo.neri-calderon@linux.intel.com \
--cc=andi.kleen@intel.com \
--cc=arnd@arndb.de \
--cc=ashok.raj@intel.com \
--cc=bp@suse.de \
--cc=clemens@ladisch.de \
--cc=hpa@zytor.com \
--cc=jan.kiszka@siemens.com \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=nayna@linux.ibm.com \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=pombredanne@nexb.com \
--cc=rafael.j.wysocki@intel.com \
--cc=ravi.v.shankar@intel.com \
--cc=ricardo.neri@intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=yamada.masahiro@socionext.com \
--cc=zohar@linux.ibm.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).