From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751983AbdHaHdj (ORCPT ); Thu, 31 Aug 2017 03:33:39 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:58943 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbdHaHbx (ORCPT ); Thu, 31 Aug 2017 03:31:53 -0400 Message-Id: <20170831073054.997264122@linutronix.de> User-Agent: quilt/0.63-1 Date: Thu, 31 Aug 2017 09:16:23 +0200 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Ingo Molnar , Andrew Morton , Borislav Petkov , Sebastian Siewior , Nicholas Piggin , Don Zickus , Chris Metcalf , Ulrich Obergfell Subject: [patch 25/29] lockup_detector: Implement init time detection of perf References: <20170831071558.995235362@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=lockup_detector--Implement-init-time-detection-of-PERF.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the init time detection of the perf NMI watchdog to determine whether the perf NMI watchdog is functional. If not disable it permanentely. It won't come back magically at runtime. Signed-off-by: Thomas Gleixner --- kernel/watchdog.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -44,6 +44,7 @@ int __read_mostly watchdog_user_enabled int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT; int __read_mostly soft_watchdog_user_enabled = 1; int __read_mostly watchdog_thresh = 10; +int __read_mostly nmi_watchdog_available; struct cpumask watchdog_allowed_mask __read_mostly; static bool softlockup_threads_initialized __read_mostly; @@ -138,7 +139,7 @@ static void lockup_detector_update_enabl watchdog_enabled = 0; if (!watchdog_user_enabled) return; - if (nmi_watchdog_user_enabled) + if (nmi_watchdog_available && nmi_watchdog_user_enabled) watchdog_enabled |= NMI_WATCHDOG_ENABLED; if (soft_watchdog_user_enabled) watchdog_enabled |= SOFT_WATCHDOG_ENABLED; @@ -686,6 +687,8 @@ int proc_watchdog(struct ctl_table *tabl int proc_nmi_watchdog(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { + if (!nmi_watchdog_available && write) + return -ENOTSUPP; return proc_watchdog_common(NMI_WATCHDOG_ENABLED, table, write, buffer, lenp, ppos); } @@ -746,6 +749,12 @@ int proc_watchdog_cpumask(struct ctl_tab } #endif /* CONFIG_SYSCTL */ +static __init void detect_nmi_watchdog(void) +{ + if (!hardlockup_detector_perf_init()) + nmi_watchdog_available = true; +} + void __init lockup_detector_init(void) { #ifdef CONFIG_NO_HZ_FULL @@ -758,5 +767,6 @@ void __init lockup_detector_init(void) cpumask_copy(&watchdog_cpumask, cpu_possible_mask); #endif + detect_nmi_watchdog(); softlockup_init_threads(); }