Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4063709ybx; Mon, 4 Nov 2019 07:17:16 -0800 (PST) X-Google-Smtp-Source: APXvYqx6ocEA8YlttGLKRfs1nfDIJP1GXB+xOlQeiPkJdhWKzMNQdHqOi71SewZq/21K4aYK3gBd X-Received: by 2002:a17:906:e243:: with SMTP id gq3mr24633863ejb.302.1572880636376; Mon, 04 Nov 2019 07:17:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572880636; cv=none; d=google.com; s=arc-20160816; b=dpROgEw2Z1vf/qcR3RjqKJz2qRisKLeptnbXQCAOZafsCn0ZpKXOAO1vwZBvfbDi3h 3fXMpS9r8N2Vyu9tnDhG0yOkVGkmSvOFz5s9xS+Q6UWbtU5DnFBvULXo6/IV3Xktcvc1 FzrRvYT9RVmU/4jkiVKOM2ow01HvLaebAgN26BuZ5Rb/ObYDzMCykHnVHQtFcc8qzTLu 88dDV9tdwqlXgC+5WSNHEJkPl43YXCeFigR2d4Oyxl6N6BhfjIuXqreZmCxQ52bNmgGc yN/Ilhk8dZ/JQDN/nEklC3OFOiZwpXkW4Z5Hh/q7g+t7heg5XIVFmJPwYibEwsZJopbi mb6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from; bh=V9qur7KZ7SylGtbdLxUqgjJVkSC6S3ABoMTJ4w7rdag=; b=TRDSa+88l+5WNn89Wq+AV7A/vbHtoHf2bBbawivx0n/YikXyoxdpJvSY2WLqL0uglW DHZRtxLLlKaRjU8L9UxlieEYVAXRwdmioLpUURz6pzHcl+p+Mw8lBw2rOsHXi/ouFtdM JQk0HG6+ko1ZGwuEbXsmbmZOP/moBiYSq4Fmsx9AGNcnbNNMnG3/borVfE6Xudrxm6t5 UkV/EP6GcpHehGaCSKUo4oWZ9ycqSiW+6F6mdr4L2b6IglZED0fQzIusqnDxTjQLK9V5 //N0ijafOI0zlu58zZjSYBBzMWtvfq1e/JbxJoPu7fbTBEuS0HodiIcqZMGC7GM7HVsI vdEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11si8188827edd.182.2019.11.04.07.16.52; Mon, 04 Nov 2019 07:17:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729061AbfKDPPn (ORCPT + 99 others); Mon, 4 Nov 2019 10:15:43 -0500 Received: from mga07.intel.com ([134.134.136.100]:54743 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727796AbfKDPPn (ORCPT ); Mon, 4 Nov 2019 10:15:43 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2019 07:15:41 -0800 X-IronPort-AV: E=Sophos;i="5.68,267,1569308400"; d="scan'208";a="195481925" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2019 07:15:36 -0800 From: Jani Nikula To: Amol Grover , "Paul E. McKenney" , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Jonathan Corbet Cc: rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Shuah Khan , Joel Fernandes Subject: Re: [PATCH] Documentation: RCU: whatisRCU: Fix formatting for section 2 In-Reply-To: <20191104133315.GA14499@workstation-kernel-dev> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20191104133315.GA14499@workstation-kernel-dev> Date: Mon, 04 Nov 2019 17:15:34 +0200 Message-ID: <87pni77jvt.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 04 Nov 2019, Amol Grover wrote: > Convert RCU API method text to sub-headings and > add hyperlink and superscript to 2 literary notes > under rcu_dereference() section > > Signed-off-by: Amol Grover > --- > Documentation/RCU/whatisRCU.rst | 34 +++++++++++++++++++++++++++------ > 1 file changed, 28 insertions(+), 6 deletions(-) > > diff --git a/Documentation/RCU/whatisRCU.rst b/Documentation/RCU/whatisRCU.rst > index ae40c8bcc56c..3cf6e17d0065 100644 > --- a/Documentation/RCU/whatisRCU.rst > +++ b/Documentation/RCU/whatisRCU.rst > @@ -150,6 +150,7 @@ later. See the kernel docbook documentation for more info, or look directly > at the function header comments. > > rcu_read_lock() > +^^^^^^^^^^^^^^^ > > void rcu_read_lock(void); > > @@ -164,6 +165,7 @@ rcu_read_lock() > longer-term references to data structures. > > rcu_read_unlock() > +^^^^^^^^^^^^^^^^^ > > void rcu_read_unlock(void); > > @@ -172,6 +174,7 @@ rcu_read_unlock() > read-side critical sections may be nested and/or overlapping. > > synchronize_rcu() > +^^^^^^^^^^^^^^^^^ > > void synchronize_rcu(void); > > @@ -225,6 +228,7 @@ synchronize_rcu() > checklist.txt for some approaches to limiting the update rate. > > rcu_assign_pointer() > +^^^^^^^^^^^^^^^^^^^^ > > void rcu_assign_pointer(p, typeof(p) v); > > @@ -245,6 +249,7 @@ rcu_assign_pointer() > the _rcu list-manipulation primitives such as list_add_rcu(). > > rcu_dereference() > +^^^^^^^^^^^^^^^^^ > > typeof(p) rcu_dereference(p); > > @@ -279,8 +284,10 @@ rcu_dereference() > if an update happened while in the critical section, and incur > unnecessary overhead on Alpha CPUs. > > +.. _back_to_1: > + > Note that the value returned by rcu_dereference() is valid > - only within the enclosing RCU read-side critical section [1]. > + only within the enclosing RCU read-side critical section |cs_1|. > For example, the following is -not- legal:: > > rcu_read_lock(); > @@ -298,15 +305,27 @@ rcu_dereference() > it was acquired is just as illegal as doing so with normal > locking. > > +.. _back_to_2: > + > As with rcu_assign_pointer(), an important function of > rcu_dereference() is to document which pointers are protected by > RCU, in particular, flagging a pointer that is subject to changing > at any time, including immediately after the rcu_dereference(). > And, again like rcu_assign_pointer(), rcu_dereference() is > typically used indirectly, via the _rcu list-manipulation > - primitives, such as list_for_each_entry_rcu() [2]. > + primitives, such as list_for_each_entry_rcu() |entry_2|. > + > +.. |cs_1| raw:: html Please don't use raw. It's ugly and error prone. We have some raw output for latex, but this would be the first for html. What are you trying to achieve? BR, Jani. > + > + [1] > + > +.. |entry_2| raw:: html > > - [1] The variant rcu_dereference_protected() can be used outside > + [2] > + > +.. _cs: > + > + \ :sup:`[1]`\ The variant rcu_dereference_protected() can be used outside > of an RCU read-side critical section as long as the usage is > protected by locks acquired by the update-side code. This variant > avoids the lockdep warning that would happen when using (for > @@ -317,15 +336,18 @@ rcu_dereference() > a lockdep expression to indicate which locks must be acquired > by the caller. If the indicated protection is not provided, > a lockdep splat is emitted. See Documentation/RCU/Design/Requirements/Requirements.rst > - and the API's code comments for more details and example usage. > + and the API's code comments for more details and example usage. :ref:`back ` > + > + > +.. _entry: > > - [2] If the list_for_each_entry_rcu() instance might be used by > + \ :sup:`[2]`\ If the list_for_each_entry_rcu() instance might be used by > update-side code as well as by RCU readers, then an additional > lockdep expression can be added to its list of arguments. > For example, given an additional "lock_is_held(&mylock)" argument, > the RCU lockdep code would complain only if this instance was > invoked outside of an RCU read-side critical section and without > - the protection of mylock. > + the protection of mylock. :ref:`back ` > > The following diagram shows how each API communicates among the > reader, updater, and reclaimer. -- Jani Nikula, Intel Open Source Graphics Center