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