Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3296747lqo; Wed, 15 May 2024 05:54:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUg+Jgcw9F6/Yl3GPQzMxzWJkllSbHi0tt9S7+qjh5ASWAnqY9pLA6F5OwBuTPManfUbveSjUvIWj4AJBDrDgTryWChqFjtn93AHgNhoQ== X-Google-Smtp-Source: AGHT+IGsOZrtlMj0pAMk/yzGrsxq6/SNuj17/jZAGRPKnfYOFWmQtInyXyshS1Z/GFRcfu8wNWti X-Received: by 2002:a17:90a:ea97:b0:2b5:9a4e:b19f with SMTP id 98e67ed59e1d1-2b6cc03f937mr13352108a91.3.1715777656526; Wed, 15 May 2024 05:54:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715777656; cv=pass; d=google.com; s=arc-20160816; b=WBR9/69EfEeYx3YABarWrThxxCEPCZsbkVaNdgUHYw1EqaMH3ZI43ifyLdeFtEAMNq uZRja3rMh0WAHWRZVrdfiQKL8cXMt84DYR4pniDj4XadD2FSIenh4J1jYX0h66jRX4DX EpOSx5mtKn4frEenV90JttMkQSb5og4L4BqjLMfCsN5bxt32T3+gzEySAOa25be2GPcH Q+w8BdR+xT4t3WmzSMY4+twjlhgTwk2zumtsimQAXuDtuRI3JnxsceoxAXQzp34P42G3 2D8quD4meo+DmOWAsE3d5A1hw7YPY76HgXk32dPXbE4GFgrxccmmfGYbElJh6MrMF0le XhUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xPLgVTBbDofnprBTgpPQSr8Q5ctRHAF+nUk1BA4Om0w=; fh=y7YWp49TGn1SKctwYHNRFImp1RqPEFQizTwe3vKGdPo=; b=k1/Gw7xpGHsslq375xkNb1hbTeEZwVQX2QFKVorbrLKdUvVv/meLsLqXpvMyffN7Sz zL468ox5IG9Krj4NjMgCOZH65zCGYW73q4j4xaqTtrxkZ/+CfdMXQIT+LDGA65GTfwIO z3AoPAMti4+s9wQwkJaegxChFq+EOB7ZyXS5a7DBpVcxRc+mj7viKX5pVsOE0dMhYeV2 CF4qzPmw4FjreiNriw/hwqn2Juxj89SN5lwoH+DSlH3kRRrBGV/MI2CHSJjxjF5XbtfI QhaPuht8sVtWkZUsz/TrKNwE6xInJddrsYvcPFB8q8SPhhwgSgHpvwAY2/iBEgK72brx P0fg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hiR9/Pvd"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b67168a1easi13675975a91.168.2024.05.15.05.54.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 05:54:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hiR9/Pvd"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6F052B20F47 for ; Wed, 15 May 2024 12:54:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25F4E128382; Wed, 15 May 2024 12:53:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hiR9/Pvd" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41BD8127E0A; Wed, 15 May 2024 12:53:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715777625; cv=none; b=Tp3BweMb8zXfHzB2/EpwMURWqkRA0Fy+YJdXw2UoSDApynJJoE7SspawQoGX2T7DJdiHPzfOGvKAU8sbNeWNIC13A4hBJBhvVW8v+WelGH36rzWWdce1EE/EmLJalcU8rhLDXTbSHEUWKuza8w0Cda0w3BQRTVNyNzue12iVohU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715777625; c=relaxed/simple; bh=MdzjiUsPb9xUfFMEziaGcXIRd8h9jhd5Aag1va9ra28=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P7Va3kEgGQ2U8Y/wpdBsLKuuoMnz7YBLLyAUh/9eci1yAaF9PJv0RR7COS9gOpveFdmYPmOvOO1L/sZGDO3eaO2EhEd0hMOlsk5Ytiw/ghebDsDzMCGwsoS524GP/ypf0CrnekOkc5lRxMeUmEhOBW2ei4Zinw42pSnThXgqcKU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hiR9/Pvd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CBA8C4AF08; Wed, 15 May 2024 12:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715777625; bh=MdzjiUsPb9xUfFMEziaGcXIRd8h9jhd5Aag1va9ra28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hiR9/Pvdqc4Tv3LWXkd9/FPw/NyVasazyt/C8l04pt5IEFNIcE9kblgboXGyADNHx laiAj2ftzFrwtpybS7ZhcmFn56DfJX2oTOMMKhiRtAAm8gMfXj3fK2Ob05y/UZ5lRC TiUb7YuAWMUuYbA+9HqE2ayqhsE/Ji16HygG705JkVCtX9BJvERPQRLFcPKLyBkeg9 ejBzhY6sxdZaXJbZtoXXgnEe+BePqz2HbQixxwRM3C92ch/5fviLXq8g17u0Rq2j9q Pegyyd2bO9o5oUWpJP70RcDw3LRdcf3dx6GYmtF/JMAi6OckEsCB/09Ka4IHeAQKqq kbceTK3tNv6iQ== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Valentin Schneider , "Paul E . McKenney" , Boqun Feng , Joel Fernandes , Neeraj Upadhyay , Uladzislau Rezki , Zqiang , rcu Subject: [PATCH 3/6] rcu/exp: Remove superfluous full memory barrier upon first EQS snapshot Date: Wed, 15 May 2024 14:53:29 +0200 Message-ID: <20240515125332.9306-4-frederic@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240515125332.9306-1-frederic@kernel.org> References: <20240515125332.9306-1-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When the grace period kthread checks the extended quiescent state counter of a CPU, full ordering is necessary to ensure that either: * If the GP kthread observes the remote target in an extended quiescent state, then that target must observe all accesses prior to the current grace period, including the current grace period sequence number, once it exits that extended quiescent state. or: * If the GP kthread observes the remote target NOT in an extended quiescent state, then the target further entering in an extended quiescent state must observe all accesses prior to the current grace period, including the current grace period sequence number, once it enters that extended quiescent state. This ordering is enforced through a full memory barrier placed right before taking the first EQS snapshot. However this is superfluous because the snapshot is taken while holding the target's rnp lock which provides the necessary ordering through its chain of smp_mb__after_unlock_lock(). Remove the needless explicit barrier before the snapshot and put a comment about the implicit barrier newly relied upon here. Signed-off-by: Frederic Weisbecker --- kernel/rcu/tree_exp.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h index 8a1d9c8bd9f7..bec24ea6777e 100644 --- a/kernel/rcu/tree_exp.h +++ b/kernel/rcu/tree_exp.h @@ -357,7 +357,13 @@ static void __sync_rcu_exp_select_node_cpus(struct rcu_exp_work *rewp) !(rnp->qsmaskinitnext & mask)) { mask_ofl_test |= mask; } else { - snap = rcu_dynticks_snap(cpu); + /* + * Full ordering against accesses prior current GP and + * also against current GP sequence number is enforced + * by current rnp locking with chained + * smp_mb__after_unlock_lock(). + */ + snap = ct_dynticks_cpu_acquire(cpu); if (rcu_dynticks_in_eqs(snap)) mask_ofl_test |= mask; else -- 2.44.0