Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4435467imw; Tue, 12 Jul 2022 07:55:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v+MD9wuJcN188QreR+XKhO+qQT3d46IU8k3oy1DiGNoywRGhA9pFw5o37RJ18FGTv6oSgC X-Received: by 2002:a17:902:b488:b0:16a:7013:69f0 with SMTP id y8-20020a170902b48800b0016a701369f0mr24812531plr.118.1657637750711; Tue, 12 Jul 2022 07:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657637750; cv=none; d=google.com; s=arc-20160816; b=yTObWFl75Vt802zxTZ2zR61ADmBS+w6vlEjkMAJgko8tyPYBtPc2UBzyoMCJV52AGW ZdLabiL388MajEDKdegR/P8XPDCsUk+b0tvqmEJyz/sV/INliXzhBhpoCHukqIIG6j/h U8Zub7puberc8hsYCde/k4nJIlC+5ilONirSsCNqLt1ulqtZGAzVZrxD74KNbTI6HTF0 0JidbTOZZeD+VwlK5wWG9A1FvC6eYQuOrb2sqaUTKo8nEECWHfqQ/Fk15HAf+rPe+FHr sj24maoZIuOE7/4ciKid7P4lgcWjo2mK7ZXtZNwxx/I6rHDT9YkvNzYWfab2eQ6mMOPT B3ig== 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=5ubSAhK9MadoENIdxzLVflCgge7eS08M/oEp20xeqZc=; b=ueKO5mFzfV/vfgsNEEsxY6cKEfNp97X1Q+K0h/HObW+FFrG5gE1P22G26CZfV5tmI7 0v8735D2zOWYyeF+B1ZDdS0tlZVDHTR02cH2TwqrcmD2wyLvJute0Jo5CjW3ZxZi/v8l iM9JxTSEIZhcZN9mTx7bgxffCxDS6hrJXydS41goeJf2RT8EhcwMHjr2N55CvznZtphT 0CnHlvFDlgyXDGvKU4qDzQ3iZZNNgzY2zvOrTKbxB0Spza8/etwW60lvdlrntkdxUSsk hJ44ggZFVV4luo5oxwFzVB9vMk8P4gN6itsivxIOVrT7LuAcGDKVVgIG3mVcoEXd2Vbr NoxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TXktl4bA; 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 d10-20020a170902f14a00b0016bbdf2a61fsi10879292plb.274.2022.07.12.07.55.37; Tue, 12 Jul 2022 07:55:50 -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=TXktl4bA; 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 S229683AbiGLOhZ (ORCPT + 99 others); Tue, 12 Jul 2022 10:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbiGLOhY (ORCPT ); Tue, 12 Jul 2022 10:37:24 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 755C42707; Tue, 12 Jul 2022 07:37:23 -0700 (PDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26CEau8b011499; Tue, 12 Jul 2022 14:37:02 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=5ubSAhK9MadoENIdxzLVflCgge7eS08M/oEp20xeqZc=; b=TXktl4bAaXcZXegbXRjt6CG/0+mQSXDx4mWvZ+GM4jxWes8ShLISrwfzSEKhWzexrkiy YrsGcISd0X8ZvOI9s/fuFaYCmRtXI1YNh7ctaMFLgMg6anXJbDorS01yipBmOzNtGzd7 5+pTHyvwVu4a3TigrzLUNe3dYzzLkfP+FSmjMEZeYoezMqwZWzh9AoFVGZKfjyMnY0LO 5Xh+K4nw2ZvJ+1WddfrrDKuiIbJ5vGN1pVwBjbb9y72hfohN6x2QW3xii1Kldv3X01LV cqQaROtG4L6GRU9+qcC9i6PC1LDLv6TfQ+IZTqi7DAtniLiqRG+kcVRvrjs3ReXL6ayO UQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3h969809rp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Jul 2022 14:37:01 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 26CEb1Cg012144; Tue, 12 Jul 2022 14:37:01 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3h969809h2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Jul 2022 14:37:01 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26CEKCk7024546; Tue, 12 Jul 2022 14:32:07 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 3h70xhvauv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Jul 2022 14:32:07 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26CEW57x21889526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Jul 2022 14:32:05 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6ED78A4054; Tue, 12 Jul 2022 14:32:05 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9461A405C; Tue, 12 Jul 2022 14:32:04 +0000 (GMT) Received: from pomme.tlslab.ibm.com (unknown [9.101.4.33]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 12 Jul 2022 14:32:04 +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 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 v4 4/4] pseries/mobility: set NMI watchdog factor during LPM Date: Tue, 12 Jul 2022 16:32:02 +0200 Message-Id: <20220712143202.23144-5-ldufour@linux.ibm.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220712143202.23144-1-ldufour@linux.ibm.com> References: <20220712143202.23144-1-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: zC0O_VQigcbeif90ysm-vPGd-SdNmXcM X-Proofpoint-GUID: EMsToIFc0IgO1oF9GGMKslaLjHC2osb1 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-12_08,2022-07-12_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 mlxscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207120056 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 During a LPM, while the memory transfer is in progress on the arrival side, some latencies is generated when accessing not yet transferred pages on the arrival side. Thus, the NMI watchdog may be triggered too frequently, which increases the risk to hit a NMI interrupt in a bad place in the kernel, leading to a kernel panic. Disabling the Hard Lockup Watchdog until the memory transfer could be a too strong work around, some users would want this timeout to be eventually triggered if the system is hanging even during LPM. Introduce a new sysctl variable nmi_watchdog_factor. It allows to apply a factor to the NMI watchdog timeout during a LPM. Just before the CPU are stopped for the switchover sequence, the NMI watchdog timer is set to watchdog_tresh + factor% A value of 0 has no effect. The default value is 200, meaning that the NMI watchdog is set to 30s during LPM (based on a 10s watchdog_tresh value). Once the memory transfer is achieved, the factor is reset to 0. Setting this value to a high number is like disabling the NMI watchdog during a LPM. Reviewed-by: Nicholas Piggin Signed-off-by: Laurent Dufour --- Documentation/admin-guide/sysctl/kernel.rst | 12 ++++++ arch/powerpc/platforms/pseries/mobility.c | 43 +++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst index ddccd1077462..0bb0b7f27e96 100644 --- a/Documentation/admin-guide/sysctl/kernel.rst +++ b/Documentation/admin-guide/sysctl/kernel.rst @@ -592,6 +592,18 @@ to the guest kernel command line (see Documentation/admin-guide/kernel-parameters.rst). +nmi_watchdog_factor (PPC only) +================================== + +Factor apply to to the NMI watchdog timeout (only when ``nmi_watchdog`` is +set to 1). This factor represents the percentage added to +``watchdog_thresh`` when calculating the NMI watchdog timeout during a +LPM. The soft lockup timeout is not impacted. + +A value of 0 means no change. The default value is 200 meaning the NMI +watchdog is set to 30s (based on ``watchdog_thresh`` equal to 10). + + numa_balancing ============== diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c index 6297467072e6..78535a0791f9 100644 --- a/arch/powerpc/platforms/pseries/mobility.c +++ b/arch/powerpc/platforms/pseries/mobility.c @@ -48,6 +48,39 @@ struct update_props_workarea { #define MIGRATION_SCOPE (1) #define PRRN_SCOPE -2 +#ifdef CONFIG_PPC_WATCHDOG +static unsigned int nmi_wd_factor = 200; + +#ifdef CONFIG_SYSCTL +static struct ctl_table nmi_wd_factor_ctl_table[] = { + { + .procname = "nmi_watchdog_factor", + .data = &nmi_wd_factor, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_douintvec_minmax, + }, + {} +}; +static struct ctl_table nmi_wd_factor_sysctl_root[] = { + { + .procname = "kernel", + .mode = 0555, + .child = nmi_wd_factor_ctl_table, + }, + {} +}; + +static int __init register_nmi_wd_factor_sysctl(void) +{ + register_sysctl_table(nmi_wd_factor_sysctl_root); + + return 0; +} +device_initcall(register_nmi_wd_factor_sysctl); +#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_PPC_WATCHDOG */ + static int mobility_rtas_call(int token, char *buf, s32 scope) { int rc; @@ -702,13 +735,20 @@ static int pseries_suspend(u64 handle) static int pseries_migrate_partition(u64 handle) { int ret; + unsigned int factor = 0; +#ifdef CONFIG_PPC_WATCHDOG + factor = nmi_wd_factor; +#endif ret = wait_for_vasi_session_suspending(handle); if (ret) return ret; vas_migration_handler(VAS_SUSPEND); + if (factor) + watchdog_nmi_set_timeout_pct(factor); + ret = pseries_suspend(handle); if (ret == 0) { post_mobility_fixup(); @@ -722,6 +762,9 @@ static int pseries_migrate_partition(u64 handle) } else pseries_cancel_migration(handle, ret); + if (factor) + watchdog_nmi_set_timeout_pct(0); + vas_migration_handler(VAS_RESUME); return ret; -- 2.37.0