Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp744088rdb; Fri, 8 Sep 2023 15:19:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEj1beGmTZpQldRl2cW0gpNxHbcUcbHNV+JG8ob2PuDdbAUNAcCjDeJXQ22UJhanl42vbrk X-Received: by 2002:a50:ee84:0:b0:525:644f:134b with SMTP id f4-20020a50ee84000000b00525644f134bmr2661998edr.25.1694211563921; Fri, 08 Sep 2023 15:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694211563; cv=none; d=google.com; s=arc-20160816; b=XzLcEwpV7wVYgNKdlySUuVNXuW9b1gNqRCM6UuOrS+5IpO5vLhJ5q9VWemeUyz1R4H SvGACte9s3AUGrC24rNM9042Ul28UeavyqPt9flq8EGA7fK/6CMhcW1DxAxA8dyHHLfI c4t9YSJY4GYiX5bqJkXGie/yQ5hV37HTDSLjh7rvSObmHZjsZQVcQj41MYCzY/3ne/PP 8gmbKTfSXEHvGrojTx25/4hbrgq59cjBsFNqnokueRPVx/tTG60qKyt+zOES5oUpDhPn r/Ne2ci5dGesPDDdcxyreHbHsG47MmaN09HPIa7jG9qRUEkY0e6b/SydQczWgv08LHRV snUw== 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=GW498Ik83ReUsJQ0RNq1Wh6hoBZ6ReVeS8KUN0B24Zc=; fh=b/0dXqvz0kAo+07ch4KNz5dZ+JhJoOmBzkQIhQsuGPg=; b=jbiVJpSktPjpH/1sU2kcnlyIvr3W1eOGP3dOqK27vKk6XHL6wbHGJd7uWc+ZURZRUE 9LkU4LSOnscJg/rut7PTZA7hBkJQ1kYB6gKPfL13w6U8ZN3dUQowGkngKuhZKSXK0EUy rNph0SO1GaDFFlXON/0Qp2Ihg0totAyynsQM5uMf9Xxr6SEyxjrTceoNpBMlUx0G7dgL aTR93buHl/IZw8xTgs0pjyg3x1BcDgzKCcyZIXRCgqSwCkxngdyU1LmqS5fbmSTVqji8 QTPBWARJwENZ3dpAbDzDYxHxB3dFTiytw/Y5m8hk01SIVz2rC03+WYp7DvsOtkTcb0oF /lwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=If6qvcxV; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056402134a00b00525667e5154si2320894edw.258.2023.09.08.15.18.56; Fri, 08 Sep 2023 15:19:23 -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=If6qvcxV; 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 S1344111AbjIHUg3 (ORCPT + 99 others); Fri, 8 Sep 2023 16:36:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344101AbjIHUgZ (ORCPT ); Fri, 8 Sep 2023 16:36:25 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCF4A12C; Fri, 8 Sep 2023 13:36:20 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 806C2C433CB; Fri, 8 Sep 2023 20:36:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694205380; bh=GOeZfICz6IgN8EOrRlzyyiYJ3WMWQY2axoWb8S5uGRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=If6qvcxVcxQ4YjCjO7D3jckmaba8n+kof+yqc7NEmlYUHjV/VWZ/w40/6+4jmB9Ri Y+vccZ1BH+/FvRY3YUZyqG482iO5pCVNNQ9EJrPXnt0n6eAzlbWJWS/u4yuxMmi/B3 PsE7hF3WqQAYGEATCBBL2slDPGqkZTQ5pVDr8kOO2ryW37WQvlXcAs0h38/4BBoVTf w7K6tb/HDGgG3PTnsdLCFaSFzpq5gukKxldj02ATIkQ1czkCw80lva05aDoJZ/wVYt TMkG5IiGVMSNuAV2tToOnB4e790Z1OEi8ISCToMU/SULY+V2VuI/O3TqDPG9D3e/nt jU1ZWT9H33nPQ== From: Frederic Weisbecker To: "Paul E . McKenney" Cc: LKML , Frederic Weisbecker , rcu , Uladzislau Rezki , Neeraj Upadhyay , Boqun Feng , Joel Fernandes Subject: [PATCH 03/10] rcu/nocb: Remove needless LOAD-ACQUIRE Date: Fri, 8 Sep 2023 22:35:56 +0200 Message-ID: <20230908203603.5865-4-frederic@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230908203603.5865-1-frederic@kernel.org> References: <20230908203603.5865-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: X-Mailing-List: linux-kernel@vger.kernel.org The LOAD-ACQUIRE access performed on rdp->nocb_cb_sleep advertizes ordering callback execution against grace period completion. However this is contradicted by the following: * This LOAD-ACQUIRE doesn't pair with anything. The only counterpart barrier that can be found is the smp_mb() placed after callbacks advancing in nocb_gp_wait(). However the barrier is placed _after_ ->nocb_cb_sleep write. * Callbacks can be concurrently advanced between the LOAD-ACQUIRE on ->nocb_cb_sleep and the call to rcu_segcblist_extract_done_cbs() in rcu_do_batch(), making any ordering based on ->nocb_cb_sleep broken. * Both rcu_segcblist_extract_done_cbs() and rcu_advance_cbs() are called under the nocb_lock, the latter hereby providing already the desired ACQUIRE semantics. Therefore it is safe to access ->nocb_cb_sleep with a simple compiler barrier. Signed-off-by: Frederic Weisbecker --- kernel/rcu/tree_nocb.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h index b9eab359c597..6e63ba4788e1 100644 --- a/kernel/rcu/tree_nocb.h +++ b/kernel/rcu/tree_nocb.h @@ -933,8 +933,7 @@ static void nocb_cb_wait(struct rcu_data *rdp) swait_event_interruptible_exclusive(rdp->nocb_cb_wq, nocb_cb_wait_cond(rdp)); - // VVV Ensure CB invocation follows _sleep test. - if (smp_load_acquire(&rdp->nocb_cb_sleep)) { // ^^^ + if (READ_ONCE(rdp->nocb_cb_sleep)) { WARN_ON(signal_pending(current)); trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("WokeEmpty")); } -- 2.41.0