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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 646C5C433B4 for ; Tue, 4 May 2021 19:08:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34E3661182 for ; Tue, 4 May 2021 19:08:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232504AbhEDTJI (ORCPT ); Tue, 4 May 2021 15:09:08 -0400 Received: from mga17.intel.com ([192.55.52.151]:38656 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232123AbhEDTIY (ORCPT ); Tue, 4 May 2021 15:08:24 -0400 IronPort-SDR: QDQpcbCdp/YtvkyOiSzKv2kAcH8jtAdAaa777SAxXJMYAVKpipoRcbrogMSXJ1j77voox/up7b YG43e03OGqiA== X-IronPort-AV: E=McAfee;i="6200,9189,9974"; a="178269913" X-IronPort-AV: E=Sophos;i="5.82,272,1613462400"; d="scan'208";a="178269913" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2021 12:07:18 -0700 IronPort-SDR: 5t1wJq0ned5QVzhquYFXXy/H3YaNTACGOfa3FXOh7/O0IBPXKL050SdG2cXy0mi49ncGZT1wuI uIrLgMe4pCnw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,272,1613462400"; d="scan'208";a="618591763" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga006.fm.intel.com with ESMTP; 04 May 2021 12:07:18 -0700 From: Ricardo Neri To: Thomas Gleixner , Ingo Molnar , Borislav Petkov Cc: "H. Peter Anvin" , Ashok Raj , Andi Kleen , Tony Luck , Nicholas Piggin , "Peter Zijlstra (Intel)" , Andrew Morton , Stephane Eranian , Suravee Suthikulpanit , "Ravi V. Shankar" , Ricardo Neri , x86@kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri , Andi Kleen , linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH v5 15/16] watchdog: Expose lockup_detector_reconfigure() Date: Tue, 4 May 2021 12:05:25 -0700 Message-Id: <20210504190526.22347-16-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210504190526.22347-1-ricardo.neri-calderon@linux.intel.com> References: <20210504190526.22347-1-ricardo.neri-calderon@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When there are more than one implementation of the NMI watchdog, there may be situations in which switching from one to another is needed. For if the time-stamp counter becomes unstable, the HPET-based NMI watchdog an no longer be used. Switching to another hardlockup detector can be done cleanly by updating the arch-specific stub and then reconfiguring the whole lockup detector. Expose lockup_detector_reconfigure() to achieve this goal. Cc: "H. Peter Anvin" Cc: Ashok Raj Cc: Andi Kleen Cc: Tony Luck Cc: Nicholas Piggin Cc: Peter Zijlstra Cc: Andrew Morton Cc: Stephane Eranian Cc: Suravee Suthikulpanit Cc: "Ravi V. Shankar" Cc: x86@kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ricardo Neri --- Changes since v4: * Switching to the perf-based lockup detector under the hood is hacky. Instead, reconfigure the whole lockup detector. Changes since v3: * None Changes since v2: * Introduced this patch. Changes since v1: * N/A --- include/linux/nmi.h | 2 ++ kernel/watchdog.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/nmi.h b/include/linux/nmi.h index cf12380e51b3..73827a477288 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -16,6 +16,7 @@ void lockup_detector_init(void); void lockup_detector_soft_poweroff(void); void lockup_detector_cleanup(void); bool is_hardlockup(void); +void lockup_detector_reconfigure(void); extern int watchdog_user_enabled; extern int nmi_watchdog_user_enabled; @@ -37,6 +38,7 @@ extern int sysctl_hardlockup_all_cpu_backtrace; static inline void lockup_detector_init(void) { } static inline void lockup_detector_soft_poweroff(void) { } static inline void lockup_detector_cleanup(void) { } +static inline void lockup_detector_reconfigure(void) { } #endif /* !CONFIG_LOCKUP_DETECTOR */ #ifdef CONFIG_SOFTLOCKUP_DETECTOR diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 4615064ee282..96f06938dc83 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -531,7 +531,7 @@ int lockup_detector_offline_cpu(unsigned int cpu) return 0; } -static void lockup_detector_reconfigure(void) +void lockup_detector_reconfigure(void) { cpus_read_lock(); watchdog_nmi_stop(); @@ -577,7 +577,7 @@ static __init void lockup_detector_setup(void) } #else /* CONFIG_SOFTLOCKUP_DETECTOR */ -static void lockup_detector_reconfigure(void) +void lockup_detector_reconfigure(void) { cpus_read_lock(); watchdog_nmi_stop(); -- 2.17.1