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 7D2E4C77B73 for ; Thu, 4 May 2023 22:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbjEDWPM (ORCPT ); Thu, 4 May 2023 18:15:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjEDWPK (ORCPT ); Thu, 4 May 2023 18:15:10 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C5212082 for ; Thu, 4 May 2023 15:15:09 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6439b410679so344088b3a.0 for ; Thu, 04 May 2023 15:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1683238509; x=1685830509; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OARDe2WGhGJ9YL28VnMtRA2erbfr4XRakwTJsFcap5I=; b=GLyo2ZwV6SkVu4yg4BDy7JLcH5ZAP2+/Qea63V/wdOAwvbUwjlMysbyaZ2Vj0B5Ivh 0GPXL/8FkhlOU43tb+ABkKZjcnWdf+kvyUm0Z0zfqPTn+HG53phy8ghQfqsDqk1tvDdK aPeNvzoOAj5cm8jOtnggXAtEE/QJY2OQ3iXcE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683238509; x=1685830509; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OARDe2WGhGJ9YL28VnMtRA2erbfr4XRakwTJsFcap5I=; b=iseoT+oh9faT1yPe+UouUvHUye9YjQ8/nWkPQwHUHYvY85m3knSmCyKPyyfCCbynGu uJ+Tt3WioYH4rYT20vLZA3aF/y1MVmbTZYqBmdt1w0n/yRB7TCANZ4qw/dKRXHZxcLUy tsL2A9dcgwkrcF9JrEZFCo6SVr/UYOZIvKhXomraOmUMIXQaWS/WCp09/HPDo8FX4xW8 dPVgXmchRWQx920Sni+T+8CCgP3gnpGnxoDTAfBiPKLRSMk0kry/x8n2MUayfXhCxbfD ICNJKtuyoKjdh+JLMOz+bUiLiirGB7cau4li2y7QFhjk1t5dtWoY2ZffVyHzgBX/KOn3 uDyg== X-Gm-Message-State: AC+VfDxBQOwBdWiPVDrV6Nw3Cz2fbOaSv7YuEre81pnkw/ffOQVAqc/i dCWuuMDUy6e+/BgUBP8bUO1C1Q== X-Google-Smtp-Source: ACHHUZ6K/GWZgHBRK8tXvn/IygmeZOoqhhON0G5s9GMpGhU7noise7S5Zr5rOpk3+MOxdT0Gz+Ye2Q== X-Received: by 2002:aa7:8885:0:b0:643:74a1:6dbd with SMTP id z5-20020aa78885000000b0064374a16dbdmr4174511pfe.30.1683238508951; Thu, 04 May 2023 15:15:08 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:edf0:7321:6b9e:d5e7]) by smtp.gmail.com with ESMTPSA id g26-20020aa7819a000000b006437c0edf9csm169615pfi.16.2023.05.04.15.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 15:15:07 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: Sumit Garg , Mark Rutland , Matthias Kaehlcke , Stephane Eranian , Stephen Boyd , ricardo.neri@intel.com, Tzung-Bi Shih , Lecopzer Chen , kgdb-bugreport@lists.sourceforge.net, Masayoshi Mizuma , Guenter Roeck , Pingfan Liu , Andi Kleen , Ian Rogers , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, ito-yuichi@fujitsu.com, Randy Dunlap , Chen-Yu Tsai , christophe.leroy@csgroup.eu, davem@davemloft.net, sparclinux@vger.kernel.org, mpe@ellerman.id.au, Will Deacon , ravi.v.shankar@intel.com, npiggin@gmail.com, linuxppc-dev@lists.ozlabs.org, Marc Zyngier , Catalin Marinas , Daniel Thompson , Douglas Anderson Subject: [PATCH v4 08/17] watchdog/hardlockup: Style changes to watchdog_hardlockup_check() / ..._is_lockedup() Date: Thu, 4 May 2023 15:13:40 -0700 Message-ID: <20230504151100.v4.8.I818492c326b632560b09f20d2608455ecf9d3650@changeid> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230504221349.1535669-1-dianders@chromium.org> References: <20230504221349.1535669-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org These are tiny style changes: - Add a blank line before a "return". - Renames two globals to use the "watchdog_hld" prefix. - 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 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 D032BC77B7C for ; Thu, 4 May 2023 22:22:51 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QC7cB3W85z3bck for ; Fri, 5 May 2023 08:22:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=GLyo2ZwV; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=chromium.org (client-ip=2607:f8b0:4864:20::435; helo=mail-pf1-x435.google.com; envelope-from=dianders@chromium.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=GLyo2ZwV; dkim-atps=neutral Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (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 4QC7RN58Wfz3c5D for ; Fri, 5 May 2023 08:15:12 +1000 (AEST) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6438d95f447so762743b3a.3 for ; Thu, 04 May 2023 15:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1683238509; x=1685830509; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OARDe2WGhGJ9YL28VnMtRA2erbfr4XRakwTJsFcap5I=; b=GLyo2ZwV6SkVu4yg4BDy7JLcH5ZAP2+/Qea63V/wdOAwvbUwjlMysbyaZ2Vj0B5Ivh 0GPXL/8FkhlOU43tb+ABkKZjcnWdf+kvyUm0Z0zfqPTn+HG53phy8ghQfqsDqk1tvDdK aPeNvzoOAj5cm8jOtnggXAtEE/QJY2OQ3iXcE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683238509; x=1685830509; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OARDe2WGhGJ9YL28VnMtRA2erbfr4XRakwTJsFcap5I=; b=b3rgFL8JlNRvfc3ClPZk8ajdq+W8SbY4OJYz1RB658qsZ79+K3cFc+4kEcI7fcIYeX AVPxexjAr8jwV4QKuCHz9xRI0WRl1wa4wfKwDqQUvv4YNZjSDGKQij5P8sQ5pKf87k7j BXt8wPlcUIrd34v3L7IScOum75RqFtx/RGLtRWzFF3XRLKCGFt64Qd7q6c68zpCtuwrG 29vtngLcn6lPZaPtUwddZoFUyE4OsiIY9du+ozpPCy/3xjiBJ+uxhKBfdYE5m84hXk5i uIOo/AgQi28lLxdApotPCl+OsvoJmFlcyS9UQdKYesJcJ6FKHtW/NH1SdSUvjgXDpNFb Q57w== X-Gm-Message-State: AC+VfDy/g0yBwvfPc8ReqVUNXf8wssKpQHMnVXByS7AdAm0Ij2DaVVqX b+/0+pMdF8tRd/cRPEZtXeik/w== X-Google-Smtp-Source: ACHHUZ6K/GWZgHBRK8tXvn/IygmeZOoqhhON0G5s9GMpGhU7noise7S5Zr5rOpk3+MOxdT0Gz+Ye2Q== X-Received: by 2002:aa7:8885:0:b0:643:74a1:6dbd with SMTP id z5-20020aa78885000000b0064374a16dbdmr4174511pfe.30.1683238508951; Thu, 04 May 2023 15:15:08 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:edf0:7321:6b9e:d5e7]) by smtp.gmail.com with ESMTPSA id g26-20020aa7819a000000b006437c0edf9csm169615pfi.16.2023.05.04.15.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 15:15:07 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Subject: [PATCH v4 08/17] watchdog/hardlockup: Style changes to watchdog_hardlockup_check() / ..._is_lockedup() Date: Thu, 4 May 2023 15:13:40 -0700 Message-ID: <20230504151100.v4.8.I818492c326b632560b09f20d2608455ecf9d3650@changeid> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230504221349.1535669-1-dianders@chromium.org> References: <20230504221349.1535669-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 , npiggin@gmail.com, Stephen Boyd , Pingfan Liu , linux-arm-kernel@lists.infradead.org, Sumit Garg , ito-yuichi@fujitsu.com, Douglas Anderson , 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" These are tiny style changes: - Add a blank line before a "return". - Renames two globals to use the "watchdog_hld" prefix. - 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 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 927B3C77B7C for ; Thu, 4 May 2023 22:41:14 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xlu8F6lMQ/KuMpG85J+yoWtkN5z3sStBqm1XFryq8H8=; b=pgSxglQcyjRJfW Cs9lllPORSO1HrlLDxS5yU5Tn8Jyt6LEs9UABHKZ3O0kUt4vSAINKLipDMWXktORrEr2AgJbRsJGM GqPcZ1pMf9RmW3a/Age5pAhYdYSObL31Qh1vc6ObA25IlZ4Xqdq79oY+mfZ3G1YOPPr+wq6NrjEgd e7KZTZ7haaQ0bElqbBVp1MbMKuOoQTzu8SvQPze5NLQLV4+B2tVYw0tKYcxYCWaJYGFYpof6zBzkW 13yz5XSxZh2vC4kLFcNh3jx9JXEW/cxA5RpjgR2RLypYhmjsvHpra028il+tkrfVrgM8Lo4HROJG4 vOhzWjDWhY9gvznYn2Eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1puhcm-009ENe-16; Thu, 04 May 2023 22:40:32 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1puhck-009EMG-3D for linux-arm-kernel@bombadil.infradead.org; Thu, 04 May 2023 22:40:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=OARDe2WGhGJ9YL28VnMtRA2erbfr4XRakwTJsFcap5I=; b=jJ/E4uMjXpLhtPrKrV0d6sBYNq 8FgRXiZh1V0ymaRRTmbZr1XyTJggLsE7ZDgrb/zUvXkJlZu4R0ddy+FCGfyUFytFIapSRvUMugnAf jBPeSa02FIM14+6rtf73GjGgJ/Z25VB7j4/tz9JXp01bDaD+uBnPTB8do3RUIxD9ddQ6bhE3gB+CE 2NCVjEdCfUMIvVOz2tmrJr5IfAWeZ/eSlsebumbyKCLPcYqOasweByAjbmzAxrKM/82BunKYGwbal mWIKRJ48YWVRastCuhwcpyYgjReklgAUa0Pvfk0H5kwq5bxfRHGYoX783uJFh0NXOyI99JXhnps8B 6EJYAETA==; Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1puhEF-001srT-0l for linux-arm-kernel@lists.infradead.org; Thu, 04 May 2023 22:15:14 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6438d95f447so762742b3a.3 for ; Thu, 04 May 2023 15:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1683238509; x=1685830509; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OARDe2WGhGJ9YL28VnMtRA2erbfr4XRakwTJsFcap5I=; b=GLyo2ZwV6SkVu4yg4BDy7JLcH5ZAP2+/Qea63V/wdOAwvbUwjlMysbyaZ2Vj0B5Ivh 0GPXL/8FkhlOU43tb+ABkKZjcnWdf+kvyUm0Z0zfqPTn+HG53phy8ghQfqsDqk1tvDdK aPeNvzoOAj5cm8jOtnggXAtEE/QJY2OQ3iXcE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683238509; x=1685830509; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OARDe2WGhGJ9YL28VnMtRA2erbfr4XRakwTJsFcap5I=; b=fOWlZpmK7nnaWWnGQ2Evqo2ebhFO0ah2h12c6XHF4Wji4OSu3BAluV864k7ddNrl2p WdcjC57YGGAgAC80oa6EZyDmdBeumxBiZ1IpCh/cDoK2kPSUrE4B1I1H+/yyUgVkTn54 zdSnpcuOXNQBAt8grQ/WsyVMJJnZbevpVwDpVOElCxfB8o3ySBNloXlt4KP4SQPzWZmr MBNpcVYGuR1a0w/keYcjEIPhthlWpD1rG/Z/hb59OM4in7GPtFaZkNhE/lRti30QrL4Q P+WuqqjXK0YHf36IVxIsJwWcBUwXJ3iSrmY7wJTyNXTL+rFdK0p6kDy/ZnMueQBcFK3J 8FUg== X-Gm-Message-State: AC+VfDxNRI7Z80ZCt6+I+BIXoD0ozUAUPJeihgIzMQcfpkW2FR2AnZG4 OsiHvz3+QFmyznvsMrsUsEm5EQ== X-Google-Smtp-Source: ACHHUZ6K/GWZgHBRK8tXvn/IygmeZOoqhhON0G5s9GMpGhU7noise7S5Zr5rOpk3+MOxdT0Gz+Ye2Q== X-Received: by 2002:aa7:8885:0:b0:643:74a1:6dbd with SMTP id z5-20020aa78885000000b0064374a16dbdmr4174511pfe.30.1683238508951; Thu, 04 May 2023 15:15:08 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:edf0:7321:6b9e:d5e7]) by smtp.gmail.com with ESMTPSA id g26-20020aa7819a000000b006437c0edf9csm169615pfi.16.2023.05.04.15.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 15:15:07 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: Sumit Garg , Mark Rutland , Matthias Kaehlcke , Stephane Eranian , Stephen Boyd , ricardo.neri@intel.com, Tzung-Bi Shih , Lecopzer Chen , kgdb-bugreport@lists.sourceforge.net, Masayoshi Mizuma , Guenter Roeck , Pingfan Liu , Andi Kleen , Ian Rogers , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, ito-yuichi@fujitsu.com, Randy Dunlap , Chen-Yu Tsai , christophe.leroy@csgroup.eu, davem@davemloft.net, sparclinux@vger.kernel.org, mpe@ellerman.id.au, Will Deacon , ravi.v.shankar@intel.com, npiggin@gmail.com, linuxppc-dev@lists.ozlabs.org, Marc Zyngier , Catalin Marinas , Daniel Thompson , Douglas Anderson Subject: [PATCH v4 08/17] watchdog/hardlockup: Style changes to watchdog_hardlockup_check() / ..._is_lockedup() Date: Thu, 4 May 2023 15:13:40 -0700 Message-ID: <20230504151100.v4.8.I818492c326b632560b09f20d2608455ecf9d3650@changeid> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog In-Reply-To: <20230504221349.1535669-1-dianders@chromium.org> References: <20230504221349.1535669-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230504_231511_844059_BA16E71F X-CRM114-Status: GOOD ( 18.79 ) 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 These are tiny style changes: - Add a blank line before a "return". - Renames two globals to use the "watchdog_hld" prefix. - 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