Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3469522rwa; Tue, 23 Aug 2022 05:24:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR6kM1FNmSBApV2qVrSTya3gafnDrNp4MopD6zCva5qCan5JJib/BfVJxigUZNCL0LwdwjmH X-Received: by 2002:a65:5a0c:0:b0:429:c80e:959c with SMTP id y12-20020a655a0c000000b00429c80e959cmr20978932pgs.279.1661257450557; Tue, 23 Aug 2022 05:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661257450; cv=none; d=google.com; s=arc-20160816; b=gU/j9R6tZa7zCi8qitxUxrNCEqHLeS6BRcXmbs9A3Ld9h8neKH2ZRCC7gaYWQxxbQ1 C60hYxfJ+b2w/NveGR+jtKMOKal/K4ogXU7VVat7R1kJfevbGXYJbasEpUt/bJP1kJFg UHFy2ja7P7eo7b9HrAiWPhGylJaAp9PoS9c4Td0AekwOf6bTTU9VcqnT0VtaFaOcHefv ay0q4XdJhZ1XMP6wfM4JrOIwzGzQhP5YgvtUS085aBOBSokmV0hR8YyUOp+p9haXJ69e R0NFzUjAgbWZwqv0Fo/7fNX3Xw+QoLJcfzYJh1Iq0fXn4SmNKEnrZH0QclWUlHuImVvG KxkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5nR9h3zGHBHCUuIPpn7n+P5QhdUv3OC5E1kTJgm9Mzc=; b=VnHfiHbaPJAsEky5R7uxd9jgVNGiKQrKk9V5oplQoPqBnTwKIl5RAWpdFrOsXo9T41 JWcRAhdNksoqLYQXSVn/G/Kj2DqwuBHnuD+lHeOyqHBEQv8AknmvSQzpMBuauBXvMPWm P++vsKkQQzDHr1dMNJTRw4qbl6Nm4mkOJzNFPM83+rgru8KpfxnTuVuWK7DI1za3gB5W /Ic/N3qlwyaV74ol744mGyizlxdxtPOtFOEEYR1+bcfAdlf4N1cnVXqBWkWuFZpnEalp aCoN9ML5KvzejisNS8rYirmoo7lQMmSH4L3DdN8rQgxXpYdzrUhsfWSuYHB9JxsAMQPd Bevg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BkGoTgAd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020a056a00218300b0050605f7112bsi16774485pfi.130.2022.08.23.05.23.59; Tue, 23 Aug 2022 05:24:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BkGoTgAd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241417AbiHWJwq (ORCPT + 99 others); Tue, 23 Aug 2022 05:52:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351794AbiHWJuz (ORCPT ); Tue, 23 Aug 2022 05:50:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB349E110; Tue, 23 Aug 2022 01:45:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A56EDB81C56; Tue, 23 Aug 2022 08:34:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 056A3C4347C; Tue, 23 Aug 2022 08:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243647; bh=8Vs1K216HeZwGcDjWgWfkjFQVdk3bJl/msDS7/SN7ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BkGoTgAds6UCcopmFRCkeNAvCL7tfKFf3vsIMkH94TTl8sNvVf4NszW+NgbVoy+VG a0XWGOdbJoy9es73zKGDWZJQHKIcuUjE9vLL9twVYdQfwn1Obf/pFVe6uB4IIq8fQb m7jbyJBVyr+uCwvvyexQx0wRVWv9KrBIjwa8rAjE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Dufour , Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 344/365] powerpc/watchdog: introduce a NMI watchdogs factor Date: Tue, 23 Aug 2022 10:04:05 +0200 Message-Id: <20220823080132.629878606@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laurent Dufour [ Upstream commit f5e74e836097d1004077390717d4bd95d4a2c27a ] Introduce a factor which would apply to the NMI watchdog timeout. This factor is a percentage added to the watchdog_tresh value. The value is set under the watchdog_mutex protection and lockup_detector_reconfigure() is called to recompute wd_panic_timeout_tb. Once the factor is set, it remains until it is set back to 0, which means no impact. Signed-off-by: Laurent Dufour Reviewed-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220713154729.80789-4-ldufour@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/nmi.h | 2 ++ arch/powerpc/kernel/watchdog.c | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/nmi.h b/arch/powerpc/include/asm/nmi.h index ea0e487f87b1..c3c7adef74de 100644 --- a/arch/powerpc/include/asm/nmi.h +++ b/arch/powerpc/include/asm/nmi.h @@ -5,8 +5,10 @@ #ifdef CONFIG_PPC_WATCHDOG extern void arch_touch_nmi_watchdog(void); long soft_nmi_interrupt(struct pt_regs *regs); +void watchdog_nmi_set_timeout_pct(u64 pct); #else static inline void arch_touch_nmi_watchdog(void) {} +static inline void watchdog_nmi_set_timeout_pct(u64 pct) {} #endif #ifdef CONFIG_NMI_IPI diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c index 7d28b9553654..5d903e63f932 100644 --- a/arch/powerpc/kernel/watchdog.c +++ b/arch/powerpc/kernel/watchdog.c @@ -91,6 +91,10 @@ static cpumask_t wd_smp_cpus_pending; static cpumask_t wd_smp_cpus_stuck; static u64 wd_smp_last_reset_tb; +#ifdef CONFIG_PPC_PSERIES +static u64 wd_timeout_pct; +#endif + /* * Try to take the exclusive watchdog action / NMI IPI / printing lock. * wd_smp_lock must be held. If this fails, we should return and wait @@ -527,7 +531,13 @@ static int stop_watchdog_on_cpu(unsigned int cpu) static void watchdog_calc_timeouts(void) { - wd_panic_timeout_tb = watchdog_thresh * ppc_tb_freq; + u64 threshold = watchdog_thresh; + +#ifdef CONFIG_PPC_PSERIES + threshold += (READ_ONCE(wd_timeout_pct) * threshold) / 100; +#endif + + wd_panic_timeout_tb = threshold * ppc_tb_freq; /* Have the SMP detector trigger a bit later */ wd_smp_panic_timeout_tb = wd_panic_timeout_tb * 3 / 2; @@ -570,3 +580,12 @@ int __init watchdog_nmi_probe(void) } return 0; } + +#ifdef CONFIG_PPC_PSERIES +void watchdog_nmi_set_timeout_pct(u64 pct) +{ + pr_info("Set the NMI watchdog timeout factor to %llu%%\n", pct); + WRITE_ONCE(wd_timeout_pct, pct); + lockup_detector_reconfigure(); +} +#endif -- 2.35.1