From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E512DC54EBE for ; Fri, 13 Jan 2023 16:40:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230143AbjAMQky (ORCPT ); Fri, 13 Jan 2023 11:40:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbjAMQka (ORCPT ); Fri, 13 Jan 2023 11:40:30 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id E1213D2F3 for ; Fri, 13 Jan 2023 08:38:17 -0800 (PST) Received: (qmail 25781 invoked by uid 1000); 13 Jan 2023 11:38:17 -0500 Date: Fri, 13 Jan 2023 11:38:17 -0500 From: Alan Stern To: "Paul E. McKenney" Cc: Jonas Oberhauser , Peter Zijlstra , "parri.andrea" , will , "boqun.feng" , npiggin , dhowells , "j.alglave" , "luc.maranget" , akiyks , dlustig , joel , urezki , quic_neeraju , frederic , Kernel development list Subject: Re: Internal vs. external barriers (was: Re: Interesting LKMM litmus test) Message-ID: References: <20220921173109.GA1214281@paulmck-ThinkPad-P17-Gen-1> <114ECED5-FED1-4361-94F7-8D9BC02449B7> <07579baee4b84532a76ea8b0b33052bb@huawei.com> <20230112215716.GS4028633@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230112215716.GS4028633@paulmck-ThinkPad-P17-Gen-1> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 12, 2023 at 01:57:16PM -0800, Paul E. McKenney wrote: > I will risk sharing the intuition behind the rcu-order counting rule. > > In the code, an RCU read-side critical section begins with rcu_read_lock() > and ends with the matching rcu_read_unlock(). RCU read-side critical > section may be nested, in which case RCU cares only about the outermost > of the nested set. > > An RCU grace period includes at least one moment in time during which > each and every process/CPU/task/whatever is not within an RCU read-side > critical section. Strictly speaking, this is not right. It should say: For each process/CPU/task/whatever, an RCU grace period includes at least one moment in time during which that process is not within an RCU read-side critical section. There does not have to be any single moment during which no processes are executing a critical section. For example, the following is acceptable: CPU 0: start of synchronize_rcu()......end CPU 1: rcu_lock().....................rcu_unlock() CPU 2: rcu_lock().......................rcu_unlock() Alan