From patchwork Sat May 27 01:41:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 99738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp70705vqr; Fri, 26 May 2023 18:43:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ffGDOSDsp5kEbpanvu1GICLtA7+V+OBHwfL1D1c1dS8Y8sCwInfDLbVLHifEAAngd4env X-Received: by 2002:a17:902:ba83:b0:1a9:6a10:70e9 with SMTP id k3-20020a170902ba8300b001a96a1070e9mr739654pls.33.1685151828094; Fri, 26 May 2023 18:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685151828; cv=none; d=google.com; s=arc-20160816; b=JwL62WO5Z0HCV7Bo0mw69I1bKQ0JQZJ3lpq7gYQwPOJ6JbLMzXBspt6psVU0a8DkIu OsYLWfwJi7LFmgUGb3V1G4ZS49G5sjlc4RhOAderj5NgRV3Ux4+jDTBF1JaFrHOn/XNr lzE4fRCWnRlB82eWl0WvM/hIJgxPsgSVotMAw4lgUtyKF2cmHCg1GeLPjVN6BUGrl8IZ heGrHS8wc9QX+GDRjykovb9rpbGNY12d5Fr4EswynK0hBKUbNPIg067ddka9PFyr+ht0 Q4omgJ/23xmaGbTg8GPvq49yfntmM2SBfdBiH2s1FWZX/lpEl7v03DbDX1Ofcx8dX7ag 9D+w== 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:date:subject:cc:to:from :dkim-signature; bh=FXckUaQ/Den31trhbx+i2KR50Js/yPFH+sDpvHnJKzE=; b=DlgPDQ6LjQVkUWBoVBsZjgcj5LOlZS1fs1p/EtxMG1MuGS11Sh5U9FarVT6WdaKvlf phu5metwdIIgqnmRS2QjqJ76uN3aGzgvgQW6CpKftKavbwDXsPRqvl8BGC1VhYfOodYq xpZhVcSIhrjPdK/jsTLrDvt9vyotksglOnvoqrp/3y62m3z1JLIwevLhG/paGTYdHQkM CSJgcNiBlUO8s6tchPl6ihnMgwgC0VP0UgbOj+LHuUumhLb519qlnAOOrq3FzDB2xnlL JTunTKFiUvLS3U3EEk4pUV49JF/VwNx8NLdhRlmMRFqlpOKTv8n6IpmAFy/qfI5VRffe Ek6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=k5hflWz1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a170902848a00b001aadd02b88fsi5123253plo.233.2023.05.26.18.43.33; Fri, 26 May 2023 18:43:48 -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=@chromium.org header.s=google header.b=k5hflWz1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243227AbjE0Bme (ORCPT + 99 others); Fri, 26 May 2023 21:42:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242942AbjE0Bmb (ORCPT ); Fri, 26 May 2023 21:42:31 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5286E4E for ; Fri, 26 May 2023 18:42:18 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-64d44b198baso1094592b3a.0 for ; Fri, 26 May 2023 18:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151738; x=1687743738; 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=FXckUaQ/Den31trhbx+i2KR50Js/yPFH+sDpvHnJKzE=; b=k5hflWz1ojXxjFKRiwHgsk5p/ZbmXIIfYfK4EdK0UtXLo2Tbb74nHxOJ8I17Sf9sxy 7MD+TcUADQQ+iohHT+1kqBlvhx1hOCsgxOD4ajd121XAcoVe7I9JgK6CPn4SYzCJm/ol YM9N2ByDO4u3BG+dWzNDW3yTIS6cbMGQWCxnY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151738; x=1687743738; 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=FXckUaQ/Den31trhbx+i2KR50Js/yPFH+sDpvHnJKzE=; b=X2XBg+g57djfujAjFl+8yD2tU/UuUaNmMI8P+JVG/1lXZnu4FPiUMNw5THsC2QKqKK yXzmbSezs6RjZeS9SAOyYQ9fws+bLeE1lWR3tVVmGlSsvezDcU8BrRn2TDzGSQf4J/Lh pvx4N9g3S1edkHqHCxBwFJ9eWwy5FTFL7twK1vamXx95noS6sjNajfhSpnY22/9ZLfe8 zX8qpKmJR8WhlHibJwQnfdfhocSsDEzAKbF3Yroi76dGSJcUlXkrybXNUYgL+Lo6AeTh jF6h/5/UAid6NbT082orvPGXaCOR4+zumIU7+AA7QHgjoLOlfgtLmCgVR5OqkeBlVlWn ONAg== X-Gm-Message-State: AC+VfDx3tWL8ccCr5p9Q348ep+2O4h3AjMPA4V40TluOoFaro1DZTFvc 4Gjf2wmYPYaPRhVxt7pP3hk5YA== X-Received: by 2002:a05:6a00:1586:b0:648:a518:4ac6 with SMTP id u6-20020a056a00158600b00648a5184ac6mr1023104pfk.14.1685151738030; Fri, 26 May 2023 18:42:18 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:17 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 01/10] watchdog/hardlockup: Keep kernel.nmi_watchdog sysctl as 0444 if probe fails Date: Fri, 26 May 2023 18:41:31 -0700 Message-ID: <20230526184139.1.I0d75971cc52a7283f495aac0bd5c3041aadc734e@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767009763447966166?= X-GMAIL-MSGID: =?utf-8?q?1767009763447966166?= The permissions for the kernel.nmi_watchdog sysctl have always been set at compile time despite the fact that a watchdog can fail to probe. Let's fix this and set the permissions based on whether the hardlockup detector actually probed. Fixes: a994a3147e4c ("watchdog/hardlockup/perf: Implement init time detection of perf") Reported-by: Petr Mladek Closes: https://lore.kernel.org/r/ZHCn4hNxFpY5-9Ki@alley Signed-off-by: Douglas Anderson Reviewed-by: Petr Mladek --- include/linux/nmi.h | 6 ------ kernel/watchdog.c | 30 ++++++++++++++++++++---------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 333465e235e1..3a27169ec383 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -95,12 +95,6 @@ void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs); static inline void arch_touch_nmi_watchdog(void) { } #endif -#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) -# define NMI_WATCHDOG_SYSCTL_PERM 0644 -#else -# define NMI_WATCHDOG_SYSCTL_PERM 0444 -#endif - #if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF) extern void hardlockup_detector_perf_stop(void); extern void hardlockup_detector_perf_restart(void); diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 237990e8d345..4b9e31edb47f 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -880,15 +880,6 @@ static struct ctl_table watchdog_sysctls[] = { .extra1 = SYSCTL_ZERO, .extra2 = (void *)&sixty, }, - { - .procname = "nmi_watchdog", - .data = &watchdog_hardlockup_user_enabled, - .maxlen = sizeof(int), - .mode = NMI_WATCHDOG_SYSCTL_PERM, - .proc_handler = proc_nmi_watchdog, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_ONE, - }, { .procname = "watchdog_cpumask", .data = &watchdog_cpumask_bits, @@ -952,10 +943,28 @@ static struct ctl_table watchdog_sysctls[] = { {} }; +static struct ctl_table watchdog_hardlockup_sysctl[] = { + { + .procname = "nmi_watchdog", + .data = &watchdog_hardlockup_user_enabled, + .maxlen = sizeof(int), + .mode = 0444, + .proc_handler = proc_nmi_watchdog, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + }, + {} +}; + static void __init watchdog_sysctl_init(void) { register_sysctl_init("kernel", watchdog_sysctls); + + if (watchdog_hardlockup_available) + watchdog_hardlockup_sysctl[0].mode = 0644; + register_sysctl_init("kernel", watchdog_hardlockup_sysctl); } + #else #define watchdog_sysctl_init() do { } while (0) #endif /* CONFIG_SYSCTL */ @@ -1011,6 +1020,8 @@ static int __init lockup_detector_check(void) /* Make sure no work is pending. */ flush_work(&detector_work); + watchdog_sysctl_init(); + return 0; } @@ -1030,5 +1041,4 @@ void __init lockup_detector_init(void) allow_lockup_detector_init_retry = true; lockup_detector_setup(); - watchdog_sysctl_init(); } From patchwork Sat May 27 01:41:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 99739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp70712vqr; Fri, 26 May 2023 18:43:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ75Nku/PQl3BHBYivntuY3YJsREiwhQa6G3sCfNsfuw+eTBfs3qlThLvGixQBpDVAGj/e/1 X-Received: by 2002:a05:6a20:7d86:b0:10c:ef9f:ddbd with SMTP id v6-20020a056a207d8600b0010cef9fddbdmr1695939pzj.8.1685151829061; Fri, 26 May 2023 18:43:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685151829; cv=none; d=google.com; s=arc-20160816; b=NCwAIpZMJES8fUHrXXR/IltCS4yXIt0tGScHSMRCiH8tG9/HhyiDVruQjaJESXqUJ/ 8bkHVgk17X66whkvKj3ziYSFE/h5J9QKZ9Ea16fU6L0FyKSfHMgnZu6XKfLQ9Ps8513M jNEV7TFCU2EIFcg1kprotVM6IEWcytsltU0o7CIdPw7zVXbQXWZ2HbpWM7qTFY/TNzRM vZvM/LjJHCSyY1g+6jHtl0vAeHI51KtLFQu/2vveZnDG4uVdcmTz6ShthkI4WOiTs7k8 SUtdRO8MOSyhx0T5XBBdgpEo7DagWLS0wJJuQWlsEwcvsTgcR0xsRerHiXbSS4LDG4nK Xr3Q== 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:date:subject:cc:to:from :dkim-signature; bh=KaDACvZxwdpKtf7kTBQLIF7ZNxT8GRJ6++BKiL/JB9M=; b=DwnOVuC7nLwKtNn80OGCncc7RrQijezvTvP9oI71/eFenH8d0zM+lg/4Zgzszctgv+ l/iNKyp2Ha5NjuExG8oHZTViQLi9vh2m9GIP52jA0/m1J2wMzSnOk/ULqik0wOKFS8wu tSwa9aFHfByrqg/50/shXxq4EngR8x8BVD8rq+nVK+JrwhyuQjPQZMfzeuD+wA2ARvMk diQTOqOcMx4x4LJl3OQLOuKcgygywnFaEMWRbmPGmVGquUmLd9osahh5KYiYgu4mdB31 OoZ1yIjD8D2vVzdYk+otMD+J1Oe98HWBK1vFQP/8enj/BvtjnAY4pttMsN2fKBt+0+ZI uOZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jVuYAdq3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v190-20020a6389c7000000b0052c89d50011si5095624pgd.676.2023.05.26.18.43.34; Fri, 26 May 2023 18:43:49 -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=@chromium.org header.s=google header.b=jVuYAdq3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243355AbjE0Bmp (ORCPT + 99 others); Fri, 26 May 2023 21:42:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243323AbjE0Bmg (ORCPT ); Fri, 26 May 2023 21:42:36 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64B56E63 for ; Fri, 26 May 2023 18:42:20 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-64d2a87b9daso1195967b3a.0 for ; Fri, 26 May 2023 18:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151740; x=1687743740; 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=KaDACvZxwdpKtf7kTBQLIF7ZNxT8GRJ6++BKiL/JB9M=; b=jVuYAdq3YuUoT9q0ptR3Y7gogUCPfBKK+uzhCs3nYmVmC0ZcHgwMRd0F7jOf1hYEoN iVHyunZrSLGRZ/SUtKN1NZqFCsyZzudfiz0JVDxVcWLyOc754sGNrSqCni0+0DMifrdR CX1zK1B4IcAFWXPw6yd7iZFlWLLQa05o6HrVA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151740; x=1687743740; 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=KaDACvZxwdpKtf7kTBQLIF7ZNxT8GRJ6++BKiL/JB9M=; b=l2d/4GJ+wp6oaYSrRE/DyTn9XFh4hb1cO8tMJiNLhe6dEiPGi1nicSzeMLdR5pxdeC SpCz/bTXUKy0i8CbidyZe6iGvzjLBLWG+uPwBs3reEzrZ2vatQALOqSUYcxBH793fUsi eq/YXwm2RHphK2Xf2Rm7rysdMRjIUspS2XQ4nSerKkuvOOpcJ9drWpkiOcsJnpXR18Zf XuvGXK3LEu9+y1tRoOr7/V9ViGUblbfp7OK+XaxiWKvifWhizEtsIOGUw1v/VzD9fCXD uPCQNyCWQZiNtwhASgRXidGxmFuWfYhbR4dXFl0w8SxxaDdhHc877Mt7zlbfOmdk0y0f fmWg== X-Gm-Message-State: AC+VfDyco5kdWzpnFrshnuuu3Fb6d4TnAd2QsciIcPfUZ7EiGVdtuT37 ix2KAr7mPKHEhGUgA2ivrBb0NA== X-Received: by 2002:a05:6a00:2409:b0:63b:8778:99e4 with SMTP id z9-20020a056a00240900b0063b877899e4mr5910255pfh.2.1685151739708; Fri, 26 May 2023 18:42:19 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:19 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 02/10] watchdog/hardlockup: HAVE_NMI_WATCHDOG must implement watchdog_hardlockup_probe() Date: Fri, 26 May 2023 18:41:32 -0700 Message-ID: <20230526184139.2.Ic6ebbf307ca0efe91f08ce2c1eb4a037ba6b0700@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767009764381963184?= X-GMAIL-MSGID: =?utf-8?q?1767009764381963184?= Right now there is one arch (sparc64) that selects HAVE_NMI_WATCHDOG without selecting HAVE_HARDLOCKUP_DETECTOR_ARCH. Because of that one architecture, we have some special case code in the watchdog core to handle the fact that watchdog_hardlockup_probe() isn't implemented. Let's implement watchdog_hardlockup_probe() for sparc64 and get rid of the special case. As a side effect of doing this, code inspection tells us that we could fix a minor bug where the system won't properly realize that NMI watchdogs are disabled. Specifically, on powerpc if CONFIG_PPC_WATCHDOG is turned off the arch might still select CONFIG_HAVE_HARDLOCKUP_DETECTOR_ARCH which selects CONFIG_HAVE_NMI_WATCHDOG. Since CONFIG_PPC_WATCHDOG was off then nothing will override the "weak" watchdog_hardlockup_probe() and we'll fallback to looking at CONFIG_HAVE_NMI_WATCHDOG. Suggested-by: Petr Mladek Signed-off-by: Douglas Anderson Reviewed-by: Petr Mladek --- Though this does fix a minor bug, I didn't mark this as "Fixes" because it's super minor. One could also argue that this wasn't a bug at all but simply was never an implemented feature. The code that added some amount of dynamicness here was commit a994a3147e4c ("watchdog/hardlockup/perf: Implement init time detection of perf") which, as per the title, was only intending to make "perf" dynamic. The old NMI watchdog presumably has never been handled dynamically. arch/Kconfig | 3 ++- arch/sparc/kernel/nmi.c | 5 +++++ kernel/watchdog.c | 13 ------------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 64d771855ecd..b4f6387b12fe 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -428,7 +428,8 @@ config HAVE_NMI_WATCHDOG bool help The arch provides a low level NMI watchdog. It provides - asm/nmi.h, and defines its own arch_touch_nmi_watchdog(). + asm/nmi.h, and defines its own watchdog_hardlockup_probe() and + arch_touch_nmi_watchdog(). config HAVE_HARDLOCKUP_DETECTOR_ARCH bool diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c index 9d9e29b75c43..17cdfdbf1f3b 100644 --- a/arch/sparc/kernel/nmi.c +++ b/arch/sparc/kernel/nmi.c @@ -65,6 +65,11 @@ void arch_touch_nmi_watchdog(void) } EXPORT_SYMBOL(arch_touch_nmi_watchdog); +int __init watchdog_hardlockup_probe(void) +{ + return 0; +} + static void die_nmi(const char *str, struct pt_regs *regs, int do_panic) { int this_cpu = smp_processor_id(); diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 4b9e31edb47f..62230f5b8878 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -217,19 +217,6 @@ void __weak watchdog_hardlockup_disable(unsigned int cpu) { } */ int __weak __init watchdog_hardlockup_probe(void) { - /* - * If CONFIG_HAVE_NMI_WATCHDOG is defined then an architecture - * is assumed to have the hard watchdog available and we return 0. - */ - if (IS_ENABLED(CONFIG_HAVE_NMI_WATCHDOG)) - return 0; - - /* - * Hardlockup detectors other than those using CONFIG_HAVE_NMI_WATCHDOG - * are required to implement a non-weak version of this probe function - * to tell whether they are available. If they don't override then - * we'll return -ENODEV. - */ return -ENODEV; } From patchwork Sat May 27 01:41: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: 99740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp70753vqr; Fri, 26 May 2023 18:43:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4F83++yQ8jnzAKzptfgluisreOxjXzqNhVbIodhcNZqiVkL/b5UUf07wmTPqw1ZAnVaATd X-Received: by 2002:a05:6a21:328e:b0:100:b715:8ab2 with SMTP id yt14-20020a056a21328e00b00100b7158ab2mr1632650pzb.46.1685151835992; Fri, 26 May 2023 18:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685151835; cv=none; d=google.com; s=arc-20160816; b=P0PMB+8NRt/E3xj5NbiiFIIKqIIOMlDX8LRA2Ni7vaRH4yfA51ZjMugkslq1mPVMF4 ODpxBgh82LBpdDLiWoRtrbq0ygxFJnGR6U+4HBi3KmD/v8Uhn0gFZWcEKM18hlHeRyeo +1bvC5B7gu3dJhwUI5VimT2MKepkp/iKhj/Sn54LO6WwAuIFWb0LqgMdwvVfJAYczLtH Zp4hrDOKJr56UE3xPM2pXv/90OQ9EKUxzU8MA0SLT/1YJkFVSizh4vwIUQY2x/RqFS/e yDsTJ34YrRfRSFzYJOetEh0g04vzOM1LHwz5IohQUNUade22FX7gYU06nE/ySmU3fFEU kHeg== 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:date:subject:cc:to:from :dkim-signature; bh=4pTZ8PdJlA6i+SWNusBTmTzOcCRT41PhrexiQIb/AKs=; b=mxg81N245zhQM6sVOaUuAEzsmFA73oAOFrrJx9L7yjfM4+smTQDJyAgvyoE+ZPn2C4 bCpjs36PIrxmRbNrLo9mvu3d+1haw8UbTFTSxbfBjpgSOy2Fm7H/QVKWSXdi6RgOa/LT 4JcahzkpQ/z4bzFgBLxiZHG40miid6ao0XAyEzUaHmF6b5vEESuvZsc2Z0itFsul1WYe aqml4exgM+KL49F4j7ohgSiCuHDHEFyZPNuyI49JYiD+92MzO9T0xuYfu8stlsKKIk+D fDfsyGQWwBIGpRpIn7b2SFMDuJ0Qvfy2euk02wHuhKEq1ED2HDOEQ4uSQxkzw03UbHMZ UzEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="dGhxmHD/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020a639315000000b005341d2aa9dfsi4888117pge.622.2023.05.26.18.43.41; Fri, 26 May 2023 18:43:55 -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=@chromium.org header.s=google header.b="dGhxmHD/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243841AbjE0Bmt (ORCPT + 99 others); Fri, 26 May 2023 21:42:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243572AbjE0Bmn (ORCPT ); Fri, 26 May 2023 21:42:43 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 682FDE6D for ; Fri, 26 May 2023 18:42:22 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-64d2e8a842cso1214033b3a.3 for ; Fri, 26 May 2023 18:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151741; x=1687743741; 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=4pTZ8PdJlA6i+SWNusBTmTzOcCRT41PhrexiQIb/AKs=; b=dGhxmHD/CSkrIECymGSZJgjulMjULoIls2yt2guqhtavg8UVpzegqrUgkex1Az5eH9 7o8tE1sfBCLwp5jGYATbBDjOwYfBLu2wLAWmL4Fu2votApVdW9ieYsPlWvXbTAoEZCRx IE9pmuxtKBeT5vr2dhEgDDxn0u6fSztfVGgQg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151741; x=1687743741; 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=4pTZ8PdJlA6i+SWNusBTmTzOcCRT41PhrexiQIb/AKs=; b=bjzVAIhh3xKlXz00bCzfqR0qjqFaIXGsWpzqWWF2A6q6GRZXeWzfzvNsxtFK3X3eWz cMWh/NURr2dQ5NhrKNpIdbjpt/E94oDSoi7DwG2vBMCjtyyH3NLVqnu0dNGvDzc6mlX8 HxncjsEWsbErSn2qDiOMg9jVd3jImrk0mMa+wViWafO8ZQ9Qu+VR+IeICYpJN7EOqSLQ e/mKijY1lvqN5WSsJQkqCmYyaMrBgog4UuQ95cyeZOQn+I28Che3nK2tAP7q+HOl0TDV 6XdBjGwokJlUkv6ZaaEKwJENDp7B6Mxc2gKEiBEyTyb8yuac9uxhjNj2srq1RlOo3fpl W68Q== X-Gm-Message-State: AC+VfDxQRo0Iscm3aMfl0+86gke4GNUcjtGkExNcbWgXfUQM5X7N9Lyk 6Gwnk9Q62Kb9RhaDG+3h5+1pYw== X-Received: by 2002:a05:6a00:139c:b0:64c:ae1c:33ac with SMTP id t28-20020a056a00139c00b0064cae1c33acmr7231420pfg.25.1685151741546; Fri, 26 May 2023 18:42:21 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:20 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 03/10] watchdog/hardlockup: Don't use raw_cpu_ptr() in watchdog_hardlockup_kick() Date: Fri, 26 May 2023 18:41:33 -0700 Message-ID: <20230526184139.3.I660e103077dcc23bb29aaf2be09cb234e0495b2d@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767009771651567494?= X-GMAIL-MSGID: =?utf-8?q?1767009771651567494?= In the patch ("watchdog/hardlockup: add a "cpu" param to watchdog_hardlockup_check()") there was no reason to use raw_cpu_ptr(). Using this_cpu_ptr() works fine. Suggested-by: Petr Mladek Signed-off-by: Douglas Anderson Reviewed-by: Petr Mladek --- kernel/watchdog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 62230f5b8878..32dac8028753 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -133,7 +133,7 @@ static bool is_hardlockup(unsigned int cpu) static unsigned long watchdog_hardlockup_kick(void) { - return atomic_inc_return(raw_cpu_ptr(&hrtimer_interrupts)); + return atomic_inc_return(this_cpu_ptr(&hrtimer_interrupts)); } void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs) From patchwork Sat May 27 01:41:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 99741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp70784vqr; Fri, 26 May 2023 18:43:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5HBBOwl27bTdNeVG1Nst/PwSjgyN+oQqcPyFxMHQrMCNvMI6C5tq2jBEVcv+EsjdT1nBQi X-Received: by 2002:a05:6a21:32a2:b0:10f:96aa:9e4a with SMTP id yt34-20020a056a2132a200b0010f96aa9e4amr1501461pzb.2.1685151839545; Fri, 26 May 2023 18:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685151839; cv=none; d=google.com; s=arc-20160816; b=rcqt4l/QH0NQYXNoDLX8//DcYfrKi6cyVE5Nx84FKD/CgCheorwH2FgRSpc/+Mi9uS dpn/6SjOiLUINQ9AVoSGVbvTKZU/dndx/M+D9XIFeO3ZmotzTBdBzJyNmPXu6MqXG0bN c8zOgEI3Hm3+bI4tW4Ro55WHuDaWyukUgivjkfH6hZzJBg4aMs0iOH+3vBSi01jAu3Fh ILTG4+HY8VJ7sXB5AcLLQN6zZOUaagh/aocPgzwH5RnRKKypTL9CGhl0yTf9mau+3cze Hyh7B09lLIt7ipSzO5842ibFgqgy25OeH3VXeXrSsrbDV4yn5ajo3XsAjyIr+knYOA8D rs0w== 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:date:subject:cc:to:from :dkim-signature; bh=cYlDoP4hBUi1FEPJVk5SoicXju51KfuvgdrLi507k6g=; b=0UxkH4prloLQAfkuxpHiJyhEmULK7LL8bJguxZMTaEFjO6OG+CmWUUAdf1jjOtBWol QDUQrBTF3hziUg56EjUakjiZSNzkPlzTDugv3Mx3MMB/UNVxj+SKBXawc4QfqFwURlr7 g7MIHTNEKWoxenzmh9NnYt1SCdGk8Eky2LFe+V0XiPoOnysHUAcy1pvPSY7M4qPIDsPU 4OQF/D4UiYPRs6FMMFMpz+d9L2TQJBGeKmF085aokKtoppmvEPgr7GDYSH/swREKxIrN Qte1wKmYFbJvWvje53/eNCY5skR/yHFTfR9NB6//4Bve7a6S9gmDndB1xNq21+Qf8IDS isdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gGebBDgS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j186-20020a638bc3000000b0050be067284bsi4638551pge.556.2023.05.26.18.43.45; Fri, 26 May 2023 18:43:59 -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=@chromium.org header.s=google header.b=gGebBDgS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243918AbjE0Bmw (ORCPT + 99 others); Fri, 26 May 2023 21:42:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242942AbjE0Bmo (ORCPT ); Fri, 26 May 2023 21:42:44 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 081B2E70 for ; Fri, 26 May 2023 18:42:23 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-64d341bdedcso1167549b3a.3 for ; Fri, 26 May 2023 18:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151743; x=1687743743; 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=cYlDoP4hBUi1FEPJVk5SoicXju51KfuvgdrLi507k6g=; b=gGebBDgShZ+uN8dr+HtKBh/CQRIJdRl3JqouzIec7Inm884gWhnWsPBrktTgLBZqXK 0Vn2L9wyjn0IxKnQRYUzz2PDRwxJ3dxbO49ReX7U7tQFaXawnlPxAsmZ8tisnLvHt2wy vVnzj/jVyWUESXQN92jj0oJ3Exaj1AaFGtAnU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151743; x=1687743743; 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=cYlDoP4hBUi1FEPJVk5SoicXju51KfuvgdrLi507k6g=; b=kUA97JzeJyf64X7ZauuLptHl9yw7GS83h4gEh8L2fXOVdManQSBaTegX1802pUOdNm y2zcJqoN1Jx2brWucNIRJv1gnwxAVa4b1pvRYDwNMIvDahmA+fb42TpBAVaJ37pW2gC4 7SQ4QUhNr02iVFyI20HZyXZkTPBs/WCaHv/aPTzePwoJGPz57YxCkPUXMYXjMPeAaln0 W/2CWHNkT23+ARV+cY2yRG4GYUtvhxILkuYa4f3CO4aJW5zHa/B7HioXw1ZoHVRJUR1L BCdfg4ER0Ylo8DehauhrmCfUFaNASEfalFh40zcHdnlwfS9KrU3czkiGU5hXHRJv1wcr sVkA== X-Gm-Message-State: AC+VfDyxXMTEH9fYe3ZkFwxQHMyjIo+0i1/NfujLtaDQTX9lsBX3GTaw q0basZXxXGgI8ngZnZGehaxYsJmHkNmSbxITs2I= X-Received: by 2002:a05:6a21:9985:b0:101:2ad0:1347 with SMTP id ve5-20020a056a21998500b001012ad01347mr1527991pzb.23.1685151743331; Fri, 26 May 2023 18:42:23 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:22 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 04/10] watchdog/hardlockup: In watchdog_hardlockup_check() use cpumask_copy() Date: Fri, 26 May 2023 18:41:34 -0700 Message-ID: <20230526184139.4.Iccee2d1ea19114dafb6553a854ea4d8ab2a3f25b@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767009775441600595?= X-GMAIL-MSGID: =?utf-8?q?1767009775441600595?= In the patch ("watchdog/hardlockup: add a "cpu" param to watchdog_hardlockup_check()") we started using a cpumask to keep track of which CPUs to backtrace. When setting up this cpumask, it's better to use cpumask_copy() than to just copy the structure directly. Fix this. Suggested-by: Petr Mladek Signed-off-by: Douglas Anderson Reviewed-by: Petr Mladek --- kernel/watchdog.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 32dac8028753..85f4839b6faf 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -154,7 +154,9 @@ void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs) */ if (is_hardlockup(cpu)) { unsigned int this_cpu = smp_processor_id(); - struct cpumask backtrace_mask = *cpu_online_mask; + struct cpumask backtrace_mask; + + cpumask_copy(&backtrace_mask, cpu_online_mask); /* Only print hardlockups once. */ if (per_cpu(watchdog_hardlockup_warned, cpu)) From patchwork Sat May 27 01:41:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 99742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp70862vqr; Fri, 26 May 2023 18:44:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6awxaMDS18JhpkRJvpjRyFW1rWXZqzGpRnZhn5sQs+7jDsqnwOrgGo34LNIkYg26zLwYy9 X-Received: by 2002:a05:6a20:2595:b0:10c:edb:3e09 with SMTP id k21-20020a056a20259500b0010c0edb3e09mr1817231pzd.25.1685151852447; Fri, 26 May 2023 18:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685151852; cv=none; d=google.com; s=arc-20160816; b=IXJlvAdSyYdLY6doFcSTQCMWzm9XCfypLBmUNIXLFBcI5nF+61IFeKFwPqmHI+hwQd bFUBuPAncuYztoRAUvuA+tMjPBHiJbp8nAm7bpcNS80aJMm+5VaV7eKGRpvQHGvpozVp MD2M6JYG51EPlUhsvrezjGh7LfFweLLzsH/88OXxh1rmmJO3VY5/M4+thJL6u1ivjhZg LJaUACtf2MNtogADKeTa68AD+H9rEYsXTlmoyKUsJBZOeRKuSDP4PCXKJevtnpTostQO P2JW1b2PQFOXT3SpxwV4e4m3kU06oyFFuT520LB7p7uW2zkXpAoF0u9CyLW+TXKYxbQ6 b6iw== 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:date:subject:cc:to:from :dkim-signature; bh=QrSnet5OHiffmIbqSfs7JuxPbvC81vL93khftEXYXiY=; b=VItYQD/OPCXkbWZJhhMEijS//4lgVloIhN/n4FCYenVNPUdCZ30+jTKKqz4pbJ0XQ5 irDuqlDRz3EoqYeUZ/P7WVwQSXZvwd5Wi2+Zya5FdljK5rE8MeQq0tI9glCHUxQwJTGk 0M5YpMsxJZBQ53ljzf4/C6KDf1jkcn04bFhw3mnxhdrlRYVDqpaNfx/3kqn8+2ng2E4a 7PJ8sGiHdpXAD1rmVRU8lAB2ROkY+IiEelAx9UDa4CTOeYe54kwEZGp+HRb+19Af+Tjw yroN9OdqJfyyXw16zUPxTxZCbub8wLi3/5/WZjfeGfnLg6833uDsp1sJT4DMyCmG1EwR ekdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BT+dRPt9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a170903110900b001a9b29b6763si3134464plh.399.2023.05.26.18.43.56; Fri, 26 May 2023 18:44:12 -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=@chromium.org header.s=google header.b=BT+dRPt9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243600AbjE0Bmz (ORCPT + 99 others); Fri, 26 May 2023 21:42:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243342AbjE0Bmo (ORCPT ); Fri, 26 May 2023 21:42:44 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F22B1B4 for ; Fri, 26 May 2023 18:42:25 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-64d5b4c3ffeso1172712b3a.2 for ; Fri, 26 May 2023 18:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151745; x=1687743745; 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=QrSnet5OHiffmIbqSfs7JuxPbvC81vL93khftEXYXiY=; b=BT+dRPt9LSQc3DlKLaKCfmyetEhgoJWmpfPImFeN4Zed3b/jcHaHA0DNeF4IWSNxJZ pQJPuH6IffGDZ6zcJvw+gKseGPHpDIJ1vf2pyqkdOHxYFk6spwySKVC18nfFTiPC4p1U vBzpXfaeufNjvxECgwzvl9XLbFJ2N0kpAe2ls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151745; x=1687743745; 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=QrSnet5OHiffmIbqSfs7JuxPbvC81vL93khftEXYXiY=; b=St5YAeHAUp5yvKXmOOB+9/LUCPappgzWBFIGi3chIxVsZWj02pFiDv/wQmcUPJKhzv oshxqlbwZzy5f4X6s0qNvVj1nlfX0O0HYCidRLRg/fTJIHSLcoq2wcOo0JL/8R5WkQXN 0qewmVOQgTHC2Yi3HiCYNt5BRczc1JRsueMosLCZ5CQApDTsbvbTQAMnTWTDNBtzkQ+i ZCZW3QNvfOcm80vHE8MSps4zk2Zuu/uD256yJmrQrTaiEhpfa4/61BaFo4iz/EEQEqfq fl6ePi5niGQd2Hvp4h1sKYX/OeVrkaffqdSkT/6t/xc29X98OoGHFMxCkkxMxUryyDaM t7VQ== X-Gm-Message-State: AC+VfDw8etUlKcqIW1CR7Ni+Kb9XhVRrDLE0nmYQMdOq6WxfJSZZoapn uOl47Lg3G49xfErwHhysN88LSA== X-Received: by 2002:a05:6a00:2386:b0:64d:1185:241a with SMTP id f6-20020a056a00238600b0064d1185241amr6871168pfc.5.1685151745069; Fri, 26 May 2023 18:42:25 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:24 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 05/10] watchdog/hardlockup: remove softlockup comment in touch_nmi_watchdog() Date: Fri, 26 May 2023 18:41:35 -0700 Message-ID: <20230526184139.5.Ia593afc9eb12082d55ea6681dc2c5a89677f20a8@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767009788509253998?= X-GMAIL-MSGID: =?utf-8?q?1767009788509253998?= In the patch ("watchdog/hardlockup: add comments to touch_nmi_watchdog()") we adjusted some comments for touch_nmi_watchdog(). The comment about the softlockup had a typo and were also felt to be too obvious. Remove it. Suggested-by: Petr Mladek Signed-off-by: Douglas Anderson Reviewed-by: Petr Mladek --- include/linux/nmi.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 3a27169ec383..6c6a5ce77c66 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -140,10 +140,6 @@ static inline void touch_nmi_watchdog(void) */ arch_touch_nmi_watchdog(); - /* - * Touching the hardlock detector implcitily pets the - * softlockup detector too - */ touch_softlockup_watchdog(); } From patchwork Sat May 27 01:41:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 99743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp70889vqr; Fri, 26 May 2023 18:44:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5S/yy2YYDxlhPjssMbdwzmyQ9a91oDiGLdjRB0JOAKh2wCFJl0U4AxA3y2KRR8tOVG8vwk X-Received: by 2002:a05:6a00:cc1:b0:644:ad29:fd5a with SMTP id b1-20020a056a000cc100b00644ad29fd5amr6611327pfv.21.1685151857206; Fri, 26 May 2023 18:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685151857; cv=none; d=google.com; s=arc-20160816; b=t6XujmmziTrgnmA/iU/k8iV56ZMh/NV1t2Q2o9eVWcQjgWFA2C7gxoTrST6JHxrk+Z GOpvACblwA9Q9OldGvaIkWy/h90b03U339QitYgFO8h1fD9N99h7r6Vw6BGSGJIDlinI AJAxjcf1yE4N76IFUCBsy2PJ9gpnfuSSCHAJ6MfAJLIWrVE7s8PRvVuZdvYRlOQexd2K DkOsWfr5ROycj7MV5QlQh5pgC1318Cp0c1FBfk70SjZA+GqNyI+n6M6AIDycX2xkOXPG YJouYIQd5CYHVAWVcGIa7a1rtMZBIwOXnu8eOynLak5FWfWDwW4A/ATehz3MIMOxc5io fYaA== 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:date:subject:cc:to:from :dkim-signature; bh=3LzYkR+VFFLH6wRBHL6FlKd+tRCEo62Tgi4gzgiGicM=; b=vQWqDTdup/VHSMWI8VJZP8gU7rdVWu7/OpXIN6OSZqXjc5Fm6bGa70igyLfYVdFITV AQVUeQbLb+32Z0I7YEGhRaAjzjraqGXA5t2tmHzNTuA0dY/wwILHojRYeKNglFtCFI9y qotuuVH+A7itULoFdkFtr7gPB2O+4+Tuc8S/ALYedRUnvd9zBiEMlDpaZZAbtxkGQZif jU3Lxu57fS3SyYUBMVrwrWJyD4B8ALd2ANF9+lUU3uGLxObnIqE9jW8jURa4UEzQHBic VE1xMVoBpcqhZvseDccgsZsjGfuI7LqwvkBOlrA1acstHQpgQ9qMRBpypU80+K052byR et3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MJPM8uBH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020aa797a7000000b0063b52b9a8f5si5459443pfq.267.2023.05.26.18.44.03; Fri, 26 May 2023 18:44:17 -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=@chromium.org header.s=google header.b=MJPM8uBH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243917AbjE0Bm7 (ORCPT + 99 others); Fri, 26 May 2023 21:42:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243270AbjE0Bmr (ORCPT ); Fri, 26 May 2023 21:42:47 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BE00E59 for ; Fri, 26 May 2023 18:42:27 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-64d3fbb8c1cso1800012b3a.3 for ; Fri, 26 May 2023 18:42:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151747; x=1687743747; 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=3LzYkR+VFFLH6wRBHL6FlKd+tRCEo62Tgi4gzgiGicM=; b=MJPM8uBHWtcGykg6NBnTXOlp/wt/zisapv2LqVrNAXkdImxD++McjkPouYYjhNBMZ/ FtnMFxUfnwDPpZ8d3KsgOQlpZlNtaUXpmKC4q99ybOisJ5hfu5QhtX1wrIemYl3fq166 Chku98BUooqaBLPGzQqvfd2wrHxDC0QaznFMY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151747; x=1687743747; 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=3LzYkR+VFFLH6wRBHL6FlKd+tRCEo62Tgi4gzgiGicM=; b=kwDYCkH8FvthVbx11PGQoP98SaTt/MfkXV2mZSCD3YrCj/F1g3J4wl7j+5ngZC5SKu ZxPBaHKf04xZuQOpitvScGIEtoUzbAv9lG34Z4YucyCUoKPU7v9L2T4zyxJMVwY/90S9 wWmVV1YSXrwUFrufQY2n6ZQTSpMBUg63R5F0ADJjGGSWbxYa22jVpi3iYVmQk3TFB3Mq +QaXFYHLNQ69DWKHrtZ+YnTsH7F0GBdDxenMEo1+17dRcwN8qtb88YM5eV9B9HhFoKPw 5QbGkKLwPMfOQvy2uv94dp05LGv240LbtKOOcU7eCUPTZV7JV42nzwqeckdUrB138oNe eTgg== X-Gm-Message-State: AC+VfDwGbFMlg3nCXLbaCgzInMj/rMIHg5+hJpafKvou0/Cijz+oklLj ngj2vh3sITswxeftn8H8Ci6k6A== X-Received: by 2002:aa7:888e:0:b0:63b:8eeb:77b8 with SMTP id z14-20020aa7888e000000b0063b8eeb77b8mr6362327pfe.13.1685151746880; Fri, 26 May 2023 18:42:26 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:26 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 06/10] watchdog/buddy: Cleanup how watchdog_buddy_check_hardlockup() is called Date: Fri, 26 May 2023 18:41:36 -0700 Message-ID: <20230526184139.6.I006c7d958a1ea5c4e1e4dc44a25596d9bb5fd3ba@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767009794139533689?= X-GMAIL-MSGID: =?utf-8?q?1767009794139533689?= In the patch ("watchdog/hardlockup: detect hard lockups using secondary (buddy) CPUs"), we added a call from the common watchdog.c file into the buddy. That call could be done more cleanly. Specifically: 1. If we move the call into watchdog_hardlockup_kick() then it keeps watchdog_timer_fn() simpler. 2. We don't need to pass an "unsigned long" to the buddy for the timer count. In the patch ("watchdog/hardlockup: add a "cpu" param to watchdog_hardlockup_check()") the count was changed to "atomic_t" which is backed by an int, so we should match types. Suggested-by: Petr Mladek Signed-off-by: Douglas Anderson Reviewed-by: Petr Mladek --- include/linux/nmi.h | 4 ++-- kernel/watchdog.c | 15 +++++++-------- kernel/watchdog_buddy.c | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 6c6a5ce77c66..43893e5f858a 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -114,9 +114,9 @@ void watchdog_hardlockup_disable(unsigned int cpu); void lockup_detector_reconfigure(void); #ifdef CONFIG_HARDLOCKUP_DETECTOR_BUDDY -void watchdog_buddy_check_hardlockup(unsigned long hrtimer_interrupts); +void watchdog_buddy_check_hardlockup(int hrtimer_interrupts); #else -static inline void watchdog_buddy_check_hardlockup(unsigned long hrtimer_interrupts) {} +static inline void watchdog_buddy_check_hardlockup(int hrtimer_interrupts) {} #endif /** diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 85f4839b6faf..6cc46b8e3d07 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -131,9 +131,12 @@ static bool is_hardlockup(unsigned int cpu) return false; } -static unsigned long watchdog_hardlockup_kick(void) +static void watchdog_hardlockup_kick(void) { - return atomic_inc_return(this_cpu_ptr(&hrtimer_interrupts)); + int new_interrupts; + + new_interrupts = atomic_inc_return(this_cpu_ptr(&hrtimer_interrupts)); + watchdog_buddy_check_hardlockup(new_interrupts); } void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs) @@ -195,7 +198,7 @@ void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs) #else /* CONFIG_HARDLOCKUP_DETECTOR_COUNTS_HRTIMER */ -static inline unsigned long watchdog_hardlockup_kick(void) { return 0; } +static inline void watchdog_hardlockup_kick(void) { } #endif /* !CONFIG_HARDLOCKUP_DETECTOR_COUNTS_HRTIMER */ @@ -449,15 +452,11 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) struct pt_regs *regs = get_irq_regs(); int duration; int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace; - unsigned long hrtimer_interrupts; if (!watchdog_enabled) return HRTIMER_NORESTART; - hrtimer_interrupts = watchdog_hardlockup_kick(); - - /* test for hardlockups */ - watchdog_buddy_check_hardlockup(hrtimer_interrupts); + watchdog_hardlockup_kick(); /* kick the softlockup detector */ if (completion_done(this_cpu_ptr(&softlockup_completion))) { diff --git a/kernel/watchdog_buddy.c b/kernel/watchdog_buddy.c index fee45af2e5bd..3ffc5f2ede5a 100644 --- a/kernel/watchdog_buddy.c +++ b/kernel/watchdog_buddy.c @@ -72,7 +72,7 @@ void watchdog_hardlockup_disable(unsigned int cpu) cpumask_clear_cpu(cpu, &watchdog_cpus); } -void watchdog_buddy_check_hardlockup(unsigned long hrtimer_interrupts) +void watchdog_buddy_check_hardlockup(int hrtimer_interrupts) { unsigned int next_cpu; From patchwork Sat May 27 01:41:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 99746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp74828vqr; Fri, 26 May 2023 18:55:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7WPrnl883XdT8aNTxzpHTCxxFjtVDhd/OpeXZhGQiscLAv8w0NCfKqmkGB3FI2sEvk/fT1 X-Received: by 2002:a17:90b:3e87:b0:253:3d30:e6f9 with SMTP id rj7-20020a17090b3e8700b002533d30e6f9mr971671pjb.15.1685152531494; Fri, 26 May 2023 18:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685152531; cv=none; d=google.com; s=arc-20160816; b=lKd4Ri236ynd9Qp0Mwg8OGNqAgfascMqF+9TpHWU6zrqFhJgbmFUmNfbF1BBaKCJId r5rfFcmsCUEnQMvD1/37fa9IRfGuObZrWkD8yQxvo2hQVewqe1z9tm2KvyTQ945tvd7N vHlwZrWLKx81JWXk0sUrFWSRhKaTT7VqZYeDd6oMDuIvKSsEENaFW1ycMrdRHyHkMzW4 QLN0PQtTcUzHMgztcgVYLzz9VK8tR5noo4irMdQlDutPjo7h9A5KL1gb83q/9h4D2aH4 ++DDzfbon/zpCcz8tU7KITc3kGzlGGQa06A3hh8WDVIHc4WN31xMXF0e3heqkb2l8ACH BTAA== 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:date:subject:cc:to:from :dkim-signature; bh=cAUIzM0ipEZnJ+DKEACmhXTzJMTqgJKwduhWCKwpQIQ=; b=ErRvHKtqZYrt6A91FsJYs00Y7nqrWKR+KliccEvrjzNgqmzZReCjYopdW35VqCgfPP 0uA08PP+4c/mdqkexJD0tzf2Od78QJccmfa1rhwYPYn3ZNZCjwgj4GgyJE1OhoL5y272 zvxSlKHEaQf0xcrT3inboCVbZbzu346b3SkOcp/J/tRD78fWx5bxjUzsP04n+OeOJCgK 76+EDLk38d5/dh+wkr9pFF8beV2EvMR45gMXGBc9Eynu1AWk+YFdf/6n6Gr0gXyeEP9L drE2MG2yIwAM7RhNJvNlBf8Nb6zl2Zli6pLBpmhEsVLDTEeOMEibkQHNCWarv9tQaNSS eETw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Q025PITc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on5-20020a17090b1d0500b0025337db9e19si5880059pjb.156.2023.05.26.18.55.15; Fri, 26 May 2023 18:55:31 -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=@chromium.org header.s=google header.b=Q025PITc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243990AbjE0BnD (ORCPT + 99 others); Fri, 26 May 2023 21:43:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243813AbjE0Bmt (ORCPT ); Fri, 26 May 2023 21:42:49 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC01E46 for ; Fri, 26 May 2023 18:42:29 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-64fbfe0d037so53750b3a.0 for ; Fri, 26 May 2023 18:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151748; x=1687743748; 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=cAUIzM0ipEZnJ+DKEACmhXTzJMTqgJKwduhWCKwpQIQ=; b=Q025PITc8JDv9dJTfN7tctFHTJNnpaJy29WWhsH2ZPNUoOboOZYviwhQysV0Gmhli6 56fngg0HA+HuSP7ILjSstqS+Mhqo+R8NkGbp1+jpakojtJHDkgDTve7zASH3nWRB6R5B bOOBqThle1HJJLIUfe8O4ba5IMukCJE/7Qfis= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151748; x=1687743748; 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=cAUIzM0ipEZnJ+DKEACmhXTzJMTqgJKwduhWCKwpQIQ=; b=eES/AkQDv52Gxi3Q36JSuNbevA7yc0RnSFBpI+9aQfA0oGIohxF396PaBos94Z+Lnt jAcUv8FKfMDhze6FrvlRoxxqV19ZGnj1XDUPWt1f7OeuYqhuGZQ/inC24silxpD0NdZR ebd6XL77QMmuzUCuzFrzGi+e/VpcXEGELHj52xhD57iuTF7+v2PJ5EKciqKs+rIKfeY/ XzW+QLwtiRN5pWe8d5M4tyzCW7zY8zavLu0NnBxeP7J0qNeJS4aJzhPXVBwhcTsoV5Un VBogwcKMiTn8JtxEFa9Cja6TEVWmaYXjZtuAWrCG+xjqHcuOth+4caUMF2c2ns/bq5lA mjDA== X-Gm-Message-State: AC+VfDw14Zu9JUhf0olJclianzjgBpB0bB3YtFQRg5OrzRA6blRwRf23 oqdwjmNmwsiaMp3W3ElM0/QApw== X-Received: by 2002:a05:6a20:7351:b0:105:3e47:7504 with SMTP id v17-20020a056a20735100b001053e477504mr902971pzc.11.1685151748589; Fri, 26 May 2023 18:42:28 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:28 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 07/10] watchdog/buddy: Don't copy the cpumask in watchdog_next_cpu() Date: Fri, 26 May 2023 18:41:37 -0700 Message-ID: <20230526184139.7.If466f9a2b50884cbf6a1d8ad05525a2c17069407@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767010501118436409?= X-GMAIL-MSGID: =?utf-8?q?1767010501118436409?= There's no reason to make a copy of the "watchdog_cpus" locally in watchdog_next_cpu(). Making a copy wouldn't make things any more race free and we're just reading the value so there's no need for a copy. Suggested-by: Petr Mladek Signed-off-by: Douglas Anderson Reviewed-by: Petr Mladek --- kernel/watchdog_buddy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/watchdog_buddy.c b/kernel/watchdog_buddy.c index 3ffc5f2ede5a..2ef88722c5e7 100644 --- a/kernel/watchdog_buddy.c +++ b/kernel/watchdog_buddy.c @@ -10,12 +10,11 @@ static cpumask_t __read_mostly watchdog_cpus; static unsigned int watchdog_next_cpu(unsigned int cpu) { - cpumask_t cpus = watchdog_cpus; unsigned int next_cpu; - next_cpu = cpumask_next(cpu, &cpus); + next_cpu = cpumask_next(cpu, &watchdog_cpus); if (next_cpu >= nr_cpu_ids) - next_cpu = cpumask_first(&cpus); + next_cpu = cpumask_first(&watchdog_cpus); if (next_cpu == cpu) return nr_cpu_ids; From patchwork Sat May 27 01:41:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 99748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp82085vqr; Fri, 26 May 2023 19:15:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jb2AJ5t7H7hs1sgAJzB8Lv2XPglp9Dx2+pZNd7JF5yQLRvkhryEz7UElg2xTwjIvdDwi3 X-Received: by 2002:a17:902:7790:b0:1af:b049:b32e with SMTP id o16-20020a170902779000b001afb049b32emr4039810pll.56.1685153702760; Fri, 26 May 2023 19:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685153702; cv=none; d=google.com; s=arc-20160816; b=qHQf6NTrSvVnr5dS/Xnyei856Kzyw2Hmw0VsP5iy5JOE3Jh2SvKOCSRYXhOin/CZSM nY2Bwe84/PaR0dxckBFL4hnWpp6WJx7fWHzdDWqqX6f71FdOhIDuilBiOA1Qp92JXnTz Cw3QI65zUAkpn6FIGZ7W7Qn4j+9MdeLf3cJtIiRORA2YBg5NNMPGqIqsrmdi5e9tUJtH +TpsQ0vFTY8SCbQfd5VCXCjR/hxQM1isvf+9uJq21wgYsEqolYx2UO07Zx7AuWk7X36y heUH9g0yAefPCql5KqXLyS7JpSfeKoEiXh2BA+M3msARZ4XEnLugLafURuI65abh0bRO y6/Q== 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:date:subject:cc:to:from :dkim-signature; bh=hhZKQ5chvzZjdXAK7yuxvuaTNwo4ZylkC6Gy3ujvEec=; b=plaDVXoUeXTNhJKI1+oWOKATp/CpVoFmhr0k7OCVp5Aez6W3HkqgdlQVjprzWw/5Ji ivj9NXmJ0I73s0LmAm9e9nh7kIklSToEcYMcdaeWs1WYNgELdI1ot3StT5HRrXUyQxVf HXiPoeXdUIslLAuQI5btlZQLGlJCDPIqIXlIJd/kx+ib+I2RH9QhE9obMGwdbvSoFd9h dgY9LO5kkTe/6sKI2tl/Gv8S3X8WWQDNnDDyVTNsvNmhzrGwgVmVXudK/t1TfLcNtYVC A8lug8HJJKpghqKfMGiVJcSs3tePWLK/u2q1a1fD+pvETzip9ja9RDoYfvoC7evoo02E nEQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Aa2FnlO7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h128-20020a636c86000000b00528d90d40e4si4703610pgc.88.2023.05.26.19.14.47; Fri, 26 May 2023 19:15:02 -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=@chromium.org header.s=google header.b=Aa2FnlO7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244148AbjE0BnJ (ORCPT + 99 others); Fri, 26 May 2023 21:43:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243853AbjE0Bmt (ORCPT ); Fri, 26 May 2023 21:42:49 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF4DDE4B for ; Fri, 26 May 2023 18:42:30 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-64d30ab1ef2so1217221b3a.2 for ; Fri, 26 May 2023 18:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151750; x=1687743750; 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=hhZKQ5chvzZjdXAK7yuxvuaTNwo4ZylkC6Gy3ujvEec=; b=Aa2FnlO7cA7GOt4jdHYmDdd1WDaYmdWhcVEaBF5A+6UaJVFXdOsQgbvTyfqoPjk4bh xDmNcaix5P9IJQEn4sRdp17S3cm+b5XkOk0LLoDg2dgEdaX2+JASBn14gthkz9JJvjeq /e8LlbDE1Czum9F+Yjho76XQANK+Ly3h8sjUk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151750; x=1687743750; 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=hhZKQ5chvzZjdXAK7yuxvuaTNwo4ZylkC6Gy3ujvEec=; b=Sxx0umG54cRN8epyzPjVKW35smt6Zal0sGkE4wwebusiDErLtDBfPMhfz3upDU50o/ ViCIWi71b+How6yEQwIDQUHZ9FB7MWgbUEBu2lIjjhLKc3+0JMIveyFEe0R/y1RNCpn3 z3cbr90zcaZHH3uSzRfzwsyvMcgd+R8w9VplzxdcRzal6fjlG40QzBUFXisP9nlw8W7F 9lIHRM414rZcNtanZ+NAALMuDV70Y7ITY57T8MvZoehkopPlXjJmA0fN7bWfgZ0IZAxr PzM9VKhCdI06rN+iciKyCRHfXQjBk2GEJ+z9vpw+z7o4KPJyiMT9LZn0zF/MTie3aq0w JK1g== X-Gm-Message-State: AC+VfDzR2vYlwTxq6uZE6VAtdNDkXWMVaBhFOQwXszkdUlcG9OSS3PA8 XW1eqWoCnZ5hGj2hyl6dJQbyxw== X-Received: by 2002:a05:6a00:3911:b0:63d:2f13:200 with SMTP id fh17-20020a056a00391100b0063d2f130200mr6100546pfb.16.1685151750426; Fri, 26 May 2023 18:42:30 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:29 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 08/10] watchdog/buddy: Simplify the dependency for HARDLOCKUP_DETECTOR_PREFER_BUDDY Date: Fri, 26 May 2023 18:41:38 -0700 Message-ID: <20230526184139.8.I49d5b483336b65b8acb1e5066548a05260caf809@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767011729184563090?= X-GMAIL-MSGID: =?utf-8?q?1767011729184563090?= The dependency for HARDLOCKUP_DETECTOR_PREFER_BUDDY was more complicated than it needed to be. If the "perf" detector is available and we have SMP then we have a choice, so enable the config based on just those two config items. Suggested-by: Petr Mladek Signed-off-by: Douglas Anderson Reviewed-by: Petr Mladek --- lib/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index c9df93402237..eb1edd5905bc 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1065,7 +1065,7 @@ config HAVE_HARDLOCKUP_DETECTOR_NON_ARCH config HARDLOCKUP_DETECTOR_PREFER_BUDDY bool "Prefer the buddy CPU hardlockup detector" - depends on HAVE_HARDLOCKUP_DETECTOR_NON_ARCH && HAVE_HARDLOCKUP_DETECTOR_PERF && SMP + depends on HAVE_HARDLOCKUP_DETECTOR_PERF && SMP help Say Y here to prefer the buddy hardlockup detector over the perf one. From patchwork Sat May 27 01:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 99744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp71001vqr; Fri, 26 May 2023 18:44:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67BAyLURIgfioU1jToXeuwjOS2p5kIxrTNWIdoIhb82VIGAbO7ccDDhQwNoToFflDxrTlK X-Received: by 2002:a17:902:c94f:b0:1af:b681:5313 with SMTP id i15-20020a170902c94f00b001afb6815313mr5012214pla.33.1685151873804; Fri, 26 May 2023 18:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685151873; cv=none; d=google.com; s=arc-20160816; b=dqwYUDuIrbX0F1Ql5wbuDjJQdVjZtPtKbGcQnIksO1FX98Pp0ZcNcKBPKcn71ffNzh mhC7d+AEdVacOfhtzXRWsD3AtCGMRUdwHDFL04og/jox9cX7AevlzY3wmoAp73bJz/pq UUGOvflxl8Zaed7dPJ6aKt3GPp8t+xrw/XsPW8su+uuwwSkvesL9FxG+NyuUABRUQRo9 FEDkWRtCbKRwUwgaCzA2IBiAVOkfgrBK+6mhDZtVlpYZ0lLwgIsi8TqfeKzczV1uLyIS rIipa+FthmvLwcD3zRbAltaAnlZUyOJKb//UpivScmDAOHY5GNhBCr8YPKNDreK1jegg K4FQ== 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:date:subject:cc:to:from :dkim-signature; bh=4CpMXuml+REzVPCV5YpF8KcdPL/FMQZnR1a5DDg0o94=; b=AfCM5KGRywYMdvzXf6fM5Hhk5HFSZLMRHnuiDqoCenLU97B+hhowMDN/Ws2dUPGqKH IOGnHCuypB8/0xQ3ekS/r/6Shy8a+B+hIaMyzTF6nfw908dNCpABXYRl2Jimf8+yh85+ LqlDNyeQAfDwCLYEPr2Fo+ZPzjLfruHeeRYdiugqhI2VdNTM5S/nkpimXCM779Dt0Ns3 PhNfDoLCv5Qw2jODxRHEMIvY5hTyhPaxFhn7tGI8BXi2eOj0l+k/iCgEbBzjHVUQ0L74 k908P8quFKXMcBYlDPpoqGXf0LBzLhMidqgKzd6N6JszODDNHUhj8kRQHP/YJhcSxjAL CJVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="lWWP/2wc"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a1709028bca00b001992f451a28si1460787plo.384.2023.05.26.18.44.18; Fri, 26 May 2023 18:44:33 -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=@chromium.org header.s=google header.b="lWWP/2wc"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243869AbjE0BnP (ORCPT + 99 others); Fri, 26 May 2023 21:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243783AbjE0Bmw (ORCPT ); Fri, 26 May 2023 21:42:52 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91ED9E4E for ; Fri, 26 May 2023 18:42:32 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-64d1a0d640cso1223337b3a.1 for ; Fri, 26 May 2023 18:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151752; x=1687743752; 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=4CpMXuml+REzVPCV5YpF8KcdPL/FMQZnR1a5DDg0o94=; b=lWWP/2wciP5Lcnvzvjsar/98gic2UMLjL7shy/u4jcBVbG5MnQbC3jVJH8wV32l4xR /nrvT+VbnmoHL7WUx9Zoh+UT6oazi8OyVzo4oafQGAwcJbnMk2/Hi1w+wVB/DP/r1xpp TGm6jAwztGOFKItK9wAegBPuXnpdHRPuC12Ys= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151752; x=1687743752; 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=4CpMXuml+REzVPCV5YpF8KcdPL/FMQZnR1a5DDg0o94=; b=QM/FZCnPdj8IMFk5p6uUTPit2z72k+nXEPqPZNhxn9kyAyOo1HXWq4UwjxpO6VqNND m8fIG0PGEWcyqmgIPX9dp+EIWvoPGS/xDSQxGgwWg19rzxONd2cZSOTZhko+tiMatGOb EjaPampBClfWvwbvrKCzfO1ttH5Pc0T9DQOVg3iWLp5aJBPKpfzGwbyhf/IqYg/nl+M1 XItQzxQ5i2fSBOfwsQ8IjU5pWzS1BfJomo+H+L89n3nwf+TU2eylVMpN92ya6fEGrst3 lSIGnnMoW8IYhuNfRupftaGqW3GNUf44TPCCCvbwp9YhiNbCTgHCWm8QKcEeLRvH3JAD bVaQ== X-Gm-Message-State: AC+VfDwyNx/cGKLbuXmyvnzCSFE+lXCrcz9Acf8IiKhjQAZHdFds4AJd rYkwJB7/FWiw3JxSqXFjZa88gQ== X-Received: by 2002:a05:6a20:2d2a:b0:10c:7c72:bdd6 with SMTP id g42-20020a056a202d2a00b0010c7c72bdd6mr1357189pzl.59.1685151752164; Fri, 26 May 2023 18:42:32 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:31 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 09/10] watchdog/hardlockup: Move SMP barriers from common code to buddy code Date: Fri, 26 May 2023 18:41:39 -0700 Message-ID: <20230526184139.9.I5ab0a0eeb0bd52fb23f901d298c72fa5c396e22b@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767009811384874577?= X-GMAIL-MSGID: =?utf-8?q?1767009811384874577?= It's been suggested that since the SMP barriers are only potentially useful for the buddy hardlockup detector, not the perf hardlockup detector, that the barriers belong in the buddy code. Let's move them and add clearer comments about why they're needed. Suggested-by: Petr Mladek Signed-off-by: Douglas Anderson Reviewed-by: Petr Mladek --- kernel/watchdog.c | 6 ------ kernel/watchdog_buddy.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 6cc46b8e3d07..a351ab0c35eb 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -109,9 +109,6 @@ EXPORT_SYMBOL(arch_touch_nmi_watchdog); void watchdog_hardlockup_touch_cpu(unsigned int cpu) { per_cpu(watchdog_hardlockup_touched, cpu) = true; - - /* Match with smp_rmb() in watchdog_hardlockup_check() */ - smp_wmb(); } static bool is_hardlockup(unsigned int cpu) @@ -141,9 +138,6 @@ static void watchdog_hardlockup_kick(void) void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs) { - /* Match with smp_wmb() in watchdog_hardlockup_touch_cpu() */ - smp_rmb(); - if (per_cpu(watchdog_hardlockup_touched, cpu)) { per_cpu(watchdog_hardlockup_touched, cpu) = false; return; diff --git a/kernel/watchdog_buddy.c b/kernel/watchdog_buddy.c index 2ef88722c5e7..34dbfe091f4b 100644 --- a/kernel/watchdog_buddy.c +++ b/kernel/watchdog_buddy.c @@ -51,6 +51,13 @@ void watchdog_hardlockup_enable(unsigned int cpu) if (next_cpu < nr_cpu_ids) watchdog_hardlockup_touch_cpu(next_cpu); + /* + * Makes sure that watchdog is touched on this CPU before + * other CPUs could see it in watchdog_cpus. The counter + * part is in watchdog_buddy_check_hardlockup(). + */ + smp_wmb(); + cpumask_set_cpu(cpu, &watchdog_cpus); } @@ -68,6 +75,13 @@ void watchdog_hardlockup_disable(unsigned int cpu) if (next_cpu < nr_cpu_ids) watchdog_hardlockup_touch_cpu(next_cpu); + /* + * Makes sure that watchdog is touched on the next CPU before + * this CPU disappear in watchdog_cpus. The counter part is in + * watchdog_buddy_check_hardlockup(). + */ + smp_wmb(); + cpumask_clear_cpu(cpu, &watchdog_cpus); } @@ -88,5 +102,12 @@ void watchdog_buddy_check_hardlockup(int hrtimer_interrupts) if (next_cpu >= nr_cpu_ids) return; + /* + * Make sure that the watchdog was touched on next CPU when + * watchdog_next_cpu() returned another one because of + * a change in watchdog_hardlockup_enable()/disable(). + */ + smp_rmb(); + watchdog_hardlockup_check(next_cpu, NULL); } From patchwork Sat May 27 01:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 99745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp71027vqr; Fri, 26 May 2023 18:44:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4I16bPjnDY7fcqVbmE/PINgSfiKqCrSuET6TaBk1aehrd9FI+yRJsQ09AYNDZHFRSPEpZU X-Received: by 2002:a05:6a20:7f81:b0:100:47a5:d754 with SMTP id d1-20020a056a207f8100b0010047a5d754mr1769442pzj.23.1685151878594; Fri, 26 May 2023 18:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685151878; cv=none; d=google.com; s=arc-20160816; b=oFFR9HMpM9OYqqJqOYwx70Cu/RB0Vu3BXyp26EasZelItE+g0Sn1lrFFzsNfnFKXjy E8lduwj09b8rxY5iz5xMrwMRfHjuaRJy6ML9NQHRbP6E+TQrony3+rBXAYBWzWeThX3H 3Ja8s1d9Wc4nSwA9t5VcHFO/vsmv0RsJGh/6jUBDD5gEg1tmfTwbvKB/CLCrjHUJLuVz UqggD8TRvZC6j3ScfG7uw1ZL8Iq/M8FBx/k2p3x5jy9wKdKr2L4ZG3shEHFKRQMMklQF exl8x8w9T91MLqVXFdvo7nuiP9Gm2uSLnze9zE0XFFJ0lchCZzNf/LgDxgJQa4WC3hTV E7SA== 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:date:subject:cc:to:from :dkim-signature; bh=JxNnTqvzGhDuJSCmbsa+rtoHfqlXA4TJSz9TjwxMeho=; b=XJeo9A6ABUEo5aDFUrt1M+9K4AVYyE5gtZ+Ibl0OEjkUyReXP1DbtOB+UrcXDMqAsk I7ttuKt9EZW8+5dUjkZuAbVIUQ7s4k+3zUc7RfAcXx5pj7MbxX1W+jFXIAeToCO8hDEi J34NkE4c8UbRx9g+MkbP5rL2XRhcwCZt7C7lIQA4QT2qNFaHHBMeFky6jBwnaQi2CQGg cJHs8vz/0Y7MNPwq/5/i6jVBg3rROp9vJdtRf+k5DUZLUcOreREncdiMAPioQRJeYgZ9 Dh6awSckIbSLrTZv5Tkv1FtA1TK0Y1V1cd8C/UPXyipn2DvgIN8mBo41+OQ48VLv9Ha6 Kz8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ShJfBqA9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v190-20020a6389c7000000b0052c89d50011si5095624pgd.676.2023.05.26.18.44.23; Fri, 26 May 2023 18:44: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=@chromium.org header.s=google header.b=ShJfBqA9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243906AbjE0BnU (ORCPT + 99 others); Fri, 26 May 2023 21:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243948AbjE0Bmx (ORCPT ); Fri, 26 May 2023 21:42:53 -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 4E97CFB for ; Fri, 26 May 2023 18:42:34 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-64d2ca9ef0cso1124085b3a.1 for ; Fri, 26 May 2023 18:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685151754; x=1687743754; 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=JxNnTqvzGhDuJSCmbsa+rtoHfqlXA4TJSz9TjwxMeho=; b=ShJfBqA9ft7ncDs0dOFd2RPnmhJyBiEjNx2LZ1p8J3ek51VUldJqNKK6EfAx/6LMhv I51cZ9p9OhuJ3HYRQJPDRwiiLTttUI75WZhav7nrw8b5x+FhEcc5+eyfOPfL9y63jllh 02RO3yac0QfbIeTbVj1CHjUWHigjgjdAjKjnQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685151754; x=1687743754; 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=JxNnTqvzGhDuJSCmbsa+rtoHfqlXA4TJSz9TjwxMeho=; b=VzIh1678iMLYBESjl2IYSG289zORH0ssE7Of+QsG42LnU723DwlyaHG4iuoulYJFz0 xWquAe1tEDQiPd1F8Fd0UQiHyQld4R+lNE9+S7ejgxNhXziR5HDBn1hgX0PLfNNrehhS 1g/FU6w/OeZirBdWqidNJZHsaNsFhdBeRfIGjwR4aB4iTij+fJQbIM3VJv3/QkplWu7o eOEyj9ZvqkHIiT8VPCRqfozgC1L6BbkANhW4qmbbvh2IcuTFv9Ph1G9SZK0LKetxXdGV PhXwKzfcjwMOEUINwwqQNt22uAKCg6GTNK7etM6iIQ0bQSWexcya/N+swcB5vK19SiMr KVhg== X-Gm-Message-State: AC+VfDyYd/Uh5J3Ga/+JLQ3cC5pF6DVKm4vTOczYwTyzOUIOy13Z0dHw X8mtdM86BdbnuiGtP1zeEo6OXnvr9cUhfhsV/Z0= X-Received: by 2002:a05:6a00:3911:b0:63b:7fc0:a4af with SMTP id fh17-20020a056a00391100b0063b7fc0a4afmr5852154pfb.26.1685151753915; Fri, 26 May 2023 18:42:33 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4015:7255:c79a:26d7]) by smtp.gmail.com with ESMTPSA id x25-20020aa79199000000b0063b8ddf77f7sm3202440pfa.211.2023.05.26.18.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 18:42:33 -0700 (PDT) From: Douglas Anderson To: Petr Mladek , Andrew Morton Cc: kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nicholas Piggin , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , sparclinux@vger.kernel.org, "David S . Miller" , linux-perf-users@vger.kernel.org, Douglas Anderson Subject: [PATCH 10/10] watchdog/hardlockup: Rename HAVE_HARDLOCKUP_DETECTOR_NON_ARCH to ..._PERF_OR_BUDDY Date: Fri, 26 May 2023 18:41:40 -0700 Message-ID: <20230526184139.10.I821fe7609e57608913fe05abd8f35b343e7a9aae@changeid> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230527014153.2793931-1-dianders@chromium.org> References: <20230527014153.2793931-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767009815868326058?= X-GMAIL-MSGID: =?utf-8?q?1767009815868326058?= HAVE_HARDLOCKUP_DETECTOR_NON_ARCH is a mouthful and confusing. HAVE_HARDLOCKUP_DETECTOR_PERF_OR_BUDDY is even more of a mouthful, but probably less confusing. Rename the Kconfig names. Signed-off-by: Douglas Anderson --- lib/Kconfig.debug | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index eb1edd5905bc..b9e162698a82 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1058,7 +1058,7 @@ config HARDLOCKUP_DETECTOR_BUDDY # needs SMP). In either case, using the "non-arch" code conflicts with # the NMI watchdog code (which is sometimes used directly and sometimes used # by the arch-provided hardlockup detector). -config HAVE_HARDLOCKUP_DETECTOR_NON_ARCH +config HAVE_HARDLOCKUP_DETECTOR_PERF_OR_BUDDY bool depends on (HAVE_HARDLOCKUP_DETECTOR_PERF || SMP) && !HAVE_NMI_WATCHDOG default y @@ -1077,10 +1077,10 @@ config HARDLOCKUP_DETECTOR_PREFER_BUDDY an arch-specific hardlockup detector or if resources needed for the hardlockup detector are better used for other things. -# This will select the appropriate non-arch hardlockdup detector -config HARDLOCKUP_DETECTOR_NON_ARCH +# This will select the appropriate non-arch hardlockup detector +config HARDLOCKUP_DETECTOR_PERF_OR_BUDDY bool - depends on HAVE_HARDLOCKUP_DETECTOR_NON_ARCH + depends on HAVE_HARDLOCKUP_DETECTOR_PERF_OR_BUDDY select HARDLOCKUP_DETECTOR_BUDDY if !HAVE_HARDLOCKUP_DETECTOR_PERF || HARDLOCKUP_DETECTOR_PREFER_BUDDY select HARDLOCKUP_DETECTOR_PERF if HAVE_HARDLOCKUP_DETECTOR_PERF && !HARDLOCKUP_DETECTOR_PREFER_BUDDY @@ -1098,9 +1098,9 @@ config HARDLOCKUP_CHECK_TIMESTAMP config HARDLOCKUP_DETECTOR bool "Detect Hard Lockups" depends on DEBUG_KERNEL && !S390 - depends on HAVE_HARDLOCKUP_DETECTOR_NON_ARCH || HAVE_HARDLOCKUP_DETECTOR_ARCH + depends on HAVE_HARDLOCKUP_DETECTOR_PERF_OR_BUDDY || HAVE_HARDLOCKUP_DETECTOR_ARCH select LOCKUP_DETECTOR - select HARDLOCKUP_DETECTOR_NON_ARCH if HAVE_HARDLOCKUP_DETECTOR_NON_ARCH + select HARDLOCKUP_DETECTOR_PERF_OR_BUDDY if HAVE_HARDLOCKUP_DETECTOR_PERF_OR_BUDDY help Say Y here to enable the kernel to act as a watchdog to detect