Now that the implementation of the HPET-based hardlockup detector is
complete, enable it. It will be used only if it can be initialized
successfully. Otherwise, the perf-based detector will be used.

Cc: Ashok Raj <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Jacob Pan <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Babu Moger <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Philippe Ombredanne <[email protected]>
Cc: Colin Ian King <[email protected]>
Cc: Byungchul Park <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: "Luis R. Rodriguez" <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Randy Dunlap <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Christoffer Dall <[email protected]>
Cc: Marc Zyngier <[email protected]>
Cc: Kai-Heng Feng <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: "Ravi V. Shankar" <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Ricardo Neri <[email protected]>
---
 kernel/watchdog.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index b5ce6e4..e2cc6c0 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -149,6 +149,21 @@ int __weak __init watchdog_nmi_probe(void)
 {
        int ret = -ENODEV;
 
+       /*
+        * Try first with the HPET hardlockup detector. It will only
+        * succeed if selected at build time and the nmi_watchdog
+        * command-line parameter is configured. This ensure that the
+        * perf-based detector is used by default, if selected at
+        * build time.
+        */
+       if (IS_ENABLED(CONFIG_HARDLOCKUP_DETECTOR_HPET))
+               ret = hardlockup_detector_hpet_ops.init();
+
+       if (!ret) {
+               nmi_wd_ops = &hardlockup_detector_hpet_ops;
+               return ret;
+       }
+
        if (IS_ENABLED(CONFIG_HARDLOCKUP_DETECTOR_PERF))
                ret = hardlockup_detector_perf_ops.init();
 
-- 
2.7.4

Reply via email to