diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2017-09-12 15:37:20 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-09-14 05:41:08 -0400 |
commit | 2a1b8ee4f5665b4291e43e4a25d964c3eb2f4c32 (patch) | |
tree | 9d169bafa59b77220d4cd41f0b66438d47663ec7 | |
parent | a994a3147e4c0c9c50a46e6cace7586254975e20 (diff) |
watchdog/hardlockup/perf: Implement CPU enable replacement
watchdog_nmi_enable() is an unparseable mess, Provide a clean perf specific
implementation, which will be used when the existing setup/teardown mess is
replaced.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Link: http://lkml.kernel.org/r/20170912194148.180215498@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/linux/nmi.h | 2 | ||||
-rw-r--r-- | kernel/watchdog_hld.c | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 72c62a809e92..89ba8b23c6fe 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
@@ -92,12 +92,14 @@ extern void arch_touch_nmi_watchdog(void); | |||
92 | extern void hardlockup_detector_perf_stop(void); | 92 | extern void hardlockup_detector_perf_stop(void); |
93 | extern void hardlockup_detector_perf_restart(void); | 93 | extern void hardlockup_detector_perf_restart(void); |
94 | extern void hardlockup_detector_perf_disable(void); | 94 | extern void hardlockup_detector_perf_disable(void); |
95 | extern void hardlockup_detector_perf_enable(void); | ||
95 | extern void hardlockup_detector_perf_cleanup(void); | 96 | extern void hardlockup_detector_perf_cleanup(void); |
96 | extern int hardlockup_detector_perf_init(void); | 97 | extern int hardlockup_detector_perf_init(void); |
97 | #else | 98 | #else |
98 | static inline void hardlockup_detector_perf_stop(void) { } | 99 | static inline void hardlockup_detector_perf_stop(void) { } |
99 | static inline void hardlockup_detector_perf_restart(void) { } | 100 | static inline void hardlockup_detector_perf_restart(void) { } |
100 | static inline void hardlockup_detector_perf_disable(void) { } | 101 | static inline void hardlockup_detector_perf_disable(void) { } |
102 | static inline void hardlockup_detector_perf_enable(void) { } | ||
101 | static inline void hardlockup_detector_perf_cleanup(void) { } | 103 | static inline void hardlockup_detector_perf_cleanup(void) { } |
102 | # if !defined(CONFIG_HAVE_NMI_WATCHDOG) | 104 | # if !defined(CONFIG_HAVE_NMI_WATCHDOG) |
103 | static inline int hardlockup_detector_perf_init(void) { return -ENODEV; } | 105 | static inline int hardlockup_detector_perf_init(void) { return -ENODEV; } |
diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c index f7e752e6e9b4..99a3f22e48cc 100644 --- a/kernel/watchdog_hld.c +++ b/kernel/watchdog_hld.c | |||
@@ -260,6 +260,17 @@ static int hardlockup_detector_event_create(void) | |||
260 | } | 260 | } |
261 | 261 | ||
262 | /** | 262 | /** |
263 | * hardlockup_detector_perf_enable - Enable the local event | ||
264 | */ | ||
265 | void hardlockup_detector_perf_enable(void) | ||
266 | { | ||
267 | if (hardlockup_detector_event_create()) | ||
268 | return; | ||
269 | |||
270 | perf_event_enable(this_cpu_read(watchdog_ev)); | ||
271 | } | ||
272 | |||
273 | /** | ||
263 | * hardlockup_detector_perf_disable - Disable the local event | 274 | * hardlockup_detector_perf_disable - Disable the local event |
264 | */ | 275 | */ |
265 | void hardlockup_detector_perf_disable(void) | 276 | void hardlockup_detector_perf_disable(void) |