Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3769155rwb; Fri, 30 Sep 2022 08:06:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kn8KVCxH8DpvKeGetr6nPzQy6jgAiQhA/fYGtxJ2bqF3wXKuAO1T/dKK+WhJ1erQ/Rs6P X-Received: by 2002:aa7:d3d9:0:b0:458:16a9:5811 with SMTP id o25-20020aa7d3d9000000b0045816a95811mr7885981edr.286.1664550372888; Fri, 30 Sep 2022 08:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664550372; cv=none; d=google.com; s=arc-20160816; b=BicOdTpoFgAEGIbG4m3Jxr7ERk0FYOIF5RMqfxzJss/Y1zm+Y/BtISGi9ZoZ/SEXo4 phEoI3Ng1yGqrB9/pjF+AxSls40GN+jyvZrb7mdLmy/6SbUZ8OIksCEjyADm+Y2DIJsZ yvMLoEXwibDTQZ2skYPAPs7JHK7pZGff8m6PIENCoS9INjbzt9agfU1hbyM7qHGAQWnd pjhTXThTLd6CQiXDHgjCWIrbmLeFENRGtcnW+jo/6daI0AfNRlmHFZXe7QtrWEbnWK18 2BE5k5Rp3L7EZMMkAO9yPkdTop9idjU+2lJWj8eZtxqaJn1iPm2yKVmG8kvaHX/Onfv/ hLaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=J+Fn4zMjsLn2Qso2M/bzpTLj/jBiqJSsMiMxkJfaFns=; b=KiBNzwu8Gpl2hKXOt1qFZPi64a2YwSRvuzoX7vtB+QcOVx94y9OSoHifTw7brwx0r6 iWtTcbZnashRghHEzn54ezOOHW/JPs8sDWvo11hL46K41IixHdqAmq4MTY+thOs5Kuw6 WsKC6NKzsdd57UaiJjYC/cYW0U52CSgJnhCsFRpLR64qMog7bRNRy447WWZt4pK/EyMd u+WAAfuYybNs/JkLyb8PvHEFRQbHg7iTXC+vdt4h9lep05PbHniVVIhkbDsVIlds2VJ/ x7uJHHJYnxbB3rw756JvWxLKtcLgdppp3+6DCRmKN/bKO+pNr7vbEGcR6FCN1r6p9c68 UN3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AOo14cMZ; dkim=neutral (no key) header.i=@linutronix.de; 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=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d26-20020a056402079a00b00457dbe73825si2179316edy.386.2022.09.30.08.05.45; Fri, 30 Sep 2022 08:06:12 -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=@linutronix.de header.s=2020 header.b=AOo14cMZ; dkim=neutral (no key) header.i=@linutronix.de; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbiI3PDW (ORCPT + 99 others); Fri, 30 Sep 2022 11:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231156AbiI3PDA (ORCPT ); Fri, 30 Sep 2022 11:03:00 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 810731B797; Fri, 30 Sep 2022 08:02:20 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1664550139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=J+Fn4zMjsLn2Qso2M/bzpTLj/jBiqJSsMiMxkJfaFns=; b=AOo14cMZ2mEMUoXVzdowlMGK9daTRVgM5oGOQ5ZqkClSdLBoEp0pqdM08dbloyxeM9kJol e+l8hmKkF9Dvrd0Rfnt1JDQmORksEWdJJso9YSR0tWkWxqwqTInvbK+PXSIxYk0jFOeRH7 jwcRpRgxdOjR75X52gr6rNnb0OcFwXemOJh6qETKQ/lclkFsTkgoN/aNlqcSS5GCc63xYH /0YWZf+VDenoSobJe8mzttRShCmXBilUhNka3hLgCbqRPIpQiMUjvwpuZ2c1wBrMsWm9gE 4+1mDiJDpxHKEpji8SR4b3Ju1wxqyTUl5KQBupqwjHE2lZuDhCVXyU9mj0eWiQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1664550139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=J+Fn4zMjsLn2Qso2M/bzpTLj/jBiqJSsMiMxkJfaFns=; b=fe954LaE1Z/wHa54KHsNWFtY6/lL2vlliP3TsrpJDWG+Q7QPmx96WVhG4Tm4auZVh4M1xx Pd98LjH1kpimYTBw== To: "Paul E. McKenney" , rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, rostedt@goodmis.org, "Paul E. McKenney" , Thomas Gleixner , Petr Mladek Subject: Re: [PATCH RFC v2 rcu 1/8] srcu: Convert ->srcu_lock_count and ->srcu_unlock_count to atomic In-Reply-To: <20220929180731.2875722-1-paulmck@kernel.org> References: <20220929180714.GA2874192@paulmck-ThinkPad-P17-Gen-1> <20220929180731.2875722-1-paulmck@kernel.org> Date: Fri, 30 Sep 2022 17:08:18 +0206 Message-ID: <87ill4vrb9.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, 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 Hi Paul, On 2022-09-29, "Paul E. McKenney" wrote: > diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c > index 1c304fec89c0..6fd0665f4d1f 100644 > --- a/kernel/rcu/srcutree.c > +++ b/kernel/rcu/srcutree.c > @@ -636,7 +636,7 @@ int __srcu_read_lock(struct srcu_struct *ssp) > int idx; > > idx = READ_ONCE(ssp->srcu_idx) & 0x1; > - this_cpu_inc(ssp->sda->srcu_lock_count[idx]); > + this_cpu_inc(ssp->sda->srcu_lock_count[idx].counter); > smp_mb(); /* B */ /* Avoid leaking the critical section. */ > return idx; > } Is there any particular reason that you are directly modifying @counter instead of raw_cpu_ptr()+atomic_long_inc() that do you in __srcu_read_lock_nmisafe() of patch 2? > @@ -650,7 +650,7 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); > void __srcu_read_unlock(struct srcu_struct *ssp, int idx) > { > smp_mb(); /* C */ /* Avoid leaking the critical section. */ > - this_cpu_inc(ssp->sda->srcu_unlock_count[idx]); > + this_cpu_inc(ssp->sda->srcu_unlock_count[idx].counter); > } > EXPORT_SYMBOL_GPL(__srcu_read_unlock); Ditto. > @@ -1687,8 +1687,8 @@ void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf) > struct srcu_data *sdp; > > sdp = per_cpu_ptr(ssp->sda, cpu); > - u0 = data_race(sdp->srcu_unlock_count[!idx]); > - u1 = data_race(sdp->srcu_unlock_count[idx]); > + u0 = data_race(sdp->srcu_unlock_count[!idx].counter); > + u1 = data_race(sdp->srcu_unlock_count[idx].counter); > > /* > * Make sure that a lock is always counted if the corresponding And instead of atomic_long_read(). > @@ -1696,8 +1696,8 @@ void srcu_torture_stats_print(struct srcu_struct *ssp, char *tt, char *tf) > */ > smp_rmb(); > > - l0 = data_race(sdp->srcu_lock_count[!idx]); > - l1 = data_race(sdp->srcu_lock_count[idx]); > + l0 = data_race(sdp->srcu_lock_count[!idx].counter); > + l1 = data_race(sdp->srcu_lock_count[idx].counter); > > c0 = l0 - u0; > c1 = l1 - u1; Ditto. John Ogness