From nobody Thu May 2 00:13:10 2024 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 CD1CEC6FD1F for ; Sat, 25 Mar 2023 17:34:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231770AbjCYReG (ORCPT ); Sat, 25 Mar 2023 13:34:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231520AbjCYReB (ORCPT ); Sat, 25 Mar 2023 13:34:01 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA8CEB779 for ; Sat, 25 Mar 2023 10:33:53 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id bz27so4514650qtb.1 for ; Sat, 25 Mar 2023 10:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765632; 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=HGRr1ILwfN2cOAAXlHu3J2/PGFc4d+v/t0gK/PtSh/k=; b=WatzM4DuWOJx4M4gULzYWvg6Ga2sfw1KF2JFslVS7krm98DuqIWIE6ircHntnso5H1 3UZgA5Ms0OUui4t/aHQFizRVnCsnEgiV8KjUOTNFBi16FD1cmCrvf26RRnioQUr0sURE LqGpU4P/snzVoGwiU+SupVRJmuzG0EYDaGz1g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765632; 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=HGRr1ILwfN2cOAAXlHu3J2/PGFc4d+v/t0gK/PtSh/k=; b=D5HlUzO/P+VZp0kqzz1MoSmBWd0/HB7sS/w5cQKjKIe7j+mfzNpKLAFNag4p6xdD9J dXOfIooN9qgayzQYpnz4LCOWQtK+4Iu27qWbaIZTOpB4BN8GBtsQNxXGG9wGdvhhyzXH 7Jzylt4MiaT/KTliA9kH42p5kDAKMij+r/GWDZthEHjlHnc5owNZra3cQ3lXPWL8Bxx7 WSGBELK0d6D9QmNYeETYS9FRs9Wyllo61BKFVznGZZ9RQAsA/0bXfTxJDVkfMaWIPtri 2+8G9qPLGmOul7ECDp9P7vobbiaRErv76nUdFCqEAiMVW2Wun1B+IYAZd8dQ5abvGu28 Js8Q== X-Gm-Message-State: AO0yUKVDO2UVXxef7pj71Q8qU4+hmd7uw3aeZswxFTtkHrpo4UKsj6iy 1jeebNArqFpeQxrSHFwh80MMjYDwujgqRcRkzGQ= X-Google-Smtp-Source: AKy350ZQb8NjnaheRmr0a0yUUSmOBnTfw+5+ORNnlNxBGifSZcPI5cuHF9VGV1N28HXDzuZ7cScG3g== X-Received: by 2002:ac8:5f8b:0:b0:3e3:8427:fb51 with SMTP id j11-20020ac85f8b000000b003e38427fb51mr12302234qta.23.1679765632737; Sat, 25 Mar 2023 10:33:52 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:33:52 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , "Paul E . McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Boqun Feng Subject: [PATCH v2 01/13] MAINTAINERS: Change Joel Fernandes from R: to M: Date: Sat, 25 Mar 2023 17:33:04 +0000 Message-Id: <20230325173316.3118674-2-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" I have spent years learning / contributing to RCU with several features, talks and presentations, with my most recent work being on Lazy-RCU. Please consider me for M, so I can tell my wife why I spend a lot of my weekends and evenings on this complicated and mysterious thing -- which is mostly in the hopes of preventing the world from burning down because everything runs on this one way or another. ;-) Acked-by: Paul E. McKenney Cc: "Paul E. McKenney" Cc: Frederic Weisbecker Cc: Neeraj Upadhyay Cc: Boqun Feng Signed-off-by: Joel Fernandes (Google) Acked-by: Frederic Weisbecker --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 8d5bc223f305..698c330d37cf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17637,11 +17637,11 @@ READ-COPY UPDATE (RCU) M: "Paul E. McKenney" M: Frederic Weisbecker (kernel/rcu/tree_nocb.h) M: Neeraj Upadhyay (kernel/rcu/tasks.h) +M: Joel Fernandes M: Josh Triplett R: Steven Rostedt R: Mathieu Desnoyers R: Lai Jiangshan -R: Joel Fernandes L: rcu@vger.kernel.org S: Supported W: http://www.rdrop.com/users/paulmck/RCU/ --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 E557CC6FD1F for ; Sat, 25 Mar 2023 17:34:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231834AbjCYReK (ORCPT ); Sat, 25 Mar 2023 13:34:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbjCYReC (ORCPT ); Sat, 25 Mar 2023 13:34:02 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A767ECA37 for ; Sat, 25 Mar 2023 10:33:55 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id x1so4499264qtr.7 for ; Sat, 25 Mar 2023 10:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765634; 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=m2i4ZWFQEEf+sgts9I9IXVKvOCwZuHZ3OWXbYKFFdbY=; b=NvEg5wJgvEddeXnTJ9ZD0PZGySimLuse3EAD4IauotUQqajZfmDDzEXep5uPbOxCSs pxmCfsVXlFtnaHZbBUJ/hyADQzDMxZjc4irxuLH12DmGuKCPb5BGSwcqHBRnvzAT8uft CZkNklkdQOpCvNOIzpL8pxANq+xxXe09HR5A0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765634; 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=m2i4ZWFQEEf+sgts9I9IXVKvOCwZuHZ3OWXbYKFFdbY=; b=Ypgwkq5FyhmbdjBcTL6e347CxHDgC/ylIHBAlM3yQz3jGXhONQp2f6H1+AUZatdAC5 dkHvZyuC8CVIVWXoJRoUaG9bsVFDng2l+DGpE7cSF/fd9yPzzZBzv6o/5IfvtV4ajbas MJKp1MBC0C8VQcyRmDeMW7NLbzgnmJ38tVWtuXwSp20cTyBodim1pXTT8I/lBfSDRgpj MFPfvoDQbTpV6X/8TI0SvWwpRiSyYDK3xh4rBqIvfT4G+tF4i+EErZhRwakvlS7ilMx1 nW31Vf4mjJvJ9DTG3eWDVOm4AV2JfYu2IHlo/pm9y6vty9ju9I0++Pyojtrwi7J2S5kl nqwA== X-Gm-Message-State: AO0yUKUjNmT7KVf88F4Ay/48hOifchNqgSsUYv5YMBVCfT+nIP41v6ZV 2ePpCceL6nL68QniNtOh3d/85JF5bkcFk7Ge6pM= X-Google-Smtp-Source: AK7set97lqOAjDVThbElr8+YxFs2CK0mVkHKmSkCZdCfhhdf5qsvrHG530FnmOqFw4nsx4KTUtAwdg== X-Received: by 2002:ac8:4e56:0:b0:3bf:b6cf:25c5 with SMTP id e22-20020ac84e56000000b003bfb6cf25c5mr12738707qtw.14.1679765633762; Sat, 25 Mar 2023 10:33:53 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:33:53 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: Boqun Feng , "Paul E . McKenney" , Joel Fernandes Subject: [PATCH v2 02/13] MAINTAINERS: Add Boqun to RCU entry Date: Sat, 25 Mar 2023 17:33:05 +0000 Message-Id: <20230325173316.3118674-3-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Boqun Feng Just to be clear, the "M:" tag before my name is short of "Minions" ;-) Acked-by: Paul E. McKenney Signed-off-by: Boqun Feng Signed-off-by: Joel Fernandes (Google) Acked-by: Frederic Weisbecker --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 698c330d37cf..e9fb1c172ffe 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17639,6 +17639,7 @@ M: Frederic Weisbecker (kerne= l/rcu/tree_nocb.h) M: Neeraj Upadhyay (kernel/rcu/tasks.h) M: Joel Fernandes M: Josh Triplett +M: Boqun Feng R: Steven Rostedt R: Mathieu Desnoyers R: Lai Jiangshan --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 BA018C761AF for ; Sat, 25 Mar 2023 17:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231869AbjCYReN (ORCPT ); Sat, 25 Mar 2023 13:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231156AbjCYReC (ORCPT ); Sat, 25 Mar 2023 13:34:02 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B8C5CDD3 for ; Sat, 25 Mar 2023 10:33:56 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id a5so4504291qto.6 for ; Sat, 25 Mar 2023 10:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765634; 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=1pJMvzOBsStXaQ6aO+axzLwb5fLtB6xIoptrhTt/3BE=; b=IxRuOK/3xmJUvXbXJ+choX2xTmTN4VVfVyCdzi/uNkGLrkiSmsMx1/es3KQnxSLa2b FFPro4IjUEp+MSb0y2pUPRuxATx0VW/NHDwRuznZzbc6wKWtoQSWQhWT6UTVsuAk3oGR iyCq/R5I9bjmk+Ksz+nizZH4ipHt55i4sSEEc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765634; 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=1pJMvzOBsStXaQ6aO+axzLwb5fLtB6xIoptrhTt/3BE=; b=aM7C66fmZGiVQDS3GI2bqh05JHv9pkS4kYvzCXeYflmwlI2aDWG8PaRkrN763GmOKW 2x/Q7MI8GzijFL/t0uXjwFLOho8/+996w2aiAFVeCC9vYQi7UBqaUS51KMVch6iJJxmb BhO5sYBZxH6KpL8TsWv/HJw9tXHMPb8tNGBOQ67qoHCW6E9Zkj6PySKZSbAwY7RPr/K3 DzUJJgpBRlqEeFwr/RIcgRgHLUcb0lW5xw/U1VNEsDmq4RLTw98lOB2F3PpG+7nTpCDq nMFcbU4ZPuOKwlMW90UVouQRMciyMIYBROY0L5rI0MMbMkZek4ZoyYM6oluJMBr1Hv3u eG1Q== X-Gm-Message-State: AO0yUKVyf7dGXtCRbxn3fbYxgZS7RIFdSeHFRTUkuLNuYLz/ZtAYelFV Sa8IIFMuaHjTkYi/CbRTTQ4M2U+1Khhu9o/k6Q8= X-Google-Smtp-Source: AK7set/pbBwu3aEkkCDle9qB2GrPx2h6E5zBaeYDa94xLyQTcdw7fyf5C9hAHfxXBRoG9XNC9jRX/g== X-Received: by 2002:ac8:5896:0:b0:3b8:6d3a:5ec7 with SMTP id t22-20020ac85896000000b003b86d3a5ec7mr12812600qta.22.1679765634735; Sat, 25 Mar 2023 10:33:54 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:33:54 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , "Paul E . McKenney" , Zqiang Subject: [PATCH v2 03/13] MAINTAINERS: Add Zqiang as a RCU reviewer Date: Sat, 25 Mar 2023 17:33:06 +0000 Message-Id: <20230325173316.3118674-4-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" I have spent about two years studying and contributing to RCU, and sharing RCU-related knowledge within my team, if possible, please consider me as R ;-). Acked-by: Paul E. McKenney Signed-off-by: Zqiang Signed-off-by: Joel Fernandes (Google) --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index e9fb1c172ffe..e03067b857a2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17643,6 +17643,7 @@ M: Boqun Feng R: Steven Rostedt R: Mathieu Desnoyers R: Lai Jiangshan +R: Zqiang L: rcu@vger.kernel.org S: Supported W: http://www.rdrop.com/users/paulmck/RCU/ --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 6B248C6FD1C for ; Sat, 25 Mar 2023 17:34:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231777AbjCYReR (ORCPT ); Sat, 25 Mar 2023 13:34:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231691AbjCYReE (ORCPT ); Sat, 25 Mar 2023 13:34:04 -0400 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D443E380 for ; Sat, 25 Mar 2023 10:33:57 -0700 (PDT) Received: by mail-qv1-xf36.google.com with SMTP id oe8so3783689qvb.6 for ; Sat, 25 Mar 2023 10:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765636; 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=ttYDdJ2Zx276ZWlJoVAWoRza17Ux4kZUYP3LM4W/4/Q=; b=TBoO+zTCa6TlvCdSFINwGhqY8IkwKRzIpUuMBfJ00Ks7v4MNhxO5xhvGMwRhaK8P9r Gn7ol1JTk3hslUvRYVP2KSNYdJj6l80Fwotm3y4bciBkbTl7+U9pgO5y+hZKzkz8ZyyY aElsltBE3c6EIzkIKdIrj8qosyBuHLivrfW1E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765636; 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=ttYDdJ2Zx276ZWlJoVAWoRza17Ux4kZUYP3LM4W/4/Q=; b=mIbl+fkns+xjiAEYW/ClTiSlwGFXKe4q5QFU26T84/ec7aHYeQ2B7xxgWEH7hZtnpY 1ofntlZKbXBxEMW2rpvIPrmVpKmL0g5OyReMfr31rsYoAy+TCXwVFAnOLxoLn4xtHP+I ELM59PYNtrVa85h8UpJfLsmN2OhmArECdNjFjxbNxhBm/LYwdVvDw624/FAK0Dq99Tcc Z2DnBgbVsvOb6u8FDY0CRyvCND9rA9UNNm9leeSjy1F5uDP+jFM5Ll8E/xYG5QcsTrVY 2RQ8TDmSn9soyOMLSeGooFWSXEbilYg19qnOuUjpkXQi/1EI0LnCGsNS0yer97wlMyxA 90yw== X-Gm-Message-State: AAQBX9eukbGnQAvaCxARmBBpPah3TKJu3k3hFvfhC8K55kuVIaFsnI2Q H8QHuYwCganm8wY2HbqNs1NoClstMe8mFKiD23U= X-Google-Smtp-Source: AKy350YQWqfmMrWDtG0WEVQO3hv3uuYGkz9FiACGNcg3/FZZLaU9RFaRrPjTEGVNb2IOqMP/p/ZRmg== X-Received: by 2002:a05:6214:f0f:b0:56e:a9d4:428a with SMTP id gw15-20020a0562140f0f00b0056ea9d4428amr9766799qvb.1.1679765636225; Sat, 25 Mar 2023 10:33:56 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:33:55 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , Frederic Weisbecker , Thomas Gleixner , Ingo Molnar , "Paul E. McKenney" , Josh Triplett Cc: "Joel Fernandes (Google)" , Frederic Weisbecker , Zhouyi Zhou , Will Deacon , Marc Zyngier , rcu , stable@vger.kernel.org Subject: [PATCH v2 04/13] tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem Date: Sat, 25 Mar 2023 17:33:07 +0000 Message-Id: <20230325173316.3118674-5-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" For CONFIG_NO_HZ_FULL systems, the tick_do_timer_cpu cannot be offlined. However, cpu_is_hotpluggable() still returns true for those CPUs. This caus= es torture tests that do offlining to end up trying to offline this CPU causing test failures. Such failure happens on all architectures. Fix it by asking the opinion of the nohz subsystem on whether the CPU can be hotplugged. [ Apply Frederic Weisbecker feedback on refactoring tick_nohz_cpu_down(). ] For drivers/base/ portion: Acked-by: Greg Kroah-Hartman Cc: Frederic Weisbecker Cc: "Paul E. McKenney" Cc: Zhouyi Zhou Cc: Will Deacon Cc: Marc Zyngier Cc: rcu Cc: stable@vger.kernel.org Fixes: 2987557f52b9 ("driver-core/cpu: Expose hotpluggability to the rest o= f the kernel") Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) Acked-by: Frederic Weisbecker --- drivers/base/cpu.c | 3 ++- include/linux/tick.h | 2 ++ kernel/time/tick-sched.c | 11 ++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 182c6122f815..c1815b9dae68 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -487,7 +487,8 @@ static const struct attribute_group *cpu_root_attr_grou= ps[] =3D { bool cpu_is_hotpluggable(unsigned int cpu) { struct device *dev =3D get_cpu_device(cpu); - return dev && container_of(dev, struct cpu, dev)->hotpluggable; + return dev && container_of(dev, struct cpu, dev)->hotpluggable + && tick_nohz_cpu_hotpluggable(cpu); } EXPORT_SYMBOL_GPL(cpu_is_hotpluggable); =20 diff --git a/include/linux/tick.h b/include/linux/tick.h index bfd571f18cfd..9459fef5b857 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -216,6 +216,7 @@ extern void tick_nohz_dep_set_signal(struct task_struct= *tsk, enum tick_dep_bits bit); extern void tick_nohz_dep_clear_signal(struct signal_struct *signal, enum tick_dep_bits bit); +extern bool tick_nohz_cpu_hotpluggable(unsigned int cpu); =20 /* * The below are tick_nohz_[set,clear]_dep() wrappers that optimize off-ca= ses @@ -280,6 +281,7 @@ static inline void tick_nohz_full_add_cpus_to(struct cp= umask *mask) { } =20 static inline void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit) = { } static inline void tick_nohz_dep_clear_cpu(int cpu, enum tick_dep_bits bit= ) { } +static inline bool tick_nohz_cpu_hotpluggable(unsigned int cpu) { return t= rue; } =20 static inline void tick_dep_set(enum tick_dep_bits bit) { } static inline void tick_dep_clear(enum tick_dep_bits bit) { } diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index b0e3c9205946..68d81a4283c8 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -527,7 +527,7 @@ void __init tick_nohz_full_setup(cpumask_var_t cpumask) tick_nohz_full_running =3D true; } =20 -static int tick_nohz_cpu_down(unsigned int cpu) +bool tick_nohz_cpu_hotpluggable(unsigned int cpu) { /* * The tick_do_timer_cpu CPU handles housekeeping duty (unbound @@ -535,8 +535,13 @@ static int tick_nohz_cpu_down(unsigned int cpu) * CPUs. It must remain online when nohz full is enabled. */ if (tick_nohz_full_running && tick_do_timer_cpu =3D=3D cpu) - return -EBUSY; - return 0; + return false; + return true; +} + +static int tick_nohz_cpu_down(unsigned int cpu) +{ + return tick_nohz_cpu_hotpluggable(cpu) ? 0 : -EBUSY; } =20 void __init tick_nohz_init(void) --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 48077C6FD1C for ; Sat, 25 Mar 2023 17:34:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231925AbjCYReU (ORCPT ); Sat, 25 Mar 2023 13:34:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231642AbjCYReF (ORCPT ); Sat, 25 Mar 2023 13:34:05 -0400 Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7036293EA for ; Sat, 25 Mar 2023 10:33:58 -0700 (PDT) Received: by mail-qv1-xf36.google.com with SMTP id g9so3760484qvt.8 for ; Sat, 25 Mar 2023 10:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765637; 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=UZ68ufo3dlSNYy/wHT1VSjdWSVn/9QVi14RF92IRYWI=; b=rewB8GWRioBBXQ0+OtU3LnwuoNElryIFbsJ7aKxQ3weFJvUOxiEB/P7UxUewPyMZSL 0r1HOCc3xjU0O2QHqnA+X150fPaSTJMKWlTF94ORW6ja26gZ/PHxJeG7i9BdXKBpJKvN b0lzksxsctNEHyjKRiwt0rOdpfybqKxHJnJAk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765637; 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=UZ68ufo3dlSNYy/wHT1VSjdWSVn/9QVi14RF92IRYWI=; b=Y98DE1hS/KLlnAHVSUgRJKcMrrzf9ndejnq2rfPpfDNQx7txFaW7Q55xL9nnYFGo5C GXJ7CXkWYrgypHHxOTzQkfqkKCKgDzidI+N4iuUzEq7oXt4iktAssOmDEceK6BUf06x3 ECgVYxXiMino5T1jRQet9+CRMxPzP5NkUKcIuQhtyUVXHz6ECuBOFAFUantMYSffeBIM 9q4vrK3qJR9l8ZLLjaMU4IoJYr+jQ1qu5/YamUSXwclevAyOWxk2enK5mhNZ2AlTlmSA 8tW/sg7eOXTBOnNKs7ZRjTt4QPqToKEJJXiSHj44Q8a0daeWGdNwF/RE/6W79hWL7hJ8 ZDpA== X-Gm-Message-State: AAQBX9dWGzNA5Bo25Im94pJc2y+7BCGhhdAfgvEoXXuHMoIbCIoUnoQv 8SMnLVfo6giHyP+j+e0HzM1A5pb5ElKXBGH5UbU= X-Google-Smtp-Source: AKy350aTrLiI8kfNmZT8CKQUIMZMtL6HaP1ctOnIYeWyXkMh+nzfrI2SF5jO9G2RsYkp9onL7ngpPw== X-Received: by 2002:a05:6214:2604:b0:5ab:e259:b2a9 with SMTP id gu4-20020a056214260400b005abe259b2a9mr13217724qvb.14.1679765637340; Sat, 25 Mar 2023 10:33:57 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:33:56 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Steven Rostedt , Masami Hiramatsu Cc: Xu Panda , Yang Yang , "Paul E . McKenney" , Joel Fernandes , linux-trace-kernel@vger.kernel.org Subject: [PATCH v2 05/13] rcu/trace: use strscpy() to instead of strncpy() Date: Sat, 25 Mar 2023 17:33:08 +0000 Message-Id: <20230325173316.3118674-6-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xu Panda This commit saves a line of code by switching from strncpy() to strscpy() by permitting the later NUL assignment to be removed. While in the area, save another line by taking advantage of 100 characters. Signed-off-by: Xu Panda Signed-off-by: Yang Yang Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- include/trace/events/rcu.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h index 90b2fb0292cb..c19ac1fa8a60 100644 --- a/include/trace/events/rcu.h +++ b/include/trace/events/rcu.h @@ -776,9 +776,7 @@ TRACE_EVENT_RCU(rcu_torture_read, ), =20 TP_fast_assign( - strncpy(__entry->rcutorturename, rcutorturename, - RCUTORTURENAME_LEN); - __entry->rcutorturename[RCUTORTURENAME_LEN - 1] =3D 0; + strscpy(__entry->rcutorturename, rcutorturename, RCUTORTURENAME_LEN); __entry->rhp =3D rhp; __entry->secs =3D secs; __entry->c_old =3D c_old; --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 3189BC6FD1C for ; Sat, 25 Mar 2023 17:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231945AbjCYReX (ORCPT ); Sat, 25 Mar 2023 13:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231716AbjCYReG (ORCPT ); Sat, 25 Mar 2023 13:34:06 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93FA29EC4 for ; Sat, 25 Mar 2023 10:33:59 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id g19so4488734qts.9 for ; Sat, 25 Mar 2023 10:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765638; 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=E6Aj0mbJD/qZB0r2J2tLnHasIPmuosonkIp69GrjB7E=; b=Y0ARwJXZKYTnxN/qpI5CVYzmurO4mC3453dcb5GLWg6JjriSKj0CM3lb+Msiqq3XWO 8HbIL+kk+3wbPn+tXBcGbmQKysL7d06+QRHdQYwQ3p0g0UcR6SNyLI7wxwREnGr+UCHq aSKCZrC2vRIuhioqVrVNyibAqvhLuYcxJlqJo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765638; 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=E6Aj0mbJD/qZB0r2J2tLnHasIPmuosonkIp69GrjB7E=; b=AwQ8s/74B/1BIHVbzg2KczXMIrdSnvEw5O/Ktp7Uf7bI56Hu5+6Os85J47im/fXLMU 92Z+6QxLEIG3v6ckmQmXxpgk8bB0mMaN2FNOUYNGNLl12B+sG9Uk6WWxZktR1prvT5Bx aZD0rfGCo1N++APTxDQgPNgj7hgVBl4LLQrR/0M0Yeym1EshRt/66RvEiJc0Aqq1B1YJ zlCn0i5n/nErjITKPCwS6qGf5erdoAIrwlcJcga9Oz85zyAE/appQoCubmio/wA2tHJN T7uw6w1Ls2pr2hFOpx39i7seHBM5kN9gBHSDvXi20lcDMUWOsN9HcOeqk/buqjzDumrw LOhw== X-Gm-Message-State: AO0yUKWML3ZEP4Pquq3a4l03r5cvmMu6Nx46Nb0zOjNghbAkrxoAI+UB L7GLdd43rCB4KUXwpwXpSl7vXTOCgyWTVGUkGyQ= X-Google-Smtp-Source: AK7set/CmKjhmjvVfu3VgHk3NFiY73TLBKFZ9sR9voGoRKmwo6xyEu0cGZniNtSZAxfO2TZZVtCdJQ== X-Received: by 2002:ac8:5b96:0:b0:3bf:c9d1:4276 with SMTP id a22-20020ac85b96000000b003bfc9d14276mr11467681qta.5.1679765638478; Sat, 25 Mar 2023 10:33:58 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:33:58 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Cc: rcu@vger.kernel.org Subject: [PATCH v2 06/13] rcu: Fix set/clear TICK_DEP_BIT_RCU_EXP bitmask race Date: Sat, 25 Mar 2023 17:33:09 +0000 Message-Id: <20230325173316.3118674-7-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zqiang For kernels built with CONFIG_NO_HZ_FULL=3Dy, the following scenario can re= sult in the scheduling-clock interrupt remaining enabled on a holdout CPU after its quiescent state has been reported: CPU1 CPU2 rcu_report_exp_cpu_mult synchronize_rcu_expedited_= wait acquires rnp->lock mask =3D rnp->expmask; for_each_leaf_node_cpu_= mask(rnp, cpu, mask) rnp->expmask =3D rnp->expmask & ~mask; rdp =3D per_cpu_pt= r(&rcu_data, cpu1); for_each_leaf_node_cpu_mask(rnp, cpu, mask) rdp =3D per_cpu_ptr(&rcu_data, cpu1); if (!rdp->rcu_forced_tick_exp) continue; rdp->rcu_forced_tick= _exp =3D true; tick_dep_set_cpu(cpu= 1, TICK_DEP_BIT_RCU_EXP); The problem is that CPU2's sampling of rnp->expmask is obsolete by the time it invokes tick_dep_set_cpu(), and CPU1 is not guaranteed to see CPU2's store to ->rcu_forced_tick_exp in time to clear it. And even if CPU1 does see that store, it might invoke tick_dep_clear_cpu() before CPU2 got around to executing its tick_dep_set_cpu(), which would still leave the victim CPU with its scheduler-clock tick running. Either way, an nohz_full real-time application running on the victim CPU would have its latency needlessly degraded. Note that expedited RCU grace periods look at context-tracking information, and so if the CPU is executing in nohz_full usermode throughout, that CPU cannot be victimized in this manner. This commit therefore causes synchronize_rcu_expedited_wait to hold the rcu_node structure's ->lock when checking for holdout CPUs, setting TICK_DEP_BIT_RCU_EXP, and invoking tick_dep_set_cpu(), thus preventing this race. Signed-off-by: Zqiang Reviewed-by: Frederic Weisbecker Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree_exp.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index 249c2967d9e6..7cc4856da081 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -594,6 +594,7 @@ static void synchronize_rcu_expedited_wait(void) struct rcu_data *rdp; struct rcu_node *rnp; struct rcu_node *rnp_root =3D rcu_get_root(); + unsigned long flags; =20 trace_rcu_exp_grace_period(rcu_state.name, rcu_exp_gp_seq_endval(), TPS("= startwait")); jiffies_stall =3D rcu_exp_jiffies_till_stall_check(); @@ -602,17 +603,17 @@ static void synchronize_rcu_expedited_wait(void) if (synchronize_rcu_expedited_wait_once(1)) return; rcu_for_each_leaf_node(rnp) { + raw_spin_lock_irqsave_rcu_node(rnp, flags); mask =3D READ_ONCE(rnp->expmask); for_each_leaf_node_cpu_mask(rnp, cpu, mask) { rdp =3D per_cpu_ptr(&rcu_data, cpu); if (rdp->rcu_forced_tick_exp) continue; rdp->rcu_forced_tick_exp =3D true; - preempt_disable(); if (cpu_online(cpu)) tick_dep_set_cpu(cpu, TICK_DEP_BIT_RCU_EXP); - preempt_enable(); } + raw_spin_unlock_irqrestore_rcu_node(rnp, flags); } j =3D READ_ONCE(jiffies_till_first_fqs); if (synchronize_rcu_expedited_wait_once(j + HZ)) --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 4A63FC6FD20 for ; Sat, 25 Mar 2023 17:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231404AbjCYRe0 (ORCPT ); Sat, 25 Mar 2023 13:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231801AbjCYReG (ORCPT ); Sat, 25 Mar 2023 13:34:06 -0400 Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5458E3A1 for ; Sat, 25 Mar 2023 10:34:00 -0700 (PDT) Received: by mail-qv1-xf29.google.com with SMTP id m16so3708014qvi.12 for ; Sat, 25 Mar 2023 10:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765640; 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=WkqhMIgatpcxnL+zHWHZ8wmMPBfEMgxQ9GLo+81Qz2Y=; b=urQ3eGiSW39KOAg6HtdLQrdsQBhLE8fe/4vhcVkRPGPen+juA88G3/CNjtLggI5yz+ /Hsq3yl9CS37DT4iPWQayHWqbtRy9ZytQ8GAhvPbolMecAoOjwgCOLok1U+uYBLXNFGT fF2bATwed5QWM3wvD1atFjToYeb3jtgI3zZSQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765640; 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=WkqhMIgatpcxnL+zHWHZ8wmMPBfEMgxQ9GLo+81Qz2Y=; b=b9OmN0FfC+lJeTNdF24o1YooetMMrcOod7dB/w2EJElz6Pe9ORgHFRmIr4xr0PXQJP NqksVOhRng5WReSUNLkaWN6FS+rsU2+l9/ApdCEdixK9NTw6ArCmCvODZHVv2gGeRNbc FWgDKVzYYhfZ8ghPGO1hbU9+i/awX0AgdHcnLkoZPweHFEziRmCGqn73O45jmBSZIK6a UVRttUCecPShNsi8Qv7XpO9/G7FZwIiaLk6zkpqoUwqFFGoXSwKULdvUy9Ikk6er9vt9 +sQNxnSJz8q7VdqHLOhdli7VQbg01s3puQs9dM0HFGg/w0xyZgY3fFv6KmVM36tDak5/ iigA== X-Gm-Message-State: AAQBX9cZxF6/QKUch2UlxH7zAi0gm65YXz7Mn5C9CgBKSEB+QPAYBiDZ luc5/hbt1imU2jOLGgKUPUS6rOgOhxStnl70HRg= X-Google-Smtp-Source: AKy350aHEmw9YFemES+YvWFbuHmTRQ1f6F/yTZi3NzBEEE4hql5/JbCy7XCBFuSVU3Z1xg6Fl0ubRA== X-Received: by 2002:a05:6214:27c6:b0:574:97e9:e21c with SMTP id ge6-20020a05621427c600b0057497e9e21cmr11359421qvb.4.1679765639777; Sat, 25 Mar 2023 10:33:59 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:33:59 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Frederic Weisbecker , Thomas Gleixner , Ingo Molnar , "Paul E. McKenney" Cc: Zqiang , Anna-Maria Behnsen , Frederic Weisbecker , Joel Fernandes , linux-trace-kernel@vger.kernel.org Subject: [PATCH v2 07/13] rcu: Fix missing TICK_DEP_MASK_RCU_EXP dependency check Date: Sat, 25 Mar 2023 17:33:10 +0000 Message-Id: <20230325173316.3118674-8-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zqiang This commit adds checks for the TICK_DEP_MASK_RCU_EXP bit, thus enabling RCU expedited grace periods to actually force-enable scheduling-clock interrupts on holdout CPUs. Fixes: df1e849ae455 ("rcu: Enable tick for nohz_full CPUs slow to provide e= xpedited QS") Signed-off-by: Zqiang Cc: Steven Rostedt Cc: Masami Hiramatsu Cc: Frederic Weisbecker Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Anna-Maria Behnsen Acked-by: Frederic Weisbecker Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- include/trace/events/timer.h | 3 ++- kernel/time/tick-sched.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index 2e713a7d9aa3..3e8619c72f77 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h @@ -371,7 +371,8 @@ TRACE_EVENT(itimer_expire, tick_dep_name(PERF_EVENTS) \ tick_dep_name(SCHED) \ tick_dep_name(CLOCK_UNSTABLE) \ - tick_dep_name_end(RCU) + tick_dep_name(RCU) \ + tick_dep_name_end(RCU_EXP) =20 #undef tick_dep_name #undef tick_dep_mask_name diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 68d81a4283c8..a46506f7ec6d 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -281,6 +281,11 @@ static bool check_tick_dependency(atomic_t *dep) return true; } =20 + if (val & TICK_DEP_MASK_RCU_EXP) { + trace_tick_stop(0, TICK_DEP_MASK_RCU_EXP); + return true; + } + return false; } =20 --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 379B5C6FD20 for ; Sat, 25 Mar 2023 17:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232002AbjCYRea (ORCPT ); Sat, 25 Mar 2023 13:34:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231737AbjCYReH (ORCPT ); Sat, 25 Mar 2023 13:34:07 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BAE4C677 for ; Sat, 25 Mar 2023 10:34:02 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id ga7so4521000qtb.2 for ; Sat, 25 Mar 2023 10:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765641; 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=QyrXPYue4+kcgnuVhPQbl4hTj4jaTNBfGwV5VXHSeY8=; b=wY7sjFYpq8YfHJuBRa5ndpAjxilKOxdXrz02f1B0SQldgeClltUK0+9Vtv54p+zDPm dRF+8T5ZRft8VqUNlEvzSiiq2rG7I7wFmObEc8Dm9u9xHEzCF0D2P+oJfF8dJ3lmlyql fjeWspj+q+fR+IxsTM6N1CXB47IUmZZ28GsLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765641; 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=QyrXPYue4+kcgnuVhPQbl4hTj4jaTNBfGwV5VXHSeY8=; b=uns0RzxwYOOSLvPOkMdBv2ur2/arKPuhAnSygHNBECxdsXzZlbiSuXiR+nPVfNY4V3 RJwKNudOBmp+glxoojTwwqKyLQp/t840iPsgnb4MS1CPVPU0w9a6Fd0whdgf2OQyd5K7 BKmZwSfwsZKC6ZIRHcxd85HZCB3Hajod+XEbOqfxqB7krEXfzztTeLVb2BTzNTx2gpu5 9oZfiKXtMOYjlbxxPw9gy9GqfPBu+59HGkSVcpvToeRpS9xhU2oQoswNywHGekPrV7J4 z4K5c4LYfklt5WVXNLIi/zp7kX4zrFEgix54hLdrupQuICZG3ajwCJgNJnKgmuX1QOIs kXWw== X-Gm-Message-State: AO0yUKW7Qn2O8Yb/vjWUHJW5z/3Lg3msjDMatWnCVrwoQNTaBsPHCXs3 rvDHJoZfh3e7g+59lHKFihTsF/W4GwIXMQWt7r0= X-Google-Smtp-Source: AK7set9Jlw5IeClQNc9dTI42kGK/qMIDrAXw7kkLsJ9JP3829DzmHHgq2Y4Qu45ppUcd1z+iFWox1w== X-Received: by 2002:a05:622a:1749:b0:3e3:a298:7928 with SMTP id l9-20020a05622a174900b003e3a2987928mr12730734qtk.9.1679765640939; Sat, 25 Mar 2023 10:34:00 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:34:00 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Cc: rcu@vger.kernel.org Subject: [PATCH v2 08/13] rcu: Register rcu-lazy shrinker only for CONFIG_RCU_LAZY=y kernels Date: Sat, 25 Mar 2023 17:33:11 +0000 Message-Id: <20230325173316.3118674-9-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zqiang The lazy_rcu_shrink_count() shrinker function is registered even in kernels built with CONFIG_RCU_LAZY=3Dn, in which case this function uselessly consumes cycles learning that no CPU has any lazy callbacks queued. This commit therefore registers this shrinker function only in the kernels built with CONFIG_RCU_LAZY=3Dy, where it might actually do something useful. Signed-off-by: Zqiang Reviewed-by: Frederic Weisbecker Reviewed-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree_nocb.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h index 9e1c8caec5ce..f2280616f9d5 100644 --- a/kernel/rcu/tree_nocb.h +++ b/kernel/rcu/tree_nocb.h @@ -1312,6 +1312,7 @@ int rcu_nocb_cpu_offload(int cpu) } EXPORT_SYMBOL_GPL(rcu_nocb_cpu_offload); =20 +#ifdef CONFIG_RCU_LAZY static unsigned long lazy_rcu_shrink_count(struct shrinker *shrink, struct shrink_control *sc) { @@ -1360,6 +1361,7 @@ static struct shrinker lazy_rcu_shrinker =3D { .batch =3D 0, .seeks =3D DEFAULT_SEEKS, }; +#endif // #ifdef CONFIG_RCU_LAZY =20 void __init rcu_init_nohz(void) { @@ -1391,8 +1393,10 @@ void __init rcu_init_nohz(void) if (!rcu_state.nocb_is_setup) return; =20 +#ifdef CONFIG_RCU_LAZY if (register_shrinker(&lazy_rcu_shrinker, "rcu-lazy")) pr_err("Failed to register lazy_rcu shrinker!\n"); +#endif // #ifdef CONFIG_RCU_LAZY =20 if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) { pr_info("\tNote: kernel parameter 'rcu_nocbs=3D', 'nohz_full', or 'isolc= pus=3D' contains nonexistent CPUs.\n"); --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 E94C1C6FD1F for ; Sat, 25 Mar 2023 17:34:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbjCYRed (ORCPT ); Sat, 25 Mar 2023 13:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231771AbjCYReH (ORCPT ); Sat, 25 Mar 2023 13:34:07 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1EA3CA37 for ; Sat, 25 Mar 2023 10:34:02 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id a5so4504496qto.6 for ; Sat, 25 Mar 2023 10:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765642; 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=QibGVAzBv0gTWQqE5TFgxflup7tk3PummO3A7I5nlFU=; b=Bitiwir0A9IEj0P20k33ypH0Yu5zV4sW3y+VbbmcQ3jA6Nw5b2VS13k98mZrzbC630 re3JkfEMsrpKvdzMDtvWdQOgOvAHYSdj4qWTk+3WFFSEZJYUii/o8lbJ/uIyU9P+yTcs eil2loMErO49vAu9dR/zDfZq5DfkTdczeMp8c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765642; 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=QibGVAzBv0gTWQqE5TFgxflup7tk3PummO3A7I5nlFU=; b=fhJPHnbP5J3nhg0Wl2qNoAAsmoLgeqGzojhPuU0gnF1UsPbBCqwZ7QarlCXyZNdq6x PeGxkscdx7MWlst1QNgQaKuHm8LEIjnUOsy0Ry+1GwT73x59odJFhEnFEadZ5nms4TVf JxBxZiKC2tlKQagMnwoAhg4VdQGdm9ovCt8gBrzdm5bImd4x11ZCOQmyioim1aXqdTB5 DM8z5upX3+eDJ/yn7rrJM0PMWeyE8M/wB5XcqC0TBbr8GFDeGm7eDi4191gktwbuE4eY 5t4jicTnbDetC1q2IMREZFVbJb9sPQpkmfQbc0hva+y8nZ5IA/sX3lZarhfbMqIM99NY tSOg== X-Gm-Message-State: AAQBX9el5uGthstIYTyFAWYnycyOignSU/G63aXqrsI73Uw0MamFfs/W g4t6vf5vQ5akz6PEAGh0XD7c/NqPpeDtbbmKgww= X-Google-Smtp-Source: AK7set/c+utZD7KsGUN+joNbxXwpbhjNKkljJ/zT/1BqFUiu6jbDVCKWmia3xO9V96K6lYkSph7hzA== X-Received: by 2002:ac8:7c48:0:b0:3e3:8bcd:23cb with SMTP id o8-20020ac87c48000000b003e38bcd23cbmr10851438qtv.29.1679765642081; Sat, 25 Mar 2023 10:34:02 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:34:01 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Cc: rcu@vger.kernel.org Subject: [PATCH v2 09/13] rcu: Remove never-set needwake assignment from rcu_report_qs_rdp() Date: Sat, 25 Mar 2023 17:33:12 +0000 Message-Id: <20230325173316.3118674-10-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zqiang The rcu_accelerate_cbs() function is invoked by rcu_report_qs_rdp() only if there is a grace period in progress that is still blocked by at least one CPU on this rcu_node structure. This means that rcu_accelerate_cbs() should never return the value true, and thus that this function should never set the needwake variable and in turn never invoke rcu_gp_kthread_wake(). This commit therefore removes the needwake variable and the invocation of rcu_gp_kthread_wake() in favor of a WARN_ON_ONCE() on the call to rcu_accelerate_cbs(). The purpose of this new WARN_ON_ONCE() is to detect situations where the system's opinion differs from ours. Signed-off-by: Zqiang Reviewed-by: Frederic Weisbecker Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 8e880c09ab59..e80e8f128c57 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -1955,7 +1955,6 @@ rcu_report_qs_rdp(struct rcu_data *rdp) { unsigned long flags; unsigned long mask; - bool needwake =3D false; bool needacc =3D false; struct rcu_node *rnp; =20 @@ -1987,7 +1986,12 @@ rcu_report_qs_rdp(struct rcu_data *rdp) * NOCB kthreads have their own way to deal with that... */ if (!rcu_rdp_is_offloaded(rdp)) { - needwake =3D rcu_accelerate_cbs(rnp, rdp); + /* + * The current GP has not yet ended, so it + * should not be possible for rcu_accelerate_cbs() + * to return true. So complain, but don't awaken. + */ + WARN_ON_ONCE(rcu_accelerate_cbs(rnp, rdp)); } else if (!rcu_segcblist_completely_offloaded(&rdp->cblist)) { /* * ...but NOCB kthreads may miss or delay callbacks acceleration @@ -1999,8 +2003,6 @@ rcu_report_qs_rdp(struct rcu_data *rdp) rcu_disable_urgency_upon_qs(rdp); rcu_report_qs_rnp(mask, rnp, rnp->gp_seq, flags); /* ^^^ Released rnp->lock */ - if (needwake) - rcu_gp_kthread_wake(); =20 if (needacc) { rcu_nocb_lock_irqsave(rdp, flags); --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 2C204C6FD20 for ; Sat, 25 Mar 2023 17:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232060AbjCYReh (ORCPT ); Sat, 25 Mar 2023 13:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231825AbjCYReK (ORCPT ); Sat, 25 Mar 2023 13:34:10 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4E71DBE6 for ; Sat, 25 Mar 2023 10:34:04 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id hf2so4509967qtb.3 for ; Sat, 25 Mar 2023 10:34:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765643; 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=Q6C53sn27NuA32AX3ykr9qVTka3YNyXyLo2FHjcHAPk=; b=yhQE5JitzdBNkzY0TYfTzuvOS/VKmMwn5KP2dPiUdYcgdHLPrmvZZ6Np/lG32lNBAd lt9VxOLDD0Yxnj/P9thYO1M/R2JLG12ggb55LdZcQNrb8ZOv8E4OD9ybmGmBVQE7U7t4 vwfVjwDCDMeJ7G6L/7UIbp5+MZFMuw6ebBtYE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765643; 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=Q6C53sn27NuA32AX3ykr9qVTka3YNyXyLo2FHjcHAPk=; b=7WwpDyrLFOfMLgWrQAQlGTo1rw2TUDwi38VlDwa518KblppmfGfe89W7ADL0VrRlfn InKrXwjINnjLNfaIiujwGVu76Ghg9JREVZjKZL7kDnyVPPPs4evSLVTS2VW0PIpRu7YD DaiiKSe+7LAmYluh8PGehrpyonJ72bJz6uXRpfZlL5R5YSYic++RKZ682LKGqQzngoVp eVtH94aFfgqwFHLi3fABlvF4bTygDk5/hLVr2V/kmAovPGFqey/CO/uzfm5cAcK9c3gv EH0WLE/71ZUlPEZ0d5wctPQzE/7nCPENEsYNHkpqmZM07pg6y0T1IYKdi5E/zDuDBApA t03Q== X-Gm-Message-State: AO0yUKUh42FFaj0pHOuF7KpBk2cUED/zde7f5MVvmFnJV/0xglbhhIR/ mTyUKinMilASvDZQ/TXjuEiw9g/DtltplRi9TlI= X-Google-Smtp-Source: AK7set/kBRoccFhabLv3Raii1q34w76PXtiC0I5XZu7Br5sHC8TyaR8GiL2D8zsuukPc+azN0dL7kw== X-Received: by 2002:ac8:5787:0:b0:3e3:98af:5de9 with SMTP id v7-20020ac85787000000b003e398af5de9mr12140109qta.63.1679765643455; Sat, 25 Mar 2023 10:34:03 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:34:03 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Cc: rcu@vger.kernel.org Subject: [PATCH v2 10/13] rcu: Permit start_poll_synchronize_rcu_expedited() to be invoked early Date: Sat, 25 Mar 2023 17:33:13 +0000 Message-Id: <20230325173316.3118674-11-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zqiang According to the commit log of the patch that added it to the kernel, start_poll_synchronize_rcu_expedited() can be invoked very early, as in long before rcu_init() has been invoked. But before rcu_init(), the rcu_data structure's ->mynode field has not yet been initialized. This means that the start_poll_synchronize_rcu_expedited() function's attempt to set the CPU's leaf rcu_node structure's ->exp_seq_poll_rq field will result in a segmentation fault. This commit therefore causes start_poll_synchronize_rcu_expedited() to set ->exp_seq_poll_rq only after rcu_init() has initialized all CPUs' rcu_data structures' ->mynode fields. It also removes the check from the rcu_init() function so that start_poll_synchronize_rcu_expedited( is unconditionally invoked. Yes, this might result in an unnecessary boot-time grace period, but this is down in the noise. Signed-off-by: Zqiang Reviewed-by: Frederic Weisbecker Reviewed-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 5 ++--- kernel/rcu/tree_exp.h | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index e80e8f128c57..90d54571126a 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -4942,9 +4942,8 @@ void __init rcu_init(void) else qovld_calc =3D qovld; =20 - // Kick-start any polled grace periods that started early. - if (!(per_cpu_ptr(&rcu_data, cpu)->mynode->exp_seq_poll_rq & 0x1)) - (void)start_poll_synchronize_rcu_expedited(); + // Kick-start in case any polled grace periods started early. + (void)start_poll_synchronize_rcu_expedited(); =20 rcu_test_sync_prims(); } diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index 7cc4856da081..5343f32e7d67 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -1066,9 +1066,10 @@ unsigned long start_poll_synchronize_rcu_expedited(v= oid) if (rcu_init_invoked()) raw_spin_lock_irqsave(&rnp->exp_poll_lock, flags); if (!poll_state_synchronize_rcu(s)) { - rnp->exp_seq_poll_rq =3D s; - if (rcu_init_invoked()) + if (rcu_init_invoked()) { + rnp->exp_seq_poll_rq =3D s; queue_work(rcu_gp_wq, &rnp->exp_poll_wq); + } } if (rcu_init_invoked()) raw_spin_unlock_irqrestore(&rnp->exp_poll_lock, flags); --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 69B65C76196 for ; Sat, 25 Mar 2023 17:34:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232110AbjCYRej (ORCPT ); Sat, 25 Mar 2023 13:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231853AbjCYReL (ORCPT ); Sat, 25 Mar 2023 13:34:11 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D62AEF81 for ; Sat, 25 Mar 2023 10:34:06 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id a5so4504568qto.6 for ; Sat, 25 Mar 2023 10:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765645; 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=kDgsb2d+hZmc+VQbS7ffR7EbpJzTOYghTZrLGYmTtWc=; b=jhaF7jMZ0YB7rLiRDFZrRklRXt1OS7zPKXAlOrC6Ofk00510pCD4FnDFVqfLxhpUjD BgjbV9/qa/zMtSEVZ9i8O8NwPGlXueA5d8pnRbjRaOifUjtUqVzrrbg4wXpX7QQON0Ga h2cXsbZfUrcDoLDyKLO+AqiHanYO7hZFWtMyw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765645; 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=kDgsb2d+hZmc+VQbS7ffR7EbpJzTOYghTZrLGYmTtWc=; b=8H2J6UvxKzQ93HcuDsCJtDMntn6PBbTMp8qWY4bX/oaGi4lL208vf4CtGWEtp41GWl PnUielnDXc0VYC8R9aUFkKqndj/YrT/vSDxfnPjgChXCflNsl0Y7d7cfk9MRRWMFCx7S 63xmFMk44HIy1a6BQTH7DTDf13feru2YTepJDmlrK+cZWTKH9obqf/APRgyu3HnIs3Zj PQLAhs521cQ5fkdcEJhEbf+Vtmy+i+whWbMTcOCqjPuL7f7+4rP2oXr3hGM4XcratE/I zWR+/x1G5Di3JBk6qMuQPJfMGgQm55VzVdR+G6P5BMwnPhj4i9ZJ5X5QIftC25ruV1nA ZbzQ== X-Gm-Message-State: AO0yUKVDpcNbnsiUWYZPpwJ0Ns+sV5sxtivEl1tKVBDcvtXe5eXq1Bkp r5q1f05TFYV96z65xUXusjzv/UYY8PgS1/vaHfM= X-Google-Smtp-Source: AKy350ZKIT2t3gxR4Zylf8zYlF3puKJt9xTfHezSW7rx/lBHNOBE+j7Z/Q9dY0lrU51bFaQa0S0IRA== X-Received: by 2002:ac8:5755:0:b0:3e1:7465:91f5 with SMTP id 21-20020ac85755000000b003e1746591f5mr12423604qtx.10.1679765644872; Sat, 25 Mar 2023 10:34:04 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:34:04 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Cc: Mark Brown , rcu@vger.kernel.org Subject: [PATCH v2 11/13] rcu-tasks: Report stalls during synchronize_srcu() in rcu_tasks_postscan() Date: Sat, 25 Mar 2023 17:33:14 +0000 Message-Id: <20230325173316.3118674-12-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Neeraj Upadhyay The call to synchronize_srcu() from rcu_tasks_postscan() can be stalled by a task getting stuck in do_exit() between that function's calls to exit_tasks_rcu_start() and exit_tasks_rcu_finish(). To ease diagnosis of this situation, print a stall warning message every rcu_task_stall_info period when rcu_tasks_postscan() is stalled. [ paulmck: Adjust to handle CONFIG_SMP=3Dn. ] Reported-by: Mark Brown Link: https://lore.kernel.org/rcu/20230111212736.GA1062057@paulmck-ThinkPad= -P17-Gen-1/ Signed-off-by: Neeraj Upadhyay Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) Acked-by: Frederic Weisbecker --- kernel/rcu/tasks.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index bfb5e1549f2b..baf7ec178155 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -139,6 +139,12 @@ static struct rcu_tasks rt_name =3D \ /* Track exiting tasks in order to allow them to be waited for. */ DEFINE_STATIC_SRCU(tasks_rcu_exit_srcu); =20 +#ifdef CONFIG_TASKS_RCU +/* Report delay in synchronize_srcu() completion in rcu_tasks_postscan(). = */ +static void tasks_rcu_exit_srcu_stall(struct timer_list *unused); +static DEFINE_TIMER(tasks_rcu_exit_srcu_stall_timer, tasks_rcu_exit_srcu_s= tall); +#endif + /* Avoid IPIing CPUs early in the grace period. */ #define RCU_TASK_IPI_DELAY (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB) ? H= Z / 2 : 0) static int rcu_task_ipi_delay __read_mostly =3D RCU_TASK_IPI_DELAY; @@ -830,6 +836,13 @@ static void rcu_tasks_pertask(struct task_struct *t, s= truct list_head *hop) /* Processing between scanning taskslist and draining the holdout list. */ static void rcu_tasks_postscan(struct list_head *hop) { + int rtsi =3D READ_ONCE(rcu_task_stall_info); + + if (!IS_ENABLED(CONFIG_TINY_RCU)) { + tasks_rcu_exit_srcu_stall_timer.expires =3D jiffies + rtsi; + add_timer(&tasks_rcu_exit_srcu_stall_timer); + } + /* * Exiting tasks may escape the tasklist scan. Those are vulnerable * until their final schedule() with TASK_DEAD state. To cope with @@ -848,6 +861,9 @@ static void rcu_tasks_postscan(struct list_head *hop) * call to synchronize_rcu(). */ synchronize_srcu(&tasks_rcu_exit_srcu); + + if (!IS_ENABLED(CONFIG_TINY_RCU)) + del_timer_sync(&tasks_rcu_exit_srcu_stall_timer); } =20 /* See if tasks are still holding out, complain if so. */ @@ -923,6 +939,21 @@ static void rcu_tasks_postgp(struct rcu_tasks *rtp) void call_rcu_tasks(struct rcu_head *rhp, rcu_callback_t func); DEFINE_RCU_TASKS(rcu_tasks, rcu_tasks_wait_gp, call_rcu_tasks, "RCU Tasks"= ); =20 +static void tasks_rcu_exit_srcu_stall(struct timer_list *unused) +{ +#ifndef CONFIG_TINY_RCU + int rtsi; + + rtsi =3D READ_ONCE(rcu_task_stall_info); + pr_info("%s: %s grace period number %lu (since boot) gp_state: %s is %lu = jiffies old.\n", + __func__, rcu_tasks.kname, rcu_tasks.tasks_gp_seq, + tasks_gp_state_getname(&rcu_tasks), jiffies - rcu_tasks.gp_jiffies); + pr_info("Please check any exiting tasks stuck between calls to exit_tasks= _rcu_start() and exit_tasks_rcu_finish()\n"); + tasks_rcu_exit_srcu_stall_timer.expires =3D jiffies + rtsi; + add_timer(&tasks_rcu_exit_srcu_stall_timer); +#endif // #ifndef CONFIG_TINY_RCU +} + /** * call_rcu_tasks() - Queue an RCU for invocation task-based grace period * @rhp: structure to be used for queueing the RCU updates. --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 AE63CC6FD1C for ; Sat, 25 Mar 2023 17:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232128AbjCYReo (ORCPT ); Sat, 25 Mar 2023 13:34:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbjCYReO (ORCPT ); Sat, 25 Mar 2023 13:34:14 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC35FEF90 for ; Sat, 25 Mar 2023 10:34:06 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id r5so4507289qtp.4 for ; Sat, 25 Mar 2023 10:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765646; 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=8qmbLy4FeD1wXnpI5jFiDQ+/P/XNzoLaPeANuPc2CnI=; b=EMuepLXHAx1qWBBkKwrBLaXDPtiy7wo5Nx6Gbt+/79BQ1l1YhLOKw+DvIsAKNacCVV XLEvZQXEJVNl4Wt9PIGjTLoHgIxkQUfoyMmJqKf0/PvCUQ5q//7G/zQHgcKYkDUfFB7s C8yPwfoLXSJEB9JPxc1hkYf/Gi+q1qB5Gu24U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765646; 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=8qmbLy4FeD1wXnpI5jFiDQ+/P/XNzoLaPeANuPc2CnI=; b=hhfoVD1Qqsfw9ZFL37ZzRlLjfRgK7Kqh3p2wlhY2GSEVEi/lrFNf2J3uT5mzDyejjf WjzAzbMk3cgIwYnP5uUYoX0C0b2nGFN//j56qn8rqou7oru5oOwUJlAgOfb51HlV63rU EbC5EgoPDM4zyEpghRFXLweke63Ochrhz7hmQCk2cxLLY7WhWcjfRloq9I5myv18qpIJ CHQgtT34v2Ie/32jTiuPkvq00hreCtFtb8c01cWGxMGYRURC11yp1YccGdoaERL6z5+p Up/1gad80B7fn3VR4476pndJYoi9ZpKBnVXUggCAJ5VwEP7aacuY+3VmF+26LUeHNJUz e7gQ== X-Gm-Message-State: AO0yUKXiJ2Mk9Wf9+LOzB7v18ey5sA7iEvBFhGJlgMkbyQAer+vDcQb+ nF1/MQBSQ2uJCDW8IqfZ137XPphfczcPXh86upQ= X-Google-Smtp-Source: AK7set8gLQCta4FYIlst2AUFh/hE7rHGLWZ46fe8EwGZn7VJz0oJc9ujYIdovRFZpYujEKW41/8PTg== X-Received: by 2002:a05:622a:88:b0:3dd:a703:f7df with SMTP id o8-20020a05622a008800b003dda703f7dfmr12570788qtw.2.1679765646066; Sat, 25 Mar 2023 10:34:06 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:34:05 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Thomas Gleixner , Ingo Molnar Cc: Zheng Yejian , stable@vger.kernel.org, rcu@vger.kernel.org Subject: [PATCH v2 12/13] rcu: Avoid stack overflow due to __rcu_irq_enter_check_tick() being kprobe-ed Date: Sat, 25 Mar 2023 17:33:15 +0000 Message-Id: <20230325173316.3118674-13-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheng Yejian Registering a kprobe on __rcu_irq_enter_check_tick() can cause kernel stack overflow as shown below. This issue can be reproduced by enabling CONFIG_NO_HZ_FULL and booting the kernel with argument "nohz_full=3D", and then giving the following commands at the shell prompt: # cd /sys/kernel/tracing/ # echo 'p:mp1 __rcu_irq_enter_check_tick' >> kprobe_events # echo 1 > events/kprobes/enable This commit therefore adds __rcu_irq_enter_check_tick() to the kprobes blacklist using NOKPROBE_SYMBOL(). Insufficient stack space to handle exception! ESR: 0x00000000f2000004 -- BRK (AArch64) FAR: 0x0000ffffccf3e510 Task stack: [0xffff80000ad30000..0xffff80000ad38000] IRQ stack: [0xffff800008050000..0xffff800008058000] Overflow stack: [0xffff089c36f9f310..0xffff089c36fa0310] CPU: 5 PID: 190 Comm: bash Not tainted 6.2.0-rc2-00320-g1f5abbd77e2c #19 Hardware name: linux,dummy-virt (DT) pstate: 400003c5 (nZcv DAIF -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : __rcu_irq_enter_check_tick+0x0/0x1b8 lr : ct_nmi_enter+0x11c/0x138 sp : ffff80000ad30080 x29: ffff80000ad30080 x28: ffff089c82e20000 x27: 0000000000000000 x26: 0000000000000000 x25: ffff089c02a8d100 x24: 0000000000000000 x23: 00000000400003c5 x22: 0000ffffccf3e510 x21: ffff089c36fae148 x20: ffff80000ad30120 x19: ffffa8da8fcce148 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: ffffa8da8e44ea6c x14: ffffa8da8e44e968 x13: ffffa8da8e03136c x12: 1fffe113804d6809 x11: ffff6113804d6809 x10: 0000000000000a60 x9 : dfff800000000000 x8 : ffff089c026b404f x7 : 00009eec7fb297f7 x6 : 0000000000000001 x5 : ffff80000ad30120 x4 : dfff800000000000 x3 : ffffa8da8e3016f4 x2 : 0000000000000003 x1 : 0000000000000000 x0 : 0000000000000000 Kernel panic - not syncing: kernel stack overflow CPU: 5 PID: 190 Comm: bash Not tainted 6.2.0-rc2-00320-g1f5abbd77e2c #19 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0xf8/0x108 show_stack+0x20/0x30 dump_stack_lvl+0x68/0x84 dump_stack+0x1c/0x38 panic+0x214/0x404 add_taint+0x0/0xf8 panic_bad_stack+0x144/0x160 handle_bad_stack+0x38/0x58 __bad_stack+0x78/0x7c __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 [...] el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 el1_interrupt+0x28/0x60 el1h_64_irq_handler+0x18/0x28 el1h_64_irq+0x64/0x68 __ftrace_set_clr_event_nolock+0x98/0x198 __ftrace_set_clr_event+0x58/0x80 system_enable_write+0x144/0x178 vfs_write+0x174/0x738 ksys_write+0xd0/0x188 __arm64_sys_write+0x4c/0x60 invoke_syscall+0x64/0x180 el0_svc_common.constprop.0+0x84/0x160 do_el0_svc+0x48/0xe8 el0_svc+0x34/0xd0 el0t_64_sync_handler+0xb8/0xc0 el0t_64_sync+0x190/0x194 SMP: stopping secondary CPUs Kernel Offset: 0x28da86000000 from 0xffff800008000000 PHYS_OFFSET: 0xfffff76600000000 CPU features: 0x00000,01a00100,0000421b Memory Limit: none Link: https://lore.kernel.org/all/20221119040049.795065-1-zhengyejian1@huaw= ei.com/ Fixes: aaf2bc50df1f ("rcu: Abstract out rcu_irq_enter_check_tick() from rcu= _nmi_enter()") Signed-off-by: Zheng Yejian Cc: stable@vger.kernel.org Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 90d54571126a..ee27a03d7576 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -640,6 +640,7 @@ void __rcu_irq_enter_check_tick(void) } raw_spin_unlock_rcu_node(rdp->mynode); } +NOKPROBE_SYMBOL(__rcu_irq_enter_check_tick); #endif /* CONFIG_NO_HZ_FULL */ =20 /* --=20 2.40.0.348.gf938b09366-goog From nobody Thu May 2 00:13:10 2024 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 0EF1EC6FD20 for ; Sat, 25 Mar 2023 17:34:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232140AbjCYReq (ORCPT ); Sat, 25 Mar 2023 13:34:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231297AbjCYReP (ORCPT ); Sat, 25 Mar 2023 13:34:15 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4503F766 for ; Sat, 25 Mar 2023 10:34:07 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id hf2so4510065qtb.3 for ; Sat, 25 Mar 2023 10:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1679765647; 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=ONoHk+Rj1ufMcYHSOwfNTPmuuZ3mXzko5D4ACMs/eOA=; b=ikQ37MdCcvJ+qjCxLa0DlYnQ1qgqtu0+7/KD0Bb/Tc4mBBI7pxErsaA3YnRKCfkpmX 3p0P+l2DU6LzWXS3KmQPuTqncSpWI/pcmz1ufIhInc5srxC3za/4WZhFXfWgLnnaNFNZ Nk9m6/9CnTBL+94W3Acb2UnO12oHOjCG9k8vg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679765647; 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=ONoHk+Rj1ufMcYHSOwfNTPmuuZ3mXzko5D4ACMs/eOA=; b=STnzC0mF87se/xSNANolFZg0MJGiFZUcTc36XrwcP3snXfKZJJIQjU57HCMnm/Y28U t4KgnfvIgh9p3q/kNox3aiEqLxO2fCWXmV6m6H0e1G/CLrG+yOrjNSLe61eKG8Y1Tb18 VLmWwUSv1JadBk73rUsxXSDyodU1JxktwIMxSn5cLav2zy3owqdwTejdxB/vA0fk3SLP 79vkGl7ztfU7uJOrZt0ul9T7RGVhRwCc6X4iFtAJDCHiJVOP6HztlneEEQm4hzjviWMx tW6jiCl8bxhvaDIZHS00lN8gdCPrvZhE9i1dJIOmnoxZNhFJzgoYHelzv32bykjzEgkh SMUg== X-Gm-Message-State: AAQBX9fDeLWJ5DKBBMxw5HkX+HKORx8A7Fv3VpoBRbZF5xdnBKP5gZpo ldVD0qZIC73EoP8QPp2Fp7AbOjCAx9G4TUMAwCo= X-Google-Smtp-Source: AKy350YEgc1Eq00eYoCtjBB7hMJjZEs/02/OUcwF5Nmwzwr8rFs2fkTW9CVn5OaLI4MsCVSYmWRBKw== X-Received: by 2002:a05:622a:1a0b:b0:3e4:dbaa:8a05 with SMTP id f11-20020a05622a1a0b00b003e4dbaa8a05mr4599709qtb.0.1679765647265; Sat, 25 Mar 2023 10:34:07 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id m4-20020ac84444000000b003e37ee54b5dsm6762764qtn.90.2023.03.25.10.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 10:34:06 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org, "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Cc: rcu@vger.kernel.org Subject: [PATCH v2 13/13] rcu: Protect rcu_print_task_exp_stall() ->exp_tasks access Date: Sat, 25 Mar 2023 17:33:16 +0000 Message-Id: <20230325173316.3118674-14-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org> References: <20230325173316.3118674-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zqiang For kernels built with CONFIG_PREEMPT_RCU=3Dy, the following scenario can result in a NULL-pointer dereference: CPU1 CPU2 rcu_preempt_deferred_qs_irqrestore rcu_print_task_exp_stall if (special.b.blocked) READ_ONCE(rnp->exp_task= s) !=3D NULL raw_spin_lock_rcu_node np =3D rcu_next_node_entry(t, rnp) if (&t->rcu_node_entry =3D=3D rnp->exp_tasks) WRITE_ONCE(rnp->exp_tasks, np) .... raw_spin_unlock_irqrestore_rcu_node raw_spin_lock_irqsave_r= cu_node t =3D list_entry(rnp->e= xp_tasks->prev, struct task_struct,= rcu_node_entry) (if rnp->exp_tasks is N= ULL, this will dereference a N= ULL pointer) The problem is that CPU2 accesses the rcu_node structure's->exp_tasks field without holding the rcu_node structure's ->lock and CPU2 did not observe CPU1's change to rcu_node structure's ->exp_tasks in time. Therefore, if CPU1 sets rcu_node structure's->exp_tasks pointer to NULL, then CPU2 might dereference that NULL pointer. This commit therefore holds the rcu_node structure's ->lock while accessing that structure's->exp_tasks field. [ paulmck: Apply Frederic Weisbecker feedback. ] Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree_exp.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index 5343f32e7d67..3b7abb58157d 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -803,9 +803,11 @@ static int rcu_print_task_exp_stall(struct rcu_node *r= np) int ndetected =3D 0; struct task_struct *t; =20 - if (!READ_ONCE(rnp->exp_tasks)) - return 0; raw_spin_lock_irqsave_rcu_node(rnp, flags); + if (!rnp->exp_tasks) { + raw_spin_unlock_irqrestore_rcu_node(rnp, flags); + return 0; + } t =3D list_entry(rnp->exp_tasks->prev, struct task_struct, rcu_node_entry); list_for_each_entry_continue(t, &rnp->blkd_tasks, rcu_node_entry) { --=20 2.40.0.348.gf938b09366-goog