From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751985AbdILTvU (ORCPT ); Tue, 12 Sep 2017 15:51:20 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:36388 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbdILTtg (ORCPT ); Tue, 12 Sep 2017 15:49:36 -0400 Message-Id: <20170912194148.180215498@linutronix.de> User-Agent: quilt/0.63-1 Date: Tue, 12 Sep 2017 21:37:20 +0200 From: Thomas Gleixner To: LKML Cc: Ingo Molnar , Peter Zijlstra , Borislav Petkov , Andrew Morton , Sebastian Siewior , Nicholas Piggin , Don Zickus , Chris Metcalf , Ulrich Obergfell Subject: [patch V2 26/29] lockup_detector/perf: Implement CPU enable replacement References: <20170912193654.321505854@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=lockup_detectorperf_Implement_CPU_enable_replacement.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Don Zickus Cc: Chris Metcalf Cc: Peter Zijlstra Cc: Sebastian Siewior Cc: Nicholas Piggin Cc: Ulrich Obergfell Cc: Borislav Petkov Cc: Andrew Morton Link: http://lkml.kernel.org/r/20170831073055.081402493@linutronix.de --- include/linux/nmi.h | 2 ++ kernel/watchdog_hld.c | 11 +++++++++++ 2 files changed, 13 insertions(+) --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -92,12 +92,14 @@ extern void arch_touch_nmi_watchdog(void extern void hardlockup_detector_perf_stop(void); extern void hardlockup_detector_perf_restart(void); extern void hardlockup_detector_perf_disable(void); +extern void hardlockup_detector_perf_enable(void); extern void hardlockup_detector_perf_cleanup(void); extern int hardlockup_detector_perf_init(void); #else static inline void hardlockup_detector_perf_stop(void) { } static inline void hardlockup_detector_perf_restart(void) { } static inline void hardlockup_detector_perf_disable(void) { } +static inline void hardlockup_detector_perf_enable(void) { } static inline void hardlockup_detector_perf_cleanup(void) { } # if !defined(CONFIG_HAVE_NMI_WATCHDOG) static inline int hardlockup_detector_perf_init(void) { return -ENODEV; } --- a/kernel/watchdog_hld.c +++ b/kernel/watchdog_hld.c @@ -260,6 +260,17 @@ static int hardlockup_detector_event_cre } /** + * hardlockup_detector_perf_enable - Enable the local event + */ +void hardlockup_detector_perf_enable(void) +{ + if (hardlockup_detector_event_create()) + return; + + perf_event_enable(this_cpu_read(watchdog_ev)); +} + +/** * hardlockup_detector_perf_disable - Disable the local event */ void hardlockup_detector_perf_disable(void)