From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by aws-us-west-2-korg-lkml-1.web.codeaurora.org (Postfix) with ESMTP id B3AC5C5CFF1 for ; Wed, 13 Jun 2018 01:01:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6793D208BA for ; Wed, 13 Jun 2018 01:01:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6793D208BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935144AbeFMBBt (ORCPT ); Tue, 12 Jun 2018 21:01:49 -0400 Received: from mga14.intel.com ([192.55.52.115]:64688 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935095AbeFMBBm (ORCPT ); Tue, 12 Jun 2018 21:01:42 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2018 18:01:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,216,1526367600"; d="scan'208";a="47283535" Received: from voyager.sc.intel.com ([10.3.52.149]) by fmsmga008.fm.intel.com with ESMTP; 12 Jun 2018 18:01:36 -0700 From: Ricardo Neri To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: Andi Kleen , Ashok Raj , Borislav Petkov , Tony Luck , "Ravi V. Shankar" , x86@kernel.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Ricardo Neri , Jacob Pan , "Rafael J. Wysocki" , Don Zickus , Nicholas Piggin , Michael Ellerman , Frederic Weisbecker , Alexei Starovoitov , Babu Moger , Mathieu Desnoyers , Masami Hiramatsu , Peter Zijlstra , Andrew Morton , Philippe Ombredanne , Colin Ian King , Byungchul Park , "Paul E. McKenney" , "Luis R. Rodriguez" , Waiman Long , Josh Poimboeuf , Randy Dunlap , Davidlohr Bueso , Christoffer Dall , Marc Zyngier , Kai-Heng Feng , Konrad Rzeszutek Wilk , David Rientjes , iommu@lists.linux-foundation.org Subject: [RFC PATCH 22/23] watchdog/hardlockup/hpet: Only enable the HPET watchdog via a boot parameter Date: Tue, 12 Jun 2018 17:57:42 -0700 Message-Id: <1528851463-21140-23-git-send-email-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528851463-21140-1-git-send-email-ricardo.neri-calderon@linux.intel.com> References: <1528851463-21140-1-git-send-email-ricardo.neri-calderon@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Keep the HPET-based hardlockup detector disabled unless explicitly enabled via a command line argument. If such parameter is not given, the hardlockup detector will fallback to use the perf-based implementation. The function hardlockup_panic_setup() is updated to return 0 in order to to allow __setup functions of specific hardlockup detectors (in this case hardlockup_detector_hpet_setup()) to inspect the nmi_watchdog boot parameter. Cc: Ashok Raj Cc: Andi Kleen Cc: Tony Luck Cc: Borislav Petkov Cc: Jacob Pan Cc: "Rafael J. Wysocki" Cc: Don Zickus Cc: Nicholas Piggin Cc: Michael Ellerman Cc: Frederic Weisbecker Cc: Alexei Starovoitov Cc: Babu Moger Cc: Mathieu Desnoyers Cc: Masami Hiramatsu Cc: Peter Zijlstra Cc: Andrew Morton Cc: Philippe Ombredanne Cc: Colin Ian King Cc: Byungchul Park Cc: "Paul E. McKenney" Cc: "Luis R. Rodriguez" Cc: Waiman Long Cc: Josh Poimboeuf Cc: Randy Dunlap Cc: Davidlohr Bueso Cc: Christoffer Dall Cc: Marc Zyngier Cc: Kai-Heng Feng Cc: Konrad Rzeszutek Wilk Cc: David Rientjes Cc: "Ravi V. Shankar" Cc: x86@kernel.org Cc: iommu@lists.linux-foundation.org Signed-off-by: Ricardo Neri -- checkpatch gives the following warning: CHECK: __setup appears un-documented -- check Documentation/admin-guide/kernel-parameters.rst +__setup("nmi_watchdog=", hardlockup_detector_hpet_setup); This is a false-positive as the option nmi_watchdog is already documented. The option is re-evaluated in this file as well. --- Documentation/admin-guide/kernel-parameters.txt | 5 ++++- kernel/watchdog.c | 2 +- kernel/watchdog_hld_hpet.c | 13 +++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index f2040d4..a8833c7 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2577,7 +2577,7 @@ Format: [state][,regs][,debounce][,die] nmi_watchdog= [KNL,BUGS=X86] Debugging features for SMP kernels - Format: [panic,][nopanic,][num] + Format: [panic,][nopanic,][num,][hpet] Valid num: 0 or 1 0 - turn hardlockup detector in nmi_watchdog off 1 - turn hardlockup detector in nmi_watchdog on @@ -2587,6 +2587,9 @@ please see 'nowatchdog'. This is useful when you use a panic=... timeout and need the box quickly up again. + When hpet is specified, the NMI watchdog will be driven + by an HPET timer, if available in the system. Otherwise, + the perf-based implementation will be used. These settings can be accessed at runtime via the nmi_watchdog and hardlockup_panic sysctls. diff --git a/kernel/watchdog.c b/kernel/watchdog.c index b94bbe3..b5ce6e4 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -84,7 +84,7 @@ static int __init hardlockup_panic_setup(char *str) nmi_watchdog_user_enabled = 0; else if (!strncmp(str, "1", 1)) nmi_watchdog_user_enabled = 1; - return 1; + return 0; } __setup("nmi_watchdog=", hardlockup_panic_setup); diff --git a/kernel/watchdog_hld_hpet.c b/kernel/watchdog_hld_hpet.c index ebb820d..12e5937 100644 --- a/kernel/watchdog_hld_hpet.c +++ b/kernel/watchdog_hld_hpet.c @@ -17,6 +17,7 @@ #define pr_fmt(fmt) "NMI hpet watchdog: " fmt static struct hpet_hld_data *hld_data; +static bool hardlockup_use_hpet; /** * get_count() - Get the current count of the HPET timer @@ -488,6 +489,15 @@ static void hardlockup_detector_hpet_stop(void) spin_unlock(&hld_data->lock); } +static int __init hardlockup_detector_hpet_setup(char *str) +{ + if (strstr(str, "hpet")) + hardlockup_use_hpet = true; + + return 0; +} +__setup("nmi_watchdog=", hardlockup_detector_hpet_setup); + /** * hardlockup_detector_hpet_init() - Initialize the hardlockup detector * @@ -502,6 +512,9 @@ static int __init hardlockup_detector_hpet_init(void) { int ret; + if (!hardlockup_use_hpet) + return -EINVAL; + if (!is_hpet_enabled()) return -ENODEV; -- 2.7.4