Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2814165rdb; Wed, 15 Nov 2023 11:12:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPLbMVbv3W76pI6pplw5iUJeM5RBTC+UAqRrAzNxikfQnPquiyFhkw4Au8mDEwJr3iH17/ X-Received: by 2002:a05:6a00:3028:b0:6c9:892c:5916 with SMTP id ay40-20020a056a00302800b006c9892c5916mr3665057pfb.9.1700075521130; Wed, 15 Nov 2023 11:12:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700075521; cv=none; d=google.com; s=arc-20160816; b=P8VIi6zCw5q7Qvvj9az8Zr5+xBBkOmrVcORhHUm+MQcnTT6iSrJLxwrW4BoImGjhA+ JuGlLT97KCLOc3/ARMq073qT0voKDSyMF1GWrLitsz4N7ADPBCzdTxlMoi+3i+b7uIAa v16uu3YhOa8U4LMaofaR7WvjQxUDKiKYcTAqUn5eqcf2g+26wGPcqs7aAKmYJ5UQ+2fo y7HuE+Swtr78XHl8ZZleMchGegtEpAGHZ+HmWWpFElkRw2utZfQU03JePEvyCXHyZ4F1 FKySYYWO/qy4xwAsWRoZEbAbiE7NTFSwnuCtzX6aBZRHRRtnbUHELydtIl8k0X/h53bs MYag== 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=3zzM0xsVrtY4/PlTPNZ1+yGgz9ciOG4K1aya7rU4eMI=; fh=Hg33MEMv6OAYg0vV8rrONkXSgLqcq8ZX1if6rnFlFSg=; b=IMx2KmiMtxQdBgRuhqaajjHdRFk1C4fJoc17ls06xIh3NAV5Qbiv/5tkIXagL3JXFo JaWtzzkZ1WNCe7X6FG7ssNUnPxvdrHaxjAditik4JYkXtiX1MQQXEWO9V7/3KIcbVglo yff+fj30S42Wln8LWg0H0UlfAop+6MYJuBzDUPAEqujUFX75z3+jPh5595B1i+Q3fv3F 1vIy43xxDUiigWxGYawA7meYVtL5VAvSHW1wTgp4n0YPmZS92uFfNKnK1p/AendsgmOs TnzkBlbMwuqPWub9VAALvYk8AkyK5KCOUdYTKNVcAzU0l8+7Y5Hi+TLzP8e0GSGkpaFu cBGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QR4M2pHC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id by3-20020a056a02058300b005c05e260347si11440956pgb.419.2023.11.15.11.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 11:12:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QR4M2pHC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 130758028A5D; Wed, 15 Nov 2023 11:11:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232774AbjKOTLj (ORCPT + 99 others); Wed, 15 Nov 2023 14:11:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230262AbjKOTLh (ORCPT ); Wed, 15 Nov 2023 14:11:37 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F2B199; Wed, 15 Nov 2023 11:11:33 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BECE3C433C8; Wed, 15 Nov 2023 19:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700075493; bh=b4GSpROCgIcQBEluuLqw37z2afZmrOSo6EsA/1KM+bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QR4M2pHCubk+BGD+JllWKxf+LOjqI6w2qgt7rivD1NfHkmRwiLuzYbfI0TdABfioF tUXQgiioySp63uLWj50R0lLVZogLGyGIbaAjsIp6S+OtfjYVLglJY3Z8hjC5NNqrZm GgZviXe0mb0f7tugAXGxug1v+FwbmTLEmzp4QhfVfbB4wvH7K3EXrbEino/aVRnvly 0adAe5dIKoteYZG02+E8957bOc1VN30Daml7eripT7HxyZMu+RuWFM3yr2GAg5R9i3 uumlxSMw9OGa+Qh8wnUpdYMXaEc76zt+yMQOruz9CW6/8TWc+B8A3JrTj4qoOu9LJ9 mWGDFUgA80aAQ== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Boqun Feng , Joel Fernandes , Neeraj Upadhyay , Uladzislau Rezki , Zqiang , rcu , "Paul E. McKenney" Subject: [PATCH 2/3] rcu/nocb: Remove needless LOAD-ACQUIRE Date: Wed, 15 Nov 2023 14:11:27 -0500 Message-ID: <20231115191128.15615-3-frederic@kernel.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231115191128.15615-1-frederic@kernel.org> References: <20231115191128.15615-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 15 Nov 2023 11:11:55 -0800 (PST) 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 aecef51166c7..eb27878d46f1 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.42.1