Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp298572lqp; Wed, 12 Jun 2024 01:44:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5FZZ0Tt0lfHQUxvDmNECpfoCcmOiZo/5CWTmswjrrYuljJ0HGpj8jCInuN2OzRm8pYALnbLY2TLGwM2s3z4uQIYEJdI8OSi/h2Hlp3A== X-Google-Smtp-Source: AGHT+IGcycS9EeuLa5e/5DLbbamquQVaU3S1ub5IIRYevIOmJQbiwLZHG0dLjo0k3OSTzkbO7+5R X-Received: by 2002:a05:6214:5bc8:b0:6ae:d0c5:2cc3 with SMTP id 6a1803df08f44-6b19158d3fbmr10304786d6.6.1718181882535; Wed, 12 Jun 2024 01:44:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718181882; cv=pass; d=google.com; s=arc-20160816; b=HMILs+448u2nKk2skU211ddiXmqvHWx63dnHwNXs4zwc1hcMw/cqvBoU2lKwmoMgSn EDBP65hCMD0LGiQUdEkcv3Wr44IIIFTYl26AyA6O5GNOJUFBYOYack/CQNkVY52jheaG r0xu6y7pwDrFRHImMrV9fIeHOm98HRt21WniaOUB4pJbCYeJGkEm9i0rsF7+/gTOs54U J+2lCKjDXcj8mxOUbDx5hNWrDFhAY+AWVtqLdaWeTS12NiJBPT2p14CfJDE7oog0iAXT 7j3XK7CKBDY+yF+Gt8CaTojGb8lL9cpDG5Lz0rCkvwdLJAwgfeCIwNd5ZP1ZPHn8mtI4 Krjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=5R/crdg/bH5NOXHm4IuEIPF/jeUwqU5TAij5q8JMQEI=; fh=eC9Cypt8pK1iDtKiF3Ccnvx2KXL1fywYj0DXXQIugsc=; b=rNBY8lzLtHW7o0EXZ/IeNYon2cM1ZBNp7V2DWVDQTA4ahMbhsEOTyOHWljpUAfW7rm w4+F5Q0jx7aWedG4d1ZaQnR3WDfpMlAWhxEBuSKZdEe1zj54IOqyBG9TtXOT+SXoSvfg h/mOsKTrksr7RGmnFCTqCcHSCFOhWwSEhD2aUtb6ml1X4c+++TONtbLHLTj2XglXMkPK Rfd9QqT0zeYLahJFCV/0htObIP6AXyhpFhvbt/5W7klcLXG4G581/Rgz1bR/M9RSVBEm PjGhtz7WFJOqurrSolDSdgLF/IHY+QfI+YSOyWyTeE0SAbfVqQYtDciHyX0t83IvmvOz 4RWg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BSMB4G+n; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-211198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b066ecbbe7si110109126d6.1.2024.06.12.01.44.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 01:44:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BSMB4G+n; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-211198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 38C2B1C216C3 for ; Wed, 12 Jun 2024 08:44:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2200316D335; Wed, 12 Jun 2024 08:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BSMB4G+n" Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B233816D322; Wed, 12 Jun 2024 08:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718181875; cv=none; b=d3lrmrfyMgDxmP4A0KuPPB9ZRDjMl8Fq8oiebslkqkiXGLxl6OBlxuyVIZA3FV27aKFNgI0N/t/jbUKyGd7Ei75nm+2pf/OYlyok3SeayX+TdyAqGaDCg3chvr8Gm9sdL5dRq9Pfatqnf3rSSgoFtYog7Hr+B+YKJTT1CTWFqGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718181875; c=relaxed/simple; bh=VtnH5r07oHwCXgPKPUmmalAK4r10T2BQ53NAmBH4yzA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=c6c+yx5RzmFnnf9Zu+pU6X/XipmFC5Br52x8OjnfK8IOvUPpdPGfW7giQC8ec4mOxHUmVqw0o/GUEZvzYdN2Hk21J2wGP1m39HQ74/PpoIjuosE+EmSGXc9xqIY7gYEh4Zq3+GmrZPr4s9Ap6vixEKYxhwDBvhe0PEHrdV7f1P8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BSMB4G+n; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-57c68c3f8adso2504080a12.1; Wed, 12 Jun 2024 01:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718181872; x=1718786672; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5R/crdg/bH5NOXHm4IuEIPF/jeUwqU5TAij5q8JMQEI=; b=BSMB4G+naCOi1OESM5tEgci6l09H1QUAeMbtvVObz5oib+saZLinxiOp9S/kNTNkXZ s22jgioomObCKSafQxkZ61CzYTK6+Utie0LjWY+INwuTvGtQB2vqgmWPuyyUyQ55vaWE Ua1e4OYxR0yFALrC+C9TuQ3dqpTSTYTlATEUPvJSbQdbcHW2eQtG9y+3WgqvSZ3g7JjU x47G2W1YTDcJ7/ird4v34EiYahZcS5/FXgTgXz0UMn7rlDx+WuFAvFCIH8qIZiGlhtl4 Yz9gzSNGiFWnrM8DUAuzxrnDijLKL4BepvwvMLAEMoTG2S8mBYrhBhFULbz6YwvO9mH+ qA+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718181872; x=1718786672; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5R/crdg/bH5NOXHm4IuEIPF/jeUwqU5TAij5q8JMQEI=; b=GqU3F4AByYui6PuQC+wD8izz8LF4WXZXn8riO4mOIVDIlK6LJNd+Nk1yQNSL77RE9r VTs/ZMkeAKlQ1JQgE025P2l4J5xXxuky370JxvVddloebThKQ6hJh3R7WgKB8VAMceaN r5yuuETVpKXXZjeB7CQA5F3KSvB9uqpXR+aAvrOaA0fKhsu5bg3aXoU2a1W4RNgiCcF1 hf3Ra7DWjXWDUks/LbeeRlLEgmyrT0BUBWaoTS6ZzE7B4RQiHwXV6sjudkLCZEgRWm6h DtSnsGnVOlTspMG7ozIbvBjREFDqUCmAzKi791IP+r7BhI6rK0xfcdZxsjwXsQNH+gqe k9ig== X-Forwarded-Encrypted: i=1; AJvYcCU6+IrsxIwWHhiDCglmmnfOOSBqap3XZYeFfugQ5JL4rIaiGBLcGCQcRVfq8d3MUyRaTjImmDWHIWHF7Hv5QITYQQFJg/iO8i9Br7Pu X-Gm-Message-State: AOJu0Yxt7BX8ahbGyhvm552bMN9Krmn8pXb95PdRWvktmjmcdmaBt7X5 bcbsJqTaCVYW7iLCR+7FO0lZ/A7lVVJk4IUMcGrppOiAImr1ZBI/NO87AEuXj5J2IBQPM9HQP6q RAYspwgJyfoMcNWckUn4ZbRQ9nw/k4VnWTZk= X-Received: by 2002:a17:906:d8ab:b0:a6f:2d9a:c956 with SMTP id a640c23a62f3a-a6f47d4eefamr90803466b.3.1718181871598; Wed, 12 Jun 2024 01:44:31 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <81f4e616-8125-4934-a8e2-fd5beae90995@paulmck-laptop> <20240604222652.2370998-3-paulmck@kernel.org> In-Reply-To: <20240604222652.2370998-3-paulmck@kernel.org> From: Neeraj upadhyay Date: Wed, 12 Jun 2024 14:14:14 +0530 Message-ID: Subject: Re: [PATCH rcu 3/6] rcu/exp: Remove superfluous full memory barrier upon first EQS snapshot To: "Paul E. McKenney" Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Frederic Weisbecker Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 5, 2024 at 3:58=E2=80=AFAM Paul E. McKenney wrote: > > From: Frederic Weisbecker > > 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 > Signed-off-by: Paul E. McKenney > --- > 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 8a1d9c8bd9f74..bec24ea6777e8 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 r= cu_exp_work *rewp) > !(rnp->qsmaskinitnext & mask)) { > mask_ofl_test |=3D mask; > } else { > - snap =3D rcu_dynticks_snap(cpu); > + /* > + * Full ordering against accesses prior current G= P and > + * also against current GP sequence number is enf= orced > + * by current rnp locking with chained > + * smp_mb__after_unlock_lock(). Again, worth mentioning the chaining sites sync_exp_reset_tree() and this function? Thanks Neeraj > + */ > + snap =3D ct_dynticks_cpu_acquire(cpu); > if (rcu_dynticks_in_eqs(snap)) > mask_ofl_test |=3D mask; > else > -- > 2.40.1 > >