Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5481497pxv; Wed, 28 Jul 2021 11:47:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoWkM033p+dcuYxnhxWkQ+re9soB/hM9IcZD/TLeE5Z1nM6SigkEWfV/BUC+tzq3lrpDG6 X-Received: by 2002:a02:93a7:: with SMTP id z36mr1044851jah.112.1627498071111; Wed, 28 Jul 2021 11:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627498071; cv=none; d=google.com; s=arc-20160816; b=s8hx0rHfnvVsnb/4c2S7mHbp4SK1AHs6eP2TIMG8n8ml9G8RHCDo8PWOVgCw9+iipp zYD/9G10++JwbKYcaiWlL0UgIm1ZzPRRgHNRzUnnKyuw7EvMux5pwAkxuc5pyMVQ/oTE WMdNHvVrvTTgYOqILKor1YPmsvL9qSwUghyPit8pNSNG0KHyMTy2SkmHSayBZzpGKNUV B9PSMHVvjrS4MAdRQ+LJnRPGxJeTOkXpPRutZ32FLw7qV2s6jsegZ/jAT1X8xEuihQl8 BdOvhJQFoWKsYHNtJ8Fj+mAYdPS4Ccsvvy1ARJPL/iAz/4ptCO4bdkMCS67wb+A+W+Sd ux+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=RIa0Dgh7Y6HLDAqcInhzufDkO0DguR+VKUNoWBhy+R8=; b=IzpqY4ZC4Nziv4P0zv6/xVo2iI81Qyw2TFntmoLNDZRLsC+syPrWZ71kkPqC9EHSjl tn5Vb4+EjDQ0iekXjIAlIlwz9gfRDC5RyNzl2RuaupCEE940CbcJN0ZHG22dCIFM4jwi z1p5wRA5/rN2G8vW0urp0ca0obqTjPoCPAB7afS/sAmDmlwar+ZdsdfIaik9Rn4u2cLP UvOAtSIgUg54CNdtf8bIXASYarSlWsmYsmjrpG7wAJlk7CDHDYGv5wQsoNP1Llsbpsan EezTmYYyt3N6qhqEADvNwwRgdDw6xNoz6hDx5wGYJXjM6+/ZzQNTaMjtUFMvou7rur7C rBXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SklSWf6n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si762875ill.26.2021.07.28.11.47.39; Wed, 28 Jul 2021 11:47:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SklSWf6n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229874AbhG1Sqy (ORCPT + 99 others); Wed, 28 Jul 2021 14:46:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:36310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbhG1Sqx (ORCPT ); Wed, 28 Jul 2021 14:46:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E9AED60525; Wed, 28 Jul 2021 18:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627498012; bh=NKJbhxmMOqMCPTL76obCjz7j4ZD4POIz1bmbEEYmy0c=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=SklSWf6nsk3JCyTbApZ4qejIXiE0wmxjoRe6DT9XgcXFl0qKBP4WydO9Sej8+kDUE POcBogujKoIf/SDs7hFTHc5U9eGNmvO3bzSxTYH2PR8hb4bNGyDyG0KlvR7gRhWRlB EWVwAVD1DL932OQkUxLFmrMMCDrrEN4S16DoL/FXeVUc77sitgDVZjCvWkGRYnruNr dmhxzLPPVOYfl6VQl7efcTuhdYuz/9ZnZXjCZ3WElTg4xeWJzaUHAK+/ozRwaIds0G 7T/+t42oNJgrvngT3oesVyiNcMc+1g3jIO4/73CFq2C2tE8i2bj9RJ1Uxczyu5MMSs jS69xWB7Z3ung== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id BE40E5C048D; Wed, 28 Jul 2021 11:46:51 -0700 (PDT) Date: Wed, 28 Jul 2021 11:46:51 -0700 From: "Paul E. McKenney" To: Mathieu Desnoyers Cc: Linus Torvalds , rcu , linux-kernel , kernel-team , Ingo Molnar , Lai Jiangshan , Andrew Morton , Josh Triplett , Thomas Gleixner , Peter Zijlstra , rostedt , David Howells , Eric Dumazet , fweisbec , Oleg Nesterov , "Joel Fernandes, Google" Subject: Re: [PATCH v2 rcu 04/18] rcu: Weaken ->dynticks accesses and updates Message-ID: <20210728184651.GJ4397@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20210721202042.GA1472052@paulmck-ThinkPad-P17-Gen-1> <20210721202127.2129660-4-paulmck@kernel.org> <20210728173715.GA9416@paulmck-ThinkPad-P17-Gen-1> <1810346528.8990.1627495925037.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1810346528.8990.1627495925037.JavaMail.zimbra@efficios.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28, 2021 at 02:12:05PM -0400, Mathieu Desnoyers wrote: > ----- On Jul 28, 2021, at 1:58 PM, Linus Torvalds torvalds@linux-foundation.org wrote: > > > On Wed, Jul 28, 2021 at 10:37 AM Paul E. McKenney wrote: > >> > >> +/* > >> + * Increment the current CPU's rcu_data structure's ->dynticks field > >> + * with ordering. Return the new value. > >> + */ > >> +static noinstr unsigned long rcu_dynticks_inc(int incby) > >> +{ > >> + return arch_atomic_add_return(incby, this_cpu_ptr(&rcu_data.dynticks)); > >> +} > > > > Maybe inline? > > > > But more I reacted to how we sadly don't have percpu atomics. They'd > > be fairly easy to add on x86, but I guess it's not a huge deal. > > Are the percpu atomics you have in mind different from what is found in > Documentation/core-api/this_cpu_ops.rst ? > > Namely this_cpu_add_return(pcp, val) in this case. > > I must be missing something subtle because AFAIU those are already > available. Those per-cpu atomics don't provide any memory ordering > though, which may be why those are not used here. Good point, but this code does indeed need the ordering. It also must support the occasional off-CPU access. Thanx, Paul