From patchwork Fri May 19 17:18:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13248680 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 367C9C7EE26 for ; Fri, 19 May 2023 17:40:42 +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=YZmK6n3ll+r/An17EE+RUYEL50MEx8KavIbGzrmujTo=; b=ubyjt1y5T4oqL4 c33atN/oOxuWOGT72bfsCLJzKCevy+lG4op0++Yk3pRdzbBMywt3hJrTM3iEMSLX4yCCye+GGuprk tseEXtx47s0FY+5j4LjDtbQTb3EIwR78BHTFjRqiCZQMH6D+uyT8VyedVCTlfL1bIfX68cjb4SrYA 8Ys+pIjlMTpQwUv1ScNIYea4qWRI+sq4ANnJCWWuKRuQscM3LA3x+soMC4JzrgguhhobEebQ5mjG4 ieqBR0f/rYipRh1fcdKBXVTGGWgY8VjWta92mpRFWgL92GeMGvrmGX4PUJN08FwUdwM64AzlkxvKZ QOCiHHY0xc61CVJ9DCew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q045O-00GsjC-0e; Fri, 19 May 2023 17:40:14 +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 1q045M-00Gsih-2F for linux-arm-kernel@bombadil.infradead.org; Fri, 19 May 2023 17:40:12 +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=BBw4uifuzwjtC1EJSKRNgzKWGRkSP/trxFy/VEab+1U=; b=OcWrpbDUf1ENVEvU01Kfv6MFwg xqc8JoRT3XK/pikdbIcaIwe7IQoYuTgOu4riMtB9OubKSDXqyQ7fI9SpfzwNCqTHFy4xoKHdidJmf TF2+EKH0AQOEsl7HTFEyaTrp05dqV5Zva+uRftTtFHGf+palSm+ZIl/X2sg/YLZZWK3cKmfTd9JRF JpxWZJIbbXw7F1CLImGsbZIQF6XLpG+YOy4n/9IcH0UNUL8Qce4leyEwAa5sB+Xm+I4paewwMhJ/B qylQ+EWPyx+Pl3D6amGrAv41Iftz6lo22g/2sFTEe5L8iE1BXmwkC1+7HU7Sh8Ssn9GLY5oQqKiHh HN765HSw==; Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q03ms-00FxsK-1G for linux-arm-kernel@lists.infradead.org; Fri, 19 May 2023 17:21:08 +0000 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-24e16918323so2552072a91.2 for ; Fri, 19 May 2023 10:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684516864; x=1687108864; 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=BBw4uifuzwjtC1EJSKRNgzKWGRkSP/trxFy/VEab+1U=; b=C0Isk5LoVOO5xBj08Ka29F5mSazn4+608Fj8hSVomCBNII30To6zGAh3uqBhclp5Po RoR0m/F8OkPL1Fg6XrRCGAvftgsjt8zKTnlHd3XnlQKPdWI9/upIWnc354omRRekG/Vd 4TzsQ4hKHmtS5GROcyT9kz7nfPJTE6eYw3FL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684516864; x=1687108864; 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=BBw4uifuzwjtC1EJSKRNgzKWGRkSP/trxFy/VEab+1U=; b=c1oRcUCrthdnZbAgGAD4xh3BYPMNZZh8s9J9gv+4PkgkEX3wXyBwl+Vm7JrRlym4rl apH58ZuqDOSEK04HJZphyBaY20wiq9xBKLLPwxyFzIJAyappnu7ZnsAtblyQDqq2ajmy T44s45xNq8VMuVCqs0xGhCFbxbojir8qwWo683LpgYRsni1qDQrGx/VlBcJswcSOyJsI +EvAvKBTGznpIMekx3JKIV/NmLhoCRLhglKR/FZX3gym7VcoLd9GcVBTBLRdBCXm4gRw dSbL+pdO9K/Mxq2r3jSCUXAivPgSn5kpa+hwpCgh2Rba8xzST9U0z0sZ5NAeQIEohrWT g+Mw== X-Gm-Message-State: AC+VfDwHp0XxYDPKo7HgXyfNbuqvLytwPIejBMrtsg2ufJ3HuEzQThRB DX+hqDSe1/GgG4NXSq5BRb7eYA== X-Google-Smtp-Source: ACHHUZ4TDRDg+n16F9FgO6fjA4fEHipyKz1sAvTzlrch+J4I3oFlt6TdHTXq6tF/PHzC+ANYmNfBhw== X-Received: by 2002:a17:90a:f3c7:b0:249:748b:a232 with SMTP id ha7-20020a17090af3c700b00249748ba232mr2835727pjb.25.1684516864714; Fri, 19 May 2023 10:21:04 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:9b89:2dd0:d160:429d]) by smtp.gmail.com with ESMTPSA id gj19-20020a17090b109300b0024e4f169931sm1763835pjb.2.2023.05.19.10.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 10:21:04 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: Matthias Kaehlcke , kgdb-bugreport@lists.sourceforge.net, Stephane Eranian , mpe@ellerman.id.au, Tzung-Bi Shih , Daniel Thompson , Mark Rutland , linuxppc-dev@lists.ozlabs.org, Sumit Garg , npiggin@gmail.com, davem@davemloft.net, Marc Zyngier , Stephen Boyd , sparclinux@vger.kernel.org, christophe.leroy@csgroup.eu, Catalin Marinas , ravi.v.shankar@intel.com, Randy Dunlap , Pingfan Liu , Guenter Roeck , Lecopzer Chen , Ian Rogers , ito-yuichi@fujitsu.com, ricardo.neri@intel.com, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, Will Deacon , Chen-Yu Tsai , linux-kernel@vger.kernel.org, Masayoshi Mizuma , Andi Kleen , Douglas Anderson Subject: [PATCH v5 09/18] watchdog/hardlockup: Style changes to watchdog_hardlockup_check() / is_hardlockup() Date: Fri, 19 May 2023 10:18:33 -0700 Message-ID: <20230519101840.v5.9.I818492c326b632560b09f20d2608455ecf9d3650@changeid> X-Mailer: git-send-email 2.40.1.698.g37aff9b760-goog In-Reply-To: <20230519101840.v5.18.Ia44852044cdcb074f387e80df6b45e892965d4a1@changeid> References: <20230519101840.v5.18.Ia44852044cdcb074f387e80df6b45e892965d4a1@changeid> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230519_182106_861303_A0F1F0C4 X-CRM114-Status: GOOD ( 18.64 ) 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: , 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_hardlockup" prefix. - Store processor id in "unsigned int" rather than "int". - Minor comment rewording. - Use "else" rather than extra returns since it seemed more symmetric. Reviewed-by: Petr Mladek Signed-off-by: Douglas Anderson --- Changes in v5: - watchdog_hardlockup_dumped_stacks => watchdog_hardlockup_all_cpu_dumped - watchdog_hardlockup_processed => watchdog_hardlockup_warned 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 12ce37d76e7d..169e5dffbc00 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_warned); +static unsigned long watchdog_hardlockup_all_cpu_dumped; static bool is_hardlockup(void) { @@ -100,6 +100,7 @@ static bool is_hardlockup(void) return true; __this_cpu_write(hrtimer_interrupts_saved, hrint); + return false; } @@ -110,21 +111,20 @@ static void watchdog_hardlockup_kick(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 (is_hardlockup()) { - 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 print hardlockups once. */ + if (__this_cpu_read(watchdog_hardlockup_warned)) 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_all_cpu_dumped)) 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_warned, true); + } else { + __this_cpu_write(watchdog_hardlockup_warned, false); } - - __this_cpu_write(hard_watchdog_warn, false); - return; } #else /* CONFIG_HARDLOCKUP_DETECTOR_PERF */