Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp1310776rwb; Sat, 5 Aug 2023 11:47:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCMwsUNuXrk3U6cHmmg1SHgU/vxSWFUt2ezmMqt8A8IuN8K67ePgBfoT3HXeUiavTMAomj X-Received: by 2002:a05:6a20:3c8e:b0:135:38b5:7e58 with SMTP id b14-20020a056a203c8e00b0013538b57e58mr4951556pzj.37.1691261258551; Sat, 05 Aug 2023 11:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691261258; cv=none; d=google.com; s=arc-20160816; b=H6yvqcGVJHyLXo4U8094duA1voBK1icUI1XC3oKlUpzwnv1J/RhdtDTQ6DbMnigWQl QeTdUDU51+XTxVv4dzn74shaEMaKhqTLQkE+ZvfHWJ5ZVIAjgsTmXWR33/XM4ToJaOqK 2gK/WqruqhETV6gyFHdyWeXTGx1Ys3A7PjhGMpeg40CqVmD4rqsoOeiIQl+51HfMkjfA 5gZvgM4rOpgoeTECVZ8zw7T8g8rzZdR0WCFQhwb8Jz5+tBJOWmxkYlYGTL3Q53JJvP6Q 84S6qFdrWkb91t289VXw93fAL+cTDSkIWfUTjLUJC9je2IBwKRjhyk07BVc2XQH/K529 DxvQ== 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:subject:cc:to:from:date :dkim-signature; bh=KUhQuUipOxVdG62tWMfNTny1If5GbGXnap1Ete8r8v8=; fh=ZAUR/riWv0E8nzPC/eKBoTiEDAAoDxe0Tg8tiU/e90E=; b=GwTU6WG4si/8otG9qBeG2J9oyGpZoA3bLz6HLu1ECZQ1qzmZRyCmQxbOy0M98f25wU vunQSP/+DvJEcz59/PaL21EoWqXENIHBOjDUOTm4GGJd0vHxRD54uE4q7DfHDQO5/EaR nvM8HdJaoY5PDVeQpTfYVUJUopKq0tWtczmZQwm9tkuMEoT69t9bH7cZ0TW/H8aNoqWq SwxuMqzNjzV6uwdeSz0my1w1qRnaWMejJQ4AbJU4fJV0tQoTLb2fZKkJhZx7xvjEVxYI bSf2iJn67Jgl3A/ouo/NTFOgTXTkBUM6QyzDdDX1qV5BQcnLSIP31S2JxJasFX7yjZZF n1NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=rpCCU5Hg; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a6568c2000000b0053059dfafe4si3438925pgt.86.2023.08.05.11.47.26; Sat, 05 Aug 2023 11:47:38 -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=@linux-foundation.org header.s=korg header.b=rpCCU5Hg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbjHERRa (ORCPT + 99 others); Sat, 5 Aug 2023 13:17:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbjHERR2 (ORCPT ); Sat, 5 Aug 2023 13:17:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A7B44B0 for ; Sat, 5 Aug 2023 10:17:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A3C860B58 for ; Sat, 5 Aug 2023 17:17:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 826CCC433C8; Sat, 5 Aug 2023 17:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1691255826; bh=AOpLCYFW168ND86mxqBnQZPc5+390+3vfxj/HBFuURo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rpCCU5Hgwsc+2UH+IR8bzAzCGvstNbtn0pPpFEePLtrTZ1DSYYjBxu++AdFZ/2+Sf mi66iY7YKFb6UUfVcGim68NwGO97aREeP8VT+vDP8hpIBoKiGXZucb6ymgZN1kfK53 2Bxo0Uqguq6RZG4vm4VS5GZXxV3bMo9aUP/Swidc= Date: Sat, 5 Aug 2023 10:17:05 -0700 From: Andrew Morton To: Liu Song Cc: dianders@chromium.org, pmladek@suse.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] watchdog/hardlockup: set watchdog_hardlockup_warned to true as early as possible Message-Id: <20230805101705.3a38ce9aacc924f1c9f0842b@linux-foundation.org> In-Reply-To: <20230805160144.121875-1-liusong@linux.alibaba.com> References: <20230805160144.121875-1-liusong@linux.alibaba.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 On Sun, 6 Aug 2023 00:01:44 +0800 Liu Song wrote: > Since we want to ensure only printing hardlockups once, it is necessary > to set "watchdog_hardlockup_warned" to true as early as possible. > > ... > > --- 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) = true; The "else" is unneeded. > 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) > > if (hardlockup_panic) > nmi_panic(regs, "Hard LOCKUP"); > - > - per_cpu(watchdog_hardlockup_warned, cpu) = true; > } else { > per_cpu(watchdog_hardlockup_warned, cpu) = false; > } When resending, please tell us some more about the effects of the change. Presumably there are circumstances in which excess output is produced? If so, describe these circumstances and the observed effects.