Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp863197imw; Wed, 13 Jul 2022 09:17:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tNUfE9wV2cpbHr1kXsh/Rh4eTItH8l1vds2X4ceVsN2T9dQRScCWnQRalP9j1xK36rVpgf X-Received: by 2002:a17:907:9710:b0:72b:3271:c9f with SMTP id jg16-20020a170907971000b0072b32710c9fmr4257425ejc.91.1657729036337; Wed, 13 Jul 2022 09:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657729036; cv=none; d=google.com; s=arc-20160816; b=gxSyHcYWjRRaTzV9bctapGo8jXsLgAFx8wJ/mPAhTZrkGkH0e4UsvPWD4TRItsUqwU 3Yg/jKZpw8+va51sTdPjuvrDYJSXwDuIwqqVTXDc14EX9kNi6KNSLgtZ/JDvFOvz4RFC QdOUHuGPOnVrC3oSXwQEegs0WEi6EevW0xvN4WoBIM1aUdnWUET3dgGr5w0UAsFnB/pL yu0+rVnQPbWaTMdqWMFbHMPLtWg04dT04uxT9UK+2ZBC6hkRvo7ThTmyEH2LxJgC8mdy Aw3Yq7qm7lH447LlOzD5G1YNBeL4iHftVoCAjd1MK0ojKpA9LOTxUQky0dqvsNLqXmXY AeWA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u2K0EugPdrYrrSRtyLhyqh2X5IDubSfltxPB5W0G0Hc=; b=ni8PM2jo5Y27/AcEzD2Vpuq6BNHja7Pvc/+UMwd1xDo0xjhuMf+kBd/Twtt5+Sw6TG 5Hiq+2wLCTGvPxtKYZKBNLnG2x8oWCYG7yRqN5MMvGDK/zoyjet9P6sCLTSQ3MTvkB77 lhzAkKK74yHnmG+FjCgB9y40hWWNksi0DjqGncIQdJqkelnEcDlE89eOjjOUg76NHEA+ B6QnQEebAMu+Mo9h8tSmG13kmjbX/zs9H6O+OAMTTexdy6MJsTr9tCLLOzokZdL6++IT BRi3jHn/tuWp3d8wvPSW/CAJufril1LL40ga002SNllYdN4gyIlicGMzs1ztIR/08za8 +jyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Yc4o2ac8; 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=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc31-20020a1709078a1f00b0072b4567e761si2998498ejc.201.2022.07.13.09.16.51; Wed, 13 Jul 2022 09:17:16 -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=@ibm.com header.s=pp1 header.b=Yc4o2ac8; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236987AbiGMPsM (ORCPT + 99 others); Wed, 13 Jul 2022 11:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236972AbiGMPsI (ORCPT ); Wed, 13 Jul 2022 11:48:08 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB7B44F1A4; Wed, 13 Jul 2022 08:48:07 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26DFkswm012593; Wed, 13 Jul 2022 15:47:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=u2K0EugPdrYrrSRtyLhyqh2X5IDubSfltxPB5W0G0Hc=; b=Yc4o2ac86q2bLlGE3TreFM5w8V3+cPW5X7B4Zk1q9dkwAp3YCoZwSIZtGGy9EuqFigW3 l8rLONrQAC0u+fVf4Wi9W79Oinf6XYvnxcTVYUr6iIa2H03JFbzgDP05ktcAutAEqRsr M9PXI4f3E4G8+pPYI7xnhKfeQ+fbDs1rbRZkp6yVy8XigQWH/66jPnuyoVFCLCci5Eit kVyVtRG+uydW01cNwdomItsuEYZGUAxCwvyWsUc4UBzsoYhNhLgz9HukxpFDgyVO2XY1 0eaU+T4b3hp9JZwbn709Njli00O5WG5h/Us10+UJSq2wvX4XuJnH4m+IXcuS16irSyfy Ow== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ha108r06q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Jul 2022 15:47:38 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 26DFlbR7018838; Wed, 13 Jul 2022 15:47:37 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ha108r068-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Jul 2022 15:47:37 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26DFO5wb004094; Wed, 13 Jul 2022 15:47:35 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 3h8rrn2t3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Jul 2022 15:47:35 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26DFlh5d33030594 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Jul 2022 15:47:43 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F28EAE045; Wed, 13 Jul 2022 15:47:32 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 183C4AE053; Wed, 13 Jul 2022 15:47:32 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.2.121]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 13 Jul 2022 15:47:32 +0000 (GMT) From: Laurent Dufour To: mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, wim@linux-watchdog.org, linux@roeck-us.net, nathanl@linux.ibm.com, rdunlap@infradead.org Cc: haren@linux.vnet.ibm.com, hch@infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-watchdog@vger.kernel.org Subject: [PATCH v5 3/4] powerpc/watchdog: introduce a NMI watchdog's factor Date: Wed, 13 Jul 2022 17:47:28 +0200 Message-Id: <20220713154729.80789-4-ldufour@linux.ibm.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220713154729.80789-1-ldufour@linux.ibm.com> References: <20220713154729.80789-1-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: fEyRdgusg2_FMGlebhZnWXVajq2vuBp4 X-Proofpoint-GUID: 5LmUDs6LCrRXURe8OdI7uoTGSyYKtKVJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-13_05,2022-07-13_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 clxscore=1015 lowpriorityscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207130063 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,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 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. Reviewed-by: Nicholas Piggin Signed-off-by: Laurent Dufour --- 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.37.0