Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10028076rwp; Thu, 20 Jul 2023 13:28:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlF7YBTOxcqBtEQprQn9ldvmY3cclRrR397bhpVpD9tzliGSGpC4psjVElluQh9GEARnRqMI X-Received: by 2002:a05:6a21:6811:b0:137:e595:830f with SMTP id wr17-20020a056a21681100b00137e595830fmr209282pzb.57.1689884924364; Thu, 20 Jul 2023 13:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689884924; cv=none; d=google.com; s=arc-20160816; b=Wtw5qXwaZzHht7lLjXQos8D9sgBdulTRqaZ9GkLWw6/IpiQ0/g2WyIL8hWo+SSyiF8 Y6WqnqCutXGUgT7YqfHB2s0bOD8OQ9pNMzyHCmEE/WrlDGBZ+KLSZn3THqP+6qFtVQ6H M44eO7LiL47H8empkKcTFfW0PAb4uknF61/PkcmYcQz62u3nSjKH/ktN2/erP3fLnSbA I5lm1WDwa2t5k4triCMqzpuzW6MVReRC9COd0L+y4EL7Jbx8/sM7XY/5q5CJPy8pvKHY hcm7ia9hZC3inR3oqIA/x8FB7UKyEc9EqiyGSTo16/zIoQVUkxi7E2vkr2YCMVEXu7Iw J8eg== 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=5f+1BVn3K9BCak1PKcjUIhwm6W2P7+r/CLvcCqHWmMs=; fh=NoirF4bH6n2AzAxqpAC1CHtkVkMuEux3QexBS6/pL2M=; b=tL9SXvRedDKXpkFDInPjrWX5uKHCFa09VJ44zPJPu7OUjQP/xfr9J+VgjYkJME+Gx0 8y+53KstpL3+FAvY19PnvJoIoZP8ZQ7vPA23HaJz5XaTDP8NajzcQQbwSed2Gxi31sld YFV7Hgu6pKMxQFnGnlcfXUy2Kew/3CdjSFuqVtYjT1t9zeesSuu7Z/Q6WD/eby/w/Ieb 7ewI9AguPc1ibcZxOHthbHV4UDC0lyvYHrXwcHeQy8tCinuX8vKTjKzBkcEFSNxn2O4S WWjR4POQxj5ZKz1exaD50qUz3xAnjA9ZUL3A5Y3/ls7l2CgtERttFvf+m0BheWe5fqoU o3aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=OM3vNHbi; 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 k15-20020a170902d58f00b001b8a2a800dasi1621724plh.131.2023.07.20.13.28.32; Thu, 20 Jul 2023 13:28:44 -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=OM3vNHbi; 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 S230039AbjGTUAG (ORCPT + 99 others); Thu, 20 Jul 2023 16:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbjGTUAF (ORCPT ); Thu, 20 Jul 2023 16:00:05 -0400 Received: from mail-oo1-xc2a.google.com (mail-oo1-xc2a.google.com [IPv6:2607:f8b0:4864:20::c2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 763EB26AB; Thu, 20 Jul 2023 13:00:04 -0700 (PDT) Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-5634db21a58so838458eaf.0; Thu, 20 Jul 2023 13:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689883204; x=1690488004; 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=5f+1BVn3K9BCak1PKcjUIhwm6W2P7+r/CLvcCqHWmMs=; b=OM3vNHbiY8QVPdTBrgLW1VcaC9q8mPzhpokDa83fnJxisDFHRpQ+mfvacPfXOTtshR 8R+AOgAP7zfI+LKYnGXiQLB2jgpHx3xSTniNLCNZu2i4O8DYOa8+mSeiwFkNvX5WycIQ msV789gmphtJHXyvT8cSwDMYkB4sS9ur3J8uw1G/aB0cvVkvzcmSR7BlV8LtpaT5JVDv jKKG/h4daFr5/PvhmmmgslL2HdXvVnrAd0m+34NOpUgaPbTO5o2yWq3w2QEvTQ3XhyvJ f6vH8e4UsyKz1Div2bbs6yUagwqKQMhUJuhOemRZuU4m7Jjrox3fP1eXrdLWIuRkt4fi bbzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689883204; x=1690488004; 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=5f+1BVn3K9BCak1PKcjUIhwm6W2P7+r/CLvcCqHWmMs=; b=lfEVHvXq31ojV1iBF55fb/C2lH49l4yWvsalKX+5MYSBU147WVmJYf8XaxuNYmK6tQ ik+0kMM+2Cb7CKDHdi7uPHucQFEdXkMkruAY9mbVgvXVC1yYZSVunjnFtWJp5fhN4wrO Vq5vUnxMH8b5KWP9xVbanKvlbwOgl0TMQbMcssRcrQMBSyS4Hmi1sw9MZsqFWuzzxs+L 4/hp5zfBOKZsS6wQ301b22SMsufZXqcq3OL9LaOz9Xh0IG0IZS3hTk6+w995ucxZc7s3 wpuPA2KgeVy37O4SDmLLXejBfN17HmQQ6+/8MKraJAZVNLuWvyUPNJF8YOslRh+efCMb ZYQA== X-Gm-Message-State: ABy/qLai973HRblgFAvAd9xheQoOLR9RtQXcR+lSHvEMF8+tH/RwKs4g tLPeynOjVjV8CPglDMS/vH0= X-Received: by 2002:a05:6808:8f0:b0:398:2f92:65ca with SMTP id d16-20020a05680808f000b003982f9265camr388351oic.7.1689883203713; Thu, 20 Jul 2023 13:00:03 -0700 (PDT) Received: from smtpclient.apple ([2402:d0c0:2:a2a::1]) by smtp.gmail.com with ESMTPSA id em9-20020a17090b014900b00263a985abc0sm1353998pjb.26.2023.07.20.12.59.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jul 2023 13:00:03 -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: Question about the barrier() in hlist_nulls_for_each_entry_rcu() From: Alan Huang In-Reply-To: Date: Fri, 21 Jul 2023 03:59:33 +0800 Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, rcu@vger.kernel.org, "Paul E. McKenney" , roman.gushchin@linux.dev Content-Transfer-Encoding: quoted-printable Message-Id: References: <04C1E631-725C-47AD-9914-25D5CE04DFF4@gmail.com> To: Eric Dumazet 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=8821=E6=97=A5 03:22=EF=BC=8CEric Dumazet = =E5=86=99=E9=81=93=EF=BC=9A >=20 > On Thu, Jul 20, 2023 at 8:54=E2=80=AFPM Alan Huang = wrote: >>=20 >> Hi, >>=20 >> I noticed a commit c87a124a5d5e(=E2=80=9Cnet: force a reload of first = item in hlist_nulls_for_each_entry_rcu=E2=80=9D) >> and a related discussion [1]. >>=20 >> After reading the whole discussion, it seems like that ptr->field was = cached by gcc even with the deprecated >> ACCESS_ONCE(), so my question is: >>=20 >> Is that a compiler bug? If so, has this bug been fixed today, = ten years later? >>=20 >> What about READ_ONCE(ptr->field)? >=20 > Make sure sparse is happy. It caused a problem without barrier(), and the deprecated ACCESS_ONCE() = didn=E2=80=99t help: https://lore.kernel.org/all/519D19DA.50400@yandex-team.ru/ So, my real question is: With READ_ONCE(ptr->field), are there still = some unusual cases where gcc=20 decides not to reload ptr->field? >=20 > Do you have a patch for review ? Possibly next month. :) >=20 >=20 >>=20 >>=20 >> [1] = https://lore.kernel.org/all/1369699930.3301.494.camel@edumazet-glaptop/ >>=20 >> Thanks, >> Alan