Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8618662rwp; Wed, 19 Jul 2023 12:34:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlE6Ud9NNPNprnKUSs7fw5W5h66hfWzUidDupTSd/ZtXUUJlM1Gs6pW6TILWYWRCIDHDYSSP X-Received: by 2002:a17:902:6b82:b0:1b8:9461:6729 with SMTP id p2-20020a1709026b8200b001b894616729mr18462835plk.2.1689795289994; Wed, 19 Jul 2023 12:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689795289; cv=none; d=google.com; s=arc-20160816; b=p7MByJZbo8iDM7SzVp7fLl+tBA0m4X/8ZCqsFvskaWzxhwaxQI5/iy7sIRtrW9JTRk fFPoETZfAUtCZmnIwh1MRgrP1SGNp6FFnewJZhVNQufGrr9OxEGhMq3ylYs1/b/MK/Tr 3P48y6+AKeKbbrF+ewXLiOajNfAl9wS4sGCY8zgbaq/s3izGqLjLnLs4YoTz9xtq5sVH cMH05Prrqem/CjDbyzGFHuET49cAzbwmQk4pkRf4PDCWjQdTGoQOpv6vMGj8cM0TLKue MwKvrXd/sDYQDOniPhdfQ6D1UH7asgSEC1DwxEx5vSc6u8moI/QHudhJuvCDjqTP8IRF doVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=uAwDIYHwLc+Xj27zzKl9lhwsFCjNoPTFqoz1deZ/UnU=; fh=b4vhDwdqrIB44gRdhibFts+Cy7hi0ddTovG/JYFxr3Y=; b=r/G3GpyVeZSlaeDzuiTFdILOnAeQ5HN/Lbb47q58XiWYITOY19aJ+Vn76gYsYmeGwG +/noNXg0wh2/dRapP/DrOhBIzGlAZqR98JG8G6/6cPBJdOIt/FI4uBoCoV9g/lO9PSg4 rfxAMBPbrYLcrF5UKdsB/P/PzbEAXbdQbygjHlmKXFKkpoR45KtWf7jyFvOotZEiMMTY 3lEYKJspB6IjzQzL/VzBiPFWlacmN/9ALZC13a3yfUpa8UWZEtXDyqzLJl2R04QWczty oP2ClEoSenFowuyyT1tWrPsFz5EhEXTL2IR3Gqvr/Hc5rwrPWUYfrnO24gwmZ8mVsJJq 6O8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="W4C/qtU+"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kz4-20020a170902f9c400b001b8a7521b5csi3790885plb.244.2023.07.19.12.34.38; Wed, 19 Jul 2023 12:34: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=@gmail.com header.s=20221208 header.b="W4C/qtU+"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230074AbjGSTSS (ORCPT + 99 others); Wed, 19 Jul 2023 15:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjGSTSR (ORCPT ); Wed, 19 Jul 2023 15:18:17 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A191BF7; Wed, 19 Jul 2023 12:18:16 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1b8baa836a5so57166615ad.1; Wed, 19 Jul 2023 12:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689794296; x=1692386296; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uAwDIYHwLc+Xj27zzKl9lhwsFCjNoPTFqoz1deZ/UnU=; b=W4C/qtU+KQcteUJ8wTKkr1eaI7Vi0ybjTHHReI44+81f8jtkvyUcuO9Z1nU6lh37U1 krRxDiPE9dQDcCkNXBEdCvPYbdb8csURt9qUki0mIDE/tztNBg+WUC000Vrd7T+KN38j YMNe6uxCCEGHWcIkyra0JxJ/RegzuuC9C8sJDHj/6gBVmVm9uCrGQxjwLOjM33NFP45u +gYg84znqJ8WUQngQm4CpjIMr37AJHI1hanjA4FpDXb+HHecK74u6Mp0QC+zIOC8tl32 hnavcoFCiqgf+cFn/vRIda4p32/OAspaVPzUqA0MpFtIHfp5VX8mHX8TfDD3sBaTGz6l m99w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689794296; x=1692386296; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uAwDIYHwLc+Xj27zzKl9lhwsFCjNoPTFqoz1deZ/UnU=; b=DJUaMXDeYplG6HJ0DiBTjXdJ6iRVPL086msgmjVhWTmZ+ElnDxfU/bkeUMqpqJI494 rFCEb+xz4W8v2XrYvZ4Z7ND/wO66ZhKoomSsd7Xbvk8sJ5CT3DsXb8PhHUjbQ9J//HQy NHkkkZBDp8L/N3BMwFDjuVcbGPbGM+Yi8TQjWew5wpCi2+MWJeiro/fwkWsV+pVHxvQi iRGKFaEh3kqng4XDt/e3jPYexAJtcZkUkcrDc3Dn0fZ1yfZtpIJmIdj08UyvWaCs/Udg 8ZrkOW394k1+ryw7DluF5yeXmbVVUdoQ5HDfXtK/lah+ooKFQ/Dl3PjIXCaUGaj78i72 5R9Q== X-Gm-Message-State: ABy/qLbAvs+SQZwkzWXvtJPCQHH8roPKyPuQrSzVSsOlFNscy8TL/LL2 pAESD8xtWuG5CSkNbXheZ0I= X-Received: by 2002:a17:902:7293:b0:1b8:73a4:706a with SMTP id d19-20020a170902729300b001b873a4706amr16637327pll.69.1689794296018; Wed, 19 Jul 2023 12:18:16 -0700 (PDT) Received: from smtpclient.apple ([2402:d0c0:2:a2a::1]) by smtp.gmail.com with ESMTPSA id h2-20020a170902f7c200b001b9daaffd26sm4314303plw.304.2023.07.19.12.18.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jul 2023 12:18:15 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: [PATCH rcu 6/6] rcu: Use WRITE_ONCE() for assignments to ->next for rculist_nulls From: Alan Huang In-Reply-To: <50bc6e0d-7d9b-4634-999a-2ee8f503e86a@paulmck-laptop> Date: Thu, 20 Jul 2023 03:17:58 +0800 Cc: Joel Fernandes , rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org Content-Transfer-Encoding: quoted-printable Message-Id: <129BFB2B-1A19-437E-B04E-16B16AA4C838@gmail.com> References: <6127192c-da9b-4599-9738-6e8f92e6c75c@paulmck-laptop> <20230717180317.1097590-6-paulmck@kernel.org> <9651c3b4-0791-5cd7-567f-f65d28bc8fae@joelfernandes.org> <3f6b04b3-af22-49f0-8d3c-269640f9f762@paulmck-laptop> <449d0d48-ac98-659b-4d03-e75c318605d4@joelfernandes.org> <50bc6e0d-7d9b-4634-999a-2ee8f503e86a@paulmck-laptop> To: "Paul E. McKenney" X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,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 > 2023=E5=B9=B47=E6=9C=8820=E6=97=A5 02:20=EF=BC=8CPaul E. McKenney = =E5=86=99=E9=81=93=EF=BC=9A >=20 > On Tue, Jul 18, 2023 at 09:48:59PM -0400, Joel Fernandes wrote: >>=20 >>=20 >> On 7/18/23 14:32, Paul E. McKenney wrote: >>> On Tue, Jul 18, 2023 at 10:48:07PM +0800, Alan Huang wrote: >>>>=20 >>>>> 2023=E5=B9=B47=E6=9C=8818=E6=97=A5 21:49=EF=BC=8CJoel Fernandes = =E5=86=99=E9=81=93=EF=BC=9A >>>>>=20 >>>>> On 7/17/23 14:03, Paul E. McKenney wrote: >>>>>> From: Alan Huang >>>>>> When the objects managed by rculist_nulls are allocated with >>>>>> SLAB_TYPESAFE_BY_RCU, old readers may still hold references to an = object >>>>>> even though it is just now being added, which means the = modification of >>>>>> ->next is visible to readers. This patch therefore uses = WRITE_ONCE() >>>>>> for assignments to ->next. >>>>>> Signed-off-by: Alan Huang >>>>>> Signed-off-by: Paul E. McKenney >>>>>=20 >>>>> Did we ever conclude that the READ_ONCE() counterparts were not = needed? ;-) >>>>=20 >>>> Read-side is already protected by rcu_dereference_raw() in = hlist_nulls_for_each_entry_{rcu, safe}. >>>=20 >>> It turns out that different traversal synchronization designs want >>> different pointers using WRITE_ONCE(). >>=20 >> Thank you Alan and Paul, >>=20 >> Btw, I don't see any users of hlist_nulls_unhashed_lockless(), maybe = it can >> be removed? >=20 > Either that or the people who removed uses injected bugs... It has never been used. That said, the data race has been there almost for four years. And the network people use sk_unhashed() for both hlist_node and = hlist_nulls_node. So, I plan to use hlist_unhashed_lockless() in sk_unhashed(), that will = be one of my future patches. >=20 > But if this one really does go away, do we need ->pprev to be > protected by _ONCE()? The ->pprev thing is what I=E2=80=99m currently working on. :) >=20 > Thanx, Paul