[v3,rcu,10/11] srcu: Explain the reason behind the read side critical section on GP start
Message ID | 20221019225846.2501109-10-paulmck@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp574810wrs; Wed, 19 Oct 2022 16:01:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4w4M7jgZKd6x5T+VztufdPyMjea6K+aCaUhpsVBck2AvVc1HnXCJPFqnSGcaJOhcuHSt/n X-Received: by 2002:a05:6402:190f:b0:45d:2c25:3a1d with SMTP id e15-20020a056402190f00b0045d2c253a1dmr9841834edz.175.1666220488203; Wed, 19 Oct 2022 16:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666220488; cv=none; d=google.com; s=arc-20160816; b=cCtZKsantiK9CwfdMoN0mg8T3DmnzjzFXFkhdvKsRkQi0OMPI3UPv+FmFMaUZVuKD8 tKU4MTIKpSLQCT5MO5YRJcrhxtUz6U+zaoi5vhvv/GdvdmXiU6gI744xVd4kT7waf4eI NoUCbbtcpG7InmYhV1mao2dbMGzQyRtGDsYxVGSvGUWQxg641wNZQANIypIax09PBXrm YGce6Wlg5SzyYWI0vlZ/+Mb02X29lf6i/XWqoDxPHAxrEn1sW6ywSQB4dfXvIJkwbp/x lG4oOyJp9jAw1C1NIkBv6GkzT1+Sv/F2Cyqt7STz8K1hw48FHE4r3yNs4UN4huaGnH0F TEiA== 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=5ABMxQ8PFy2khu6uvyHYp+aMLoQBLJ9EGauB7WZlpCc=; b=waYMswfqCisfFmpvJcz6lJHI6d2EgQK1s+50A35A1lCVO86AahOrqwG4uQbUcLUI8l F0YSds+Mfo98g468Xjwe8cyBejuRE8ppUJB56Y8UWMRtmgVWfF2eRNbvKYw/EqjniDf8 g+uuCWmW09Ah9MfKCRVKcrzdDI4zztx3NDZROUAG44qI7pApMDJRsN6Qd8DDN4kj1zzX JC7T/hFWlwMtum6vfZj82YpMt50RxbiEjzwH75UUcuYNGI70pgSIGurXv0H0q5pT1fMS KaWgCWszEwF+G6lCEsLiAxXjoTnF08AMs0MEiskAf+fVSncfoqUSFoE/wqx1kyYxvNwz rcsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rrgNEcCv; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m2-20020a1709062ac200b0078da856a4ecsi12238263eje.391.2022.10.19.16.01.01; Wed, 19 Oct 2022 16:01:28 -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=@kernel.org header.s=k20201202 header.b=rrgNEcCv; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231294AbiJSW71 (ORCPT <rfc822;samuel.l.nystrom@gmail.com> + 99 others); Wed, 19 Oct 2022 18:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231375AbiJSW6z (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 19 Oct 2022 18:58:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D83A1CD688; Wed, 19 Oct 2022 15:58:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7DB39B82624; Wed, 19 Oct 2022 22:58:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59E48C4315B; Wed, 19 Oct 2022 22:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666220328; bh=Lw7Q0GwSzhjX27kJ3r/Pu5VkOmW/ZLbkQEvvvISFP7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrgNEcCvnt9q2Ei1GCPn0fArdrA82frgyah4oWktNFVTH01HA4b2GnkskY46J8peD 3AzWfEUiIuOHcksy1hvxYjs5auNbV0LjN2jRF7FgONsTlUYJ0yF5FPygzUThbcn/ks 5ngY96d2lwGndXGz5zEeYU5a1RnZk3ZkR0+MiAwZpgw/duszA+iyiaiyoXcGEPyBak tIAES6BW4ZKPKhINAaCaSllhJBB+B2+eYyjjFda7Ubsa/haPD+unNMQQKX+QtBP7v8 2ReYkEMsdLQBjt7RIVd9D2jqojVRVRuXEhk7qga4dvKR1vKaVdRbCs+uGCDGb9Td6p YUwBPwuuRZqoQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id BD0FC5C0D2B; Wed, 19 Oct 2022 15:58:47 -0700 (PDT) From: "Paul E. McKenney" <paulmck@kernel.org> To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, rostedt@goodmis.org, Frederic Weisbecker <frederic@kernel.org>, "Paul E . McKenney" <paulmck@kernel.org> Subject: [PATCH v3 rcu 10/11] srcu: Explain the reason behind the read side critical section on GP start Date: Wed, 19 Oct 2022 15:58:45 -0700 Message-Id: <20221019225846.2501109-10-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20221019225838.GA2500612@paulmck-ThinkPad-P17-Gen-1> References: <20221019225838.GA2500612@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747158814934961199?= X-GMAIL-MSGID: =?utf-8?q?1747158814934961199?= |
Series |
NMI-safe SRCU readers for v6.2
|
|
Commit Message
Paul E. McKenney
Oct. 19, 2022, 10:58 p.m. UTC
From: Frederic Weisbecker <frederic@kernel.org> Tell about the need to protect against concurrent updaters who may overflow the GP counter behind the current update. Reported-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> --- kernel/rcu/srcutree.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 18bb696cff8ca..272830a87e566 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -1158,6 +1158,11 @@ static unsigned long srcu_gp_start_if_needed(struct srcu_struct *ssp, int ss_state; check_init_srcu_struct(ssp); + /* + * While starting a new grace period, make sure we are in an + * SRCU read-side critical section so that the grace-period + * sequence number cannot wrap around in the meantime. + */ idx = __srcu_read_lock_nmisafe(ssp, false); ss_state = smp_load_acquire(&ssp->srcu_size_state); if (ss_state < SRCU_SIZE_WAIT_CALL)