From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751454AbdIMSCo (ORCPT ); Wed, 13 Sep 2017 14:02:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51436 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751106AbdIMSCj (ORCPT ); Wed, 13 Sep 2017 14:02:39 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 64C587EA8D Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dzickus@redhat.com Date: Wed, 13 Sep 2017 14:02:37 -0400 From: Don Zickus To: Thomas Gleixner Cc: LKML , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Andrew Morton , Sebastian Siewior , Nicholas Piggin , Chris Metcalf , Ulrich Obergfell Subject: Re: [patch V2 25/29] lockup_detector: Implement init time detection of perf Message-ID: <20170913180237.whri2g7soahd3ljl@redhat.com> References: <20170912193654.321505854@linutronix.de> <20170912194148.099799541@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170912194148.099799541@linutronix.de> User-Agent: NeoMutt/20170428-dirty (1.8.2) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 13 Sep 2017 18:02:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 12, 2017 at 09:37:19PM +0200, Thomas Gleixner wrote: > 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 > 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/20170831073054.997264122@linutronix.de > > --- > kernel/watchdog.c | 13 ++++++++++++- > 1 file changed, 12 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; > @@ -114,6 +115,12 @@ void __weak watchdog_nmi_disable(unsigne > hardlockup_detector_perf_disable(); > } > > +/* Return 0, if a NMI watchdog is available. Error code otherwise */ > +int __weak __init void watchdog_nmi_probe(void) ^^^ compile error, can't have 'int' and 'void'. Removing 'void' fixes it. Cheers, Don > +{ > + return hardlockup_detector_perf_init(); > +} > + > /** > * watchdog_nmi_reconfigure - Optional function to reconfigure NMI watchdogs > * @run: If false stop the watchdogs on all enabled CPUs > @@ -145,7 +152,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; > @@ -692,6 +699,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); > } > @@ -764,5 +773,7 @@ void __init lockup_detector_init(void) > cpumask_copy(&watchdog_cpumask, cpu_possible_mask); > #endif > > + if (!watchdog_nmi_probe()) > + nmi_watchdog_available = true; > softlockup_init_threads(); > } > >