From nobody Thu Sep 11 16:55:51 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E52E3C04A94 for ; Sat, 5 Aug 2023 16:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbjHEQCI (ORCPT ); Sat, 5 Aug 2023 12:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjHEQCG (ORCPT ); Sat, 5 Aug 2023 12:02:06 -0400 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECE4AE70 for ; Sat, 5 Aug 2023 09:02:04 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=liusong@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0Vp3juXZ_1691251304; Received: from localhost(mailfrom:liusong@linux.alibaba.com fp:SMTPD_---0Vp3juXZ_1691251304) by smtp.aliyun-inc.com; Sun, 06 Aug 2023 00:02:00 +0800 From: Liu Song To: akpm@linux-foundation.org, dianders@chromium.org, pmladek@suse.com Cc: liusong@linux.alibaba.com, linux-kernel@vger.kernel.org Subject: [PATCH] watchdog/hardlockup: set watchdog_hardlockup_warned to true as early as possible Date: Sun, 6 Aug 2023 00:01:44 +0800 Message-Id: <20230805160144.121875-1-liusong@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Since we want to ensure only printing hardlockups once, it is necessary to set "watchdog_hardlockup_warned" to true as early as possible. Signed-off-by: Liu Song --- kernel/watchdog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 25d5627a6580..c4795f2d148c 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -180,6 +180,8 @@ void watchdog_hardlockup_check(unsigned int cpu, struct= pt_regs *regs) /* Only print hardlockups once. */ if (per_cpu(watchdog_hardlockup_warned, cpu)) return; + else + per_cpu(watchdog_hardlockup_warned, cpu) =3D true; =20 pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", cpu); print_modules(); @@ -206,8 +208,6 @@ void watchdog_hardlockup_check(unsigned int cpu, struct= pt_regs *regs) =20 if (hardlockup_panic) nmi_panic(regs, "Hard LOCKUP"); - - per_cpu(watchdog_hardlockup_warned, cpu) =3D true; } else { per_cpu(watchdog_hardlockup_warned, cpu) =3D false; } --=20 2.19.1.6.gb485710b