From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4AFA3C77B73 for ; Fri, 5 May 2023 03:02:51 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QCFqF5kGxz3fFY for ; Fri, 5 May 2023 13:02:49 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=l8NOWx+J; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::62b; helo=mail-pl1-x62b.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=l8NOWx+J; dkim-atps=neutral Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QCFpJ1dtvz3bZv for ; Fri, 5 May 2023 13:02:00 +1000 (AEST) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1aaef97652fso8594345ad.0 for ; Thu, 04 May 2023 20:01:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683255717; x=1685847717; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4PZDk7grPMVm0G4plF1AOyfal6UfKUjeqMY34ZW+ZAQ=; b=l8NOWx+JbMx094FOTHTTAYeieKLG6l+RoxKooetFCoRg01JgRpRgmVK4EEnqQGp5Rv Wo7jd5ZE+BhoTQ83yfVxkRWDV8+8fYgzKrUQG+mG2SKoUwQzV4PiqCThKZNktLEkx80D dbZRbHCpWflzRiQ+5dUIKlwArRroFaTk4Ds/n3538KW17NDJa0a+h/l5niHUznruDebe bM/9WMTgDrGpzcJNg2dEdXkiWqJTXpKVuu+xjnqek1SKKSYnqTk3zeH62sRwe7eJhyjM UEdL7abKjXNavxqB2b/VypuWuDH+efkVGB6cwaNtCumipgGM0sxe7eY6ZqTznd4UjVkh DJMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683255717; x=1685847717; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4PZDk7grPMVm0G4plF1AOyfal6UfKUjeqMY34ZW+ZAQ=; b=Ta5E5rz626gvsy8+Z1SvyNPBIq2IPkD7gh0OPXDCF46qx+k4t5iNrsNJdkKkHLuJMM yR/StnFfGOb7x5dVeLKL87EpB6ckXTuLI4MLbxeaTZhMtMUvLeSeBKREaASvHdlLbzM/ q9v4ZzQpBCsVfW11QYn66m/a1OHRJiL6t1Ft8tOc5oCwfANbtL2ExzfqemobKjnq21CZ jAjB1bU0DREIN6NI6gH6upKRHzj7+razcjXVSZufbUmgONZaGeAXxW4c7jLohH1vMNDP NRrADUCpf6fD5Se0xAqZY86UC3e1m3p/dmKgLOhYoP7/OrjPDDcmPCZcz13zpGzfL8s0 GwUw== X-Gm-Message-State: AC+VfDxKjj5vLXSAkr07s4n6hAP71d3CyJXwi0MlS7N5L9jqJQBCz2Xf 9SkztL8dU3cp5Y+PdMc3Z9c= X-Google-Smtp-Source: ACHHUZ5Ox+yCPXhRH+Zo/Bf0YWlPnoiHwxarQldt5h1nNQM5kPEVVWcuprv1MbKY8J2RKwbHQwgMKQ== X-Received: by 2002:a17:903:187:b0:1a2:8c7e:f301 with SMTP id z7-20020a170903018700b001a28c7ef301mr6214939plg.45.1683255717124; Thu, 04 May 2023 20:01:57 -0700 (PDT) Received: from localhost ([203.59.190.92]) by smtp.gmail.com with ESMTPSA id jj22-20020a170903049600b0019fea4d61c9sm354034plb.198.2023.05.04.20.01.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 May 2023 20:01:56 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 05 May 2023 13:01:41 +1000 Message-Id: Subject: Re: [PATCH v4 08/17] watchdog/hardlockup: Style changes to watchdog_hardlockup_check() / ..._is_lockedup() From: "Nicholas Piggin" To: "Douglas Anderson" , "Petr Mladek" , "Andrew Morton" X-Mailer: aerc 0.14.0 References: <20230504221349.1535669-1-dianders@chromium.org> <20230504151100.v4.8.I818492c326b632560b09f20d2608455ecf9d3650@changeid> In-Reply-To: <20230504151100.v4.8.I818492c326b632560b09f20d2608455ecf9d3650@changeid> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ian Rogers , Randy Dunlap , Lecopzer Chen , kgdb-bugreport@lists.sourceforge.net, ricardo.neri@intel.com, Stephane Eranian , Guenter Roeck , sparclinux@vger.kernel.org, Will Deacon , Daniel Thompson , Andi Kleen , Chen-Yu Tsai , Matthias Kaehlcke , Catalin Marinas , Masayoshi Mizuma , ravi.v.shankar@intel.com, Tzung-Bi Shih , Stephen Boyd , Pingfan Liu , linux-arm-kernel@lists.infradead.org, Sumit Garg , ito-yuichi@fujitsu.com, linux-perf-users@vger.kernel.org, Marc Zyngier , linuxppc-dev@lists.ozlabs.org, davem@davemloft.net Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri May 5, 2023 at 8:13 AM AEST, Douglas Anderson wrote: > These are tiny style changes: > - Add a blank line before a "return". > - Renames two globals to use the "watchdog_hld" prefix. Particularly static ones don't really need the namespace prefixes. Not sure if processed is better than warn. allcpu_dumped is better than dumped_stacks though because the all-CPUs-dump is a particular thing. Other style bits seem fine. Thanks, Nick > - Store processor id in "unsigned int" rather than "int". > - Minor comment rewording. > - Use "else" rather than extra returns since it seemed more symmetric. > > Signed-off-by: Douglas Anderson > --- > > Changes in v4: > - ("Style changes to watchdog_hardlockup_check ...") new for v4. > > kernel/watchdog.c | 32 +++++++++++++++----------------- > 1 file changed, 15 insertions(+), 17 deletions(-) > > diff --git a/kernel/watchdog.c b/kernel/watchdog.c > index 2d319cdf64b9..f46669c1671d 100644 > --- a/kernel/watchdog.c > +++ b/kernel/watchdog.c > @@ -89,8 +89,8 @@ __setup("nmi_watchdog=3D", hardlockup_panic_setup); > =20 > static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts); > static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); > -static DEFINE_PER_CPU(bool, hard_watchdog_warn); > -static unsigned long hardlockup_allcpu_dumped; > +static DEFINE_PER_CPU(bool, watchdog_hardlockup_processed); > +static unsigned long watchdog_hardlockup_dumped_stacks; > =20 > static bool watchdog_hardlockup_is_lockedup(void) > { > @@ -100,6 +100,7 @@ static bool watchdog_hardlockup_is_lockedup(void) > return true; > =20 > __this_cpu_write(hrtimer_interrupts_saved, hrint); > + > return false; > } > =20 > @@ -110,21 +111,20 @@ static void watchdog_hardlockup_interrupt_count(voi= d) > =20 > void watchdog_hardlockup_check(struct pt_regs *regs) > { > - /* check for a hardlockup > - * This is done by making sure our timer interrupt > - * is incrementing. The timer interrupt should have > - * fired multiple times before we overflow'd. If it hasn't > + /* > + * Check for a hardlockup by making sure the CPU's timer > + * interrupt is incrementing. The timer interrupt should have > + * fired multiple times before we overflow'd. If it hasn't > * then this is a good indication the cpu is stuck > */ > if (watchdog_hardlockup_is_lockedup()) { > - int this_cpu =3D smp_processor_id(); > + unsigned int this_cpu =3D smp_processor_id(); > =20 > - /* only print hardlockups once */ > - if (__this_cpu_read(hard_watchdog_warn) =3D=3D true) > + /* Only handle hardlockups once. */ > + if (__this_cpu_read(watchdog_hardlockup_processed)) > return; > =20 > - pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", > - this_cpu); > + pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", this_cpu); > print_modules(); > print_irqtrace_events(current); > if (regs) > @@ -137,18 +137,16 @@ void watchdog_hardlockup_check(struct pt_regs *regs= ) > * generating interleaving traces > */ > if (sysctl_hardlockup_all_cpu_backtrace && > - !test_and_set_bit(0, &hardlockup_allcpu_dumped)) > + !test_and_set_bit(0, &watchdog_hardlockup_dumped_stacks)) > trigger_allbutself_cpu_backtrace(); > =20 > if (hardlockup_panic) > nmi_panic(regs, "Hard LOCKUP"); > =20 > - __this_cpu_write(hard_watchdog_warn, true); > - return; > + __this_cpu_write(watchdog_hardlockup_processed, true); > + } else { > + __this_cpu_write(watchdog_hardlockup_processed, false); > } > - > - __this_cpu_write(hard_watchdog_warn, false); > - return; > } > =20 > #else /* CONFIG_HARDLOCKUP_DETECTOR_PERF */ > --=20 > 2.40.1.521.gf1e218fcd8-goog From mboxrd@z Thu Jan 1 00:00:00 1970 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 DB440C77B7C for ; Fri, 5 May 2023 03:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbjEEDCc (ORCPT ); Thu, 4 May 2023 23:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbjEEDCA (ORCPT ); Thu, 4 May 2023 23:02:00 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CABAB11B7C; Thu, 4 May 2023 20:01:57 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1aad5245571so8527655ad.1; Thu, 04 May 2023 20:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683255717; x=1685847717; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4PZDk7grPMVm0G4plF1AOyfal6UfKUjeqMY34ZW+ZAQ=; b=l8NOWx+JbMx094FOTHTTAYeieKLG6l+RoxKooetFCoRg01JgRpRgmVK4EEnqQGp5Rv Wo7jd5ZE+BhoTQ83yfVxkRWDV8+8fYgzKrUQG+mG2SKoUwQzV4PiqCThKZNktLEkx80D dbZRbHCpWflzRiQ+5dUIKlwArRroFaTk4Ds/n3538KW17NDJa0a+h/l5niHUznruDebe bM/9WMTgDrGpzcJNg2dEdXkiWqJTXpKVuu+xjnqek1SKKSYnqTk3zeH62sRwe7eJhyjM UEdL7abKjXNavxqB2b/VypuWuDH+efkVGB6cwaNtCumipgGM0sxe7eY6ZqTznd4UjVkh DJMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683255717; x=1685847717; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4PZDk7grPMVm0G4plF1AOyfal6UfKUjeqMY34ZW+ZAQ=; b=Ygs6vUg5fCcp0X2SbhMGiWqNTzfwa0n6dboX2JfdfMp/zt5fxU3YWS9vP2mm7YF5aD LwLnoBXIBEoXWQPPjstUgFMWfgtAJuOllqL4jpPF6I+zi34Z4sZ3YdVwBuR2UewIlHGj XI9ZyXWtF0kMrfHZktp9hg2XidPoxpm0OC2WYvDvyCWsIRUYvWsSwpRhHwWTLEYSyhmA skPId+uWE4Fc9QmJJonAZKw3M7ezWMyZtwIbW7jwU/hQqHdsOIWhkHJ17p/evnHykKSU 28RjKOSX/NUv/s0jTCLXap3tid1mQpBBqGGa4uxjnAUe4O7dxAOQ0Q7EyLSCtE/d9FDQ JQBA== X-Gm-Message-State: AC+VfDx/A6wbo2G3VCsOj+gKQcEpVB7B7yjuZG3pYYiXU52mZUlLjwt7 TPaUG5TU3ymzgbfx9YTJGno= X-Google-Smtp-Source: ACHHUZ5Ox+yCPXhRH+Zo/Bf0YWlPnoiHwxarQldt5h1nNQM5kPEVVWcuprv1MbKY8J2RKwbHQwgMKQ== X-Received: by 2002:a17:903:187:b0:1a2:8c7e:f301 with SMTP id z7-20020a170903018700b001a28c7ef301mr6214939plg.45.1683255717124; Thu, 04 May 2023 20:01:57 -0700 (PDT) Received: from localhost ([203.59.190.92]) by smtp.gmail.com with ESMTPSA id jj22-20020a170903049600b0019fea4d61c9sm354034plb.198.2023.05.04.20.01.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 May 2023 20:01:56 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 05 May 2023 13:01:41 +1000 Message-Id: Cc: "Sumit Garg" , "Mark Rutland" , "Matthias Kaehlcke" , "Stephane Eranian" , "Stephen Boyd" , , "Tzung-Bi Shih" , "Lecopzer Chen" , , "Masayoshi Mizuma" , "Guenter Roeck" , "Pingfan Liu" , "Andi Kleen" , "Ian Rogers" , , , , "Randy Dunlap" , "Chen-Yu Tsai" , , , , , "Will Deacon" , , , "Marc Zyngier" , "Catalin Marinas" , "Daniel Thompson" Subject: Re: [PATCH v4 08/17] watchdog/hardlockup: Style changes to watchdog_hardlockup_check() / ..._is_lockedup() From: "Nicholas Piggin" To: "Douglas Anderson" , "Petr Mladek" , "Andrew Morton" X-Mailer: aerc 0.14.0 References: <20230504221349.1535669-1-dianders@chromium.org> <20230504151100.v4.8.I818492c326b632560b09f20d2608455ecf9d3650@changeid> In-Reply-To: <20230504151100.v4.8.I818492c326b632560b09f20d2608455ecf9d3650@changeid> Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On Fri May 5, 2023 at 8:13 AM AEST, Douglas Anderson wrote: > These are tiny style changes: > - Add a blank line before a "return". > - Renames two globals to use the "watchdog_hld" prefix. Particularly static ones don't really need the namespace prefixes. Not sure if processed is better than warn. allcpu_dumped is better than dumped_stacks though because the all-CPUs-dump is a particular thing. Other style bits seem fine. Thanks, Nick > - Store processor id in "unsigned int" rather than "int". > - Minor comment rewording. > - Use "else" rather than extra returns since it seemed more symmetric. > > Signed-off-by: Douglas Anderson > --- > > Changes in v4: > - ("Style changes to watchdog_hardlockup_check ...") new for v4. > > kernel/watchdog.c | 32 +++++++++++++++----------------- > 1 file changed, 15 insertions(+), 17 deletions(-) > > diff --git a/kernel/watchdog.c b/kernel/watchdog.c > index 2d319cdf64b9..f46669c1671d 100644 > --- a/kernel/watchdog.c > +++ b/kernel/watchdog.c > @@ -89,8 +89,8 @@ __setup("nmi_watchdog=3D", hardlockup_panic_setup); > =20 > static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts); > static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); > -static DEFINE_PER_CPU(bool, hard_watchdog_warn); > -static unsigned long hardlockup_allcpu_dumped; > +static DEFINE_PER_CPU(bool, watchdog_hardlockup_processed); > +static unsigned long watchdog_hardlockup_dumped_stacks; > =20 > static bool watchdog_hardlockup_is_lockedup(void) > { > @@ -100,6 +100,7 @@ static bool watchdog_hardlockup_is_lockedup(void) > return true; > =20 > __this_cpu_write(hrtimer_interrupts_saved, hrint); > + > return false; > } > =20 > @@ -110,21 +111,20 @@ static void watchdog_hardlockup_interrupt_count(voi= d) > =20 > void watchdog_hardlockup_check(struct pt_regs *regs) > { > - /* check for a hardlockup > - * This is done by making sure our timer interrupt > - * is incrementing. The timer interrupt should have > - * fired multiple times before we overflow'd. If it hasn't > + /* > + * Check for a hardlockup by making sure the CPU's timer > + * interrupt is incrementing. The timer interrupt should have > + * fired multiple times before we overflow'd. If it hasn't > * then this is a good indication the cpu is stuck > */ > if (watchdog_hardlockup_is_lockedup()) { > - int this_cpu =3D smp_processor_id(); > + unsigned int this_cpu =3D smp_processor_id(); > =20 > - /* only print hardlockups once */ > - if (__this_cpu_read(hard_watchdog_warn) =3D=3D true) > + /* Only handle hardlockups once. */ > + if (__this_cpu_read(watchdog_hardlockup_processed)) > return; > =20 > - pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", > - this_cpu); > + pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", this_cpu); > print_modules(); > print_irqtrace_events(current); > if (regs) > @@ -137,18 +137,16 @@ void watchdog_hardlockup_check(struct pt_regs *regs= ) > * generating interleaving traces > */ > if (sysctl_hardlockup_all_cpu_backtrace && > - !test_and_set_bit(0, &hardlockup_allcpu_dumped)) > + !test_and_set_bit(0, &watchdog_hardlockup_dumped_stacks)) > trigger_allbutself_cpu_backtrace(); > =20 > if (hardlockup_panic) > nmi_panic(regs, "Hard LOCKUP"); > =20 > - __this_cpu_write(hard_watchdog_warn, true); > - return; > + __this_cpu_write(watchdog_hardlockup_processed, true); > + } else { > + __this_cpu_write(watchdog_hardlockup_processed, false); > } > - > - __this_cpu_write(hard_watchdog_warn, false); > - return; > } > =20 > #else /* CONFIG_HARDLOCKUP_DETECTOR_PERF */ > --=20 > 2.40.1.521.gf1e218fcd8-goog From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2B2ADC7EE23 for ; Fri, 5 May 2023 03:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:To:From:Subject: Cc:Message-Id:Date:Mime-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/Us2i0OvpqQ37pvV0zu8CX1yV0d0LNiKRZ6x/4NCdO0=; b=WIx7m8JqDDS3ef 6crNps2Lf3MuW+j/PLpcGV1I8BvqgLsUgwFfWJvUwJhBQ8Z0mKoPslwRNufOF0eDw5PdmLtTg3ngR SqDyJkW+xMrS1+RtKNL6Ervw3vEcLKjknaDE+itqeuDe+e7YokVGf9JYj+TZln7BIPihEruu8MaaB 0hAA51pehBp43FNDTZ0CRWHYkqcT7VERe59qwIkEV2t76UiooIOx6iUa5duYadCHnvD01AV1ogj0+ Vx6cYeUfnbe8RVc+QuBHrsfze6yC+4ZvXpgZ8acrWObwdB48JnDUTqJ0GvL8G1qkYglzZLdIsrl9c erph58SPvuDeNUom8Btg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pulht-009b7Y-0E; Fri, 05 May 2023 03:02:05 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pulho-009b6l-24 for linux-arm-kernel@lists.infradead.org; Fri, 05 May 2023 03:02:02 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1aad5245571so8527645ad.1 for ; Thu, 04 May 2023 20:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683255717; x=1685847717; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4PZDk7grPMVm0G4plF1AOyfal6UfKUjeqMY34ZW+ZAQ=; b=l8NOWx+JbMx094FOTHTTAYeieKLG6l+RoxKooetFCoRg01JgRpRgmVK4EEnqQGp5Rv Wo7jd5ZE+BhoTQ83yfVxkRWDV8+8fYgzKrUQG+mG2SKoUwQzV4PiqCThKZNktLEkx80D dbZRbHCpWflzRiQ+5dUIKlwArRroFaTk4Ds/n3538KW17NDJa0a+h/l5niHUznruDebe bM/9WMTgDrGpzcJNg2dEdXkiWqJTXpKVuu+xjnqek1SKKSYnqTk3zeH62sRwe7eJhyjM UEdL7abKjXNavxqB2b/VypuWuDH+efkVGB6cwaNtCumipgGM0sxe7eY6ZqTznd4UjVkh DJMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683255717; x=1685847717; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4PZDk7grPMVm0G4plF1AOyfal6UfKUjeqMY34ZW+ZAQ=; b=iBszk9cyD7ydVK1EeRXIwCUSol6AT9Zo9SFaMXGsLRQw494VNWJfnc3hEvwHushrI3 bpxLMEzFvW406+MHF40eBrPqvkl2Nu3moDyenSPDjLGywbsMAqZmhtZz/0kQgVVvazkU 6DhkGE7UR+RNxImuK32oCpL5fCSjjS7IDDRUmNgZ2WLGMJufwH76DzOn9C+C6wAj++z4 wTbMwJm5bh+3UN4sTpFDg9izOxLYUIrwfamLqx1R3etloZega1JYH1WJd+DZ7GpJs7Vf qoVARDYGJsngGn+cjhmrsoqvS/gEOMKMmRjpywezz6U0f/3dUr79N/MjRrSbeJUwwx3r ge3g== X-Gm-Message-State: AC+VfDwvqKeTpgiXxdW2Ar3S5IVW921KqOa1VI84bs374GAF9kYb9S7G 3WdCZD4uKLD1GUd5/Rft55c= X-Google-Smtp-Source: ACHHUZ5Ox+yCPXhRH+Zo/Bf0YWlPnoiHwxarQldt5h1nNQM5kPEVVWcuprv1MbKY8J2RKwbHQwgMKQ== X-Received: by 2002:a17:903:187:b0:1a2:8c7e:f301 with SMTP id z7-20020a170903018700b001a28c7ef301mr6214939plg.45.1683255717124; Thu, 04 May 2023 20:01:57 -0700 (PDT) Received: from localhost ([203.59.190.92]) by smtp.gmail.com with ESMTPSA id jj22-20020a170903049600b0019fea4d61c9sm354034plb.198.2023.05.04.20.01.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 May 2023 20:01:56 -0700 (PDT) Mime-Version: 1.0 Date: Fri, 05 May 2023 13:01:41 +1000 Message-Id: Cc: "Sumit Garg" , "Mark Rutland" , "Matthias Kaehlcke" , "Stephane Eranian" , "Stephen Boyd" , , "Tzung-Bi Shih" , "Lecopzer Chen" , , "Masayoshi Mizuma" , "Guenter Roeck" , "Pingfan Liu" , "Andi Kleen" , "Ian Rogers" , , , , "Randy Dunlap" , "Chen-Yu Tsai" , , , , , "Will Deacon" , , , "Marc Zyngier" , "Catalin Marinas" , "Daniel Thompson" Subject: Re: [PATCH v4 08/17] watchdog/hardlockup: Style changes to watchdog_hardlockup_check() / ..._is_lockedup() From: "Nicholas Piggin" To: "Douglas Anderson" , "Petr Mladek" , "Andrew Morton" X-Mailer: aerc 0.14.0 References: <20230504221349.1535669-1-dianders@chromium.org> <20230504151100.v4.8.I818492c326b632560b09f20d2608455ecf9d3650@changeid> In-Reply-To: <20230504151100.v4.8.I818492c326b632560b09f20d2608455ecf9d3650@changeid> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230504_200200_680384_C18CA71B X-CRM114-Status: GOOD ( 26.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri May 5, 2023 at 8:13 AM AEST, Douglas Anderson wrote: > These are tiny style changes: > - Add a blank line before a "return". > - Renames two globals to use the "watchdog_hld" prefix. Particularly static ones don't really need the namespace prefixes. Not sure if processed is better than warn. allcpu_dumped is better than dumped_stacks though because the all-CPUs-dump is a particular thing. Other style bits seem fine. Thanks, Nick > - Store processor id in "unsigned int" rather than "int". > - Minor comment rewording. > - Use "else" rather than extra returns since it seemed more symmetric. > > Signed-off-by: Douglas Anderson > --- > > Changes in v4: > - ("Style changes to watchdog_hardlockup_check ...") new for v4. > > kernel/watchdog.c | 32 +++++++++++++++----------------- > 1 file changed, 15 insertions(+), 17 deletions(-) > > diff --git a/kernel/watchdog.c b/kernel/watchdog.c > index 2d319cdf64b9..f46669c1671d 100644 > --- a/kernel/watchdog.c > +++ b/kernel/watchdog.c > @@ -89,8 +89,8 @@ __setup("nmi_watchdog=", hardlockup_panic_setup); > > static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts); > static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); > -static DEFINE_PER_CPU(bool, hard_watchdog_warn); > -static unsigned long hardlockup_allcpu_dumped; > +static DEFINE_PER_CPU(bool, watchdog_hardlockup_processed); > +static unsigned long watchdog_hardlockup_dumped_stacks; > > static bool watchdog_hardlockup_is_lockedup(void) > { > @@ -100,6 +100,7 @@ static bool watchdog_hardlockup_is_lockedup(void) > return true; > > __this_cpu_write(hrtimer_interrupts_saved, hrint); > + > return false; > } > > @@ -110,21 +111,20 @@ static void watchdog_hardlockup_interrupt_count(void) > > void watchdog_hardlockup_check(struct pt_regs *regs) > { > - /* check for a hardlockup > - * This is done by making sure our timer interrupt > - * is incrementing. The timer interrupt should have > - * fired multiple times before we overflow'd. If it hasn't > + /* > + * Check for a hardlockup by making sure the CPU's timer > + * interrupt is incrementing. The timer interrupt should have > + * fired multiple times before we overflow'd. If it hasn't > * then this is a good indication the cpu is stuck > */ > if (watchdog_hardlockup_is_lockedup()) { > - int this_cpu = smp_processor_id(); > + unsigned int this_cpu = smp_processor_id(); > > - /* only print hardlockups once */ > - if (__this_cpu_read(hard_watchdog_warn) == true) > + /* Only handle hardlockups once. */ > + if (__this_cpu_read(watchdog_hardlockup_processed)) > return; > > - pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", > - this_cpu); > + pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", this_cpu); > print_modules(); > print_irqtrace_events(current); > if (regs) > @@ -137,18 +137,16 @@ void watchdog_hardlockup_check(struct pt_regs *regs) > * generating interleaving traces > */ > if (sysctl_hardlockup_all_cpu_backtrace && > - !test_and_set_bit(0, &hardlockup_allcpu_dumped)) > + !test_and_set_bit(0, &watchdog_hardlockup_dumped_stacks)) > trigger_allbutself_cpu_backtrace(); > > if (hardlockup_panic) > nmi_panic(regs, "Hard LOCKUP"); > > - __this_cpu_write(hard_watchdog_warn, true); > - return; > + __this_cpu_write(watchdog_hardlockup_processed, true); > + } else { > + __this_cpu_write(watchdog_hardlockup_processed, false); > } > - > - __this_cpu_write(hard_watchdog_warn, false); > - return; > } > > #else /* CONFIG_HARDLOCKUP_DETECTOR_PERF */ > -- > 2.40.1.521.gf1e218fcd8-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel