Skip to contentSkip to conversation

Documentation updates for v5.6

PATCH New Paul E. McKenney 1 participant 8 messages Dec 10, 2019

Subsystems (2)
lore
Share & tools
lore

Paul E. McKenney

author maintainer
#0 lore raw

cover Documentation updates for v5.6

Hello!

This series contains documentation updates for v5.6:

1. Convert arrayRCU.txt to arrayRCU.rst, courtesy of Madhuparna
Bhowmik.

2. Convert NMI-RCU.txt to NMI-RCU.rst, courtesy of Madhuparna
Bhowmik.

3. Convert whatisRCU.txt to .rst, courtesy of Phong Tran.

4. Convert to rcu_dereference.txt to rcu_dereference.rst, courtesy
of Amol Grover.

5. Convert to rcubarrier.txt to ReST, courtesy of Amol Grover.

6. Update full list of RCU API in whatisRCU.rst, courtesy of
Madhuparna Bhowmik.

7. Fix typo s/deference/dereference/.

Thanx, Paul

------------------------------------------------------------------------

 NMI-RCU.rst         |   53 ++++-----
 arrayRCU.rst        |   30 +++--
 index.rst           |    5 
 lockdep-splat.txt   |    2 
 rcu_dereference.rst |   75 +++++++------
 rcubarrier.rst      |  222 ++++++++++++++++++++++-----------------
 whatisRCU.rst       |  293 ++++++++++++++++++++++++++++++++--------------------
 7 files changed, 405 insertions(+), 275 deletions(-)
author maintainer
#1 lore raw

PATCH 1/7 doc: Convert arrayRCU.txt to arrayRCU.rst

From: Madhuparna Bhowmik <[email protected]>

This patch converts arrayRCU from .txt to .rst format, and also adds arrayRCU.rst to the index.rst file.

squash! Documentation: RCU: arrayRCU: Converted arrayRCU.txt to arrayRCU.rst

Also fix subject line.

---
 Documentation/RCU/{arrayRCU.txt => arrayRCU.rst} | 30 +++++++++++++++++-------
 Documentation/RCU/index.rst                      |  1 +
 2 files changed, 22 insertions(+), 9 deletions(-)
 rename Documentation/RCU/{arrayRCU.txt => arrayRCU.rst} (87%)
Documentation/RCU/arrayRCU.rst renamed from Documentation/RCU/arrayRCU.txt +21 -9
similarity index 87%
rename from Documentation/RCU/arrayRCU.txt
rename to Documentation/RCU/arrayRCU.rst
index f05a9af..743a4ea 100644
@@ -1,19 +1,21 @@
-Using RCU to Protect Read-Mostly Arrays
+.. _array_rcu_doc:
 
+Using RCU to Protect Read-Mostly Arrays
+=======================================
 
 Although RCU is more commonly used to protect linked lists, it can
 also be used to protect arrays.  Three situations are as follows:
 
-1.  Hash Tables
+1.  :ref:`Hash Tables <hash_tables>`
 
-2.  Static Arrays
+2.  :ref:`Static Arrays <static_arrays>`
 
-3.  Resizeable Arrays
+3.  :ref:`Resizeable Arrays <resizeable_arrays>`
 
 Each of these three situations involves an RCU-protected pointer to an
 array that is separately indexed.  It might be tempting to consider use
 of RCU to instead protect the index into an array, however, this use
-case is -not- supported.  The problem with RCU-protected indexes into
+case is **not** supported.  The problem with RCU-protected indexes into
 arrays is that compilers can play way too many optimization games with
 integers, which means that the rules governing handling of these indexes
 are far more trouble than they are worth.  If RCU-protected indexes into
@@ -24,16 +26,20 @@ to be safely used.
 That aside, each of the three RCU-protected pointer situations are
 described in the following sections.
 
+.. _hash_tables:
 
 Situation 1: Hash Tables
+------------------------
 
 Hash tables are often implemented as an array, where each array entry
 has a linked-list hash chain.  Each hash chain can be protected by RCU
 as described in the listRCU.txt document.  This approach also applies
 to other array-of-list situations, such as radix trees.
 
+.. _static_arrays:
 
 Situation 2: Static Arrays
+--------------------------
 
 Static arrays, where the data (rather than a pointer to the data) is
 located in each array element, and where the array is never resized,
@@ -41,11 +47,15 @@ have not been used with RCU.  Rik van Riel recommends using seqlock in
 this situation, which would also have minimal read-side overhead as long
 as updates are rare.
 
-Quick Quiz:  Why is it so important that updates be rare when
-	     using seqlock?
+Quick Quiz:
+		Why is it so important that updates be rare when using seqlock?
+
+:ref:`Answer to Quick Quiz <answer_quick_quiz_seqlock>`
 
+.. _resizeable_arrays:
 
 Situation 3: Resizeable Arrays
+------------------------------
 
 Use of RCU for resizeable arrays is demonstrated by the grow_ary()
 function formerly used by the System V IPC code.  The array is used
@@ -60,7 +70,7 @@ the remainder of the new, updates the ids->entries pointer to point to
 the new array, and invokes ipc_rcu_putref() to free up the old array.
 Note that rcu_assign_pointer() is used to update the ids->entries pointer,
 which includes any memory barriers required on whatever architecture
-you are running on.
+you are running on::
 
 	static int grow_ary(struct ipc_ids* ids, int newsize)
 	{
@@ -112,7 +122,7 @@ a simple check suffices.  The pointer to the structure corresponding
 to the desired IPC object is placed in "out", with NULL indicating
 a non-existent entry.  After acquiring "out->lock", the "out->deleted"
 flag indicates whether the IPC object is in the process of being
-deleted, and, if not, the pointer is returned.
+deleted, and, if not, the pointer is returned::
 
 	struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id)
 	{
@@ -144,8 +154,10 @@ deleted, and, if not, the pointer is returned.
 		return out;
 	}
 
+.. _answer_quick_quiz_seqlock:
 
 Answer to Quick Quiz:
+	Why is it so important that updates be rare when using seqlock?
 
 	The reason that it is important that updates be rare when
 	using seqlock is that frequent updates can livelock readers.
Documentation/RCU/index.rst +1 -0
index 5c99185..8d20d44 100644
@@ -7,6 +7,7 @@ RCU concepts
 .. toctree::
    :maxdepth: 3
 
+   arrayRCU
    rcu
    listRCU
    UP
Signature · 1 line
2.9.5
author maintainer
#2 lore raw

PATCH 2/7 doc: Converted NMI-RCU.txt to NMI-RCU.rst.

In reply to Paul E. McKenney

From: Madhuparna Bhowmik <[email protected]>

This patch converts NMI-RCU from txt to rst format. Also adds NMI-RCU in the index.rst file.

[ paulmck: Apply feedback from Phong Tran. ]
---
 Documentation/RCU/{NMI-RCU.txt => NMI-RCU.rst} | 53 ++++++++++++++------------
 Documentation/RCU/index.rst                    |  1 +
 2 files changed, 29 insertions(+), 25 deletions(-)
 rename Documentation/RCU/{NMI-RCU.txt => NMI-RCU.rst} (73%)
Documentation/RCU/NMI-RCU.rst renamed from Documentation/RCU/NMI-RCU.txt +28 -25
similarity index 73%
rename from Documentation/RCU/NMI-RCU.txt
rename to Documentation/RCU/NMI-RCU.rst
index 881353f..1809583 100644
@@ -1,4 +1,7 @@
+.. _NMI_rcu_doc:
+
 Using RCU to Protect Dynamic NMI Handlers
+=========================================
 
 
 Although RCU is usually used to protect read-mostly data structures,
@@ -9,7 +12,7 @@ work in "arch/x86/oprofile/nmi_timer_int.c" and in
 "arch/x86/kernel/traps.c".
 
 The relevant pieces of code are listed below, each followed by a
-brief explanation.
+brief explanation::
 
 	static int dummy_nmi_callback(struct pt_regs *regs, int cpu)
 	{
@@ -18,12 +21,12 @@ brief explanation.
 
 The dummy_nmi_callback() function is a "dummy" NMI handler that does
 nothing, but returns zero, thus saying that it did nothing, allowing
-the NMI handler to take the default machine-specific action.
+the NMI handler to take the default machine-specific action::
 
 	static nmi_callback_t nmi_callback = dummy_nmi_callback;
 
 This nmi_callback variable is a global function pointer to the current
-NMI handler.
+NMI handler::
 
 	void do_nmi(struct pt_regs * regs, long error_code)
 	{
@@ -53,11 +56,12 @@ anyway.  However, in practice it is a good documentation aid, particularly
 for anyone attempting to do something similar on Alpha or on systems
 with aggressive optimizing compilers.
 
-Quick Quiz:  Why might the rcu_dereference_sched() be necessary on Alpha,
-	     given that the code referenced by the pointer is read-only?
+Quick Quiz:
+		Why might the rcu_dereference_sched() be necessary on Alpha, given that the code referenced by the pointer is read-only?
 
+:ref:`Answer to Quick Quiz <answer_quick_quiz_NMI>`
 
-Back to the discussion of NMI and RCU...
+Back to the discussion of NMI and RCU::
 
 	void set_nmi_callback(nmi_callback_t callback)
 	{
@@ -68,7 +72,7 @@ The set_nmi_callback() function registers an NMI handler.  Note that any
 data that is to be used by the callback must be initialized up -before-
 the call to set_nmi_callback().  On architectures that do not order
 writes, the rcu_assign_pointer() ensures that the NMI handler sees the
-initialized values.
+initialized values::
 
 	void unset_nmi_callback(void)
 	{
@@ -82,7 +86,7 @@ up any data structures used by the old NMI handler until execution
 of it completes on all other CPUs.
 
 One way to accomplish this is via synchronize_rcu(), perhaps as
-follows:
+follows::
 
 	unset_nmi_callback();
 	synchronize_rcu();
@@ -98,24 +102,23 @@ to free up the handler's data as soon as synchronize_rcu() returns.
 Important note: for this to work, the architecture in question must
 invoke nmi_enter() and nmi_exit() on NMI entry and exit, respectively.
 
+.. _answer_quick_quiz_NMI:
 
-Answer to Quick Quiz
-
-	Why might the rcu_dereference_sched() be necessary on Alpha, given
-	that the code referenced by the pointer is read-only?
+Answer to Quick Quiz:
+	Why might the rcu_dereference_sched() be necessary on Alpha, given that the code referenced by the pointer is read-only?
 
-	Answer: The caller to set_nmi_callback() might well have
-		initialized some data that is to be used by the new NMI
-		handler.  In this case, the rcu_dereference_sched() would
-		be needed, because otherwise a CPU that received an NMI
-		just after the new handler was set might see the pointer
-		to the new NMI handler, but the old pre-initialized
-		version of the handler's data.
+	The caller to set_nmi_callback() might well have
+	initialized some data that is to be used by the new NMI
+	handler.  In this case, the rcu_dereference_sched() would
+	be needed, because otherwise a CPU that received an NMI
+	just after the new handler was set might see the pointer
+	to the new NMI handler, but the old pre-initialized
+	version of the handler's data.
 
-		This same sad story can happen on other CPUs when using
-		a compiler with aggressive pointer-value speculation
-		optimizations.
+	This same sad story can happen on other CPUs when using
+	a compiler with aggressive pointer-value speculation
+	optimizations.
 
-		More important, the rcu_dereference_sched() makes it
-		clear to someone reading the code that the pointer is
-		being protected by RCU-sched.
+	More important, the rcu_dereference_sched() makes it
+	clear to someone reading the code that the pointer is
+	being protected by RCU-sched.
Documentation/RCU/index.rst +1 -0
index 8d20d44..627128c 100644
@@ -10,6 +10,7 @@ RCU concepts
    arrayRCU
    rcu
    listRCU
+   NMI-RCU
    UP
 
    Design/Memory-Ordering/Tree-RCU-Memory-Ordering
Signature · 1 line
2.9.5
author maintainer
#3 lore raw

PATCH 3/7 doc: Convert whatisRCU.txt to .rst

In reply to Paul E. McKenney

From: Phong Tran <[email protected]>

This commit updates whatisRCU.txt to the new .rst format. This change includes:

- Formatting bullet lists
- Adding literal blocks
- Links from table of contents to corresponding sections
- Links to external documents
- Reformat quick quizzes

[ tranmanphong: Apply Amol Grover feedback. ]
---
 Documentation/RCU/index.rst                        |   1 +
 Documentation/RCU/{whatisRCU.txt => whatisRCU.rst} | 284 +++++++++++++--------
 2 files changed, 178 insertions(+), 107 deletions(-)
 rename Documentation/RCU/{whatisRCU.txt => whatisRCU.rst} (84%)
Documentation/RCU/index.rst +1 -0
index 627128c..b9b1148 100644
@@ -8,6 +8,7 @@ RCU concepts
    :maxdepth: 3
 
    arrayRCU
+   whatisRCU
    rcu
    listRCU
    NMI-RCU
Documentation/RCU/whatisRCU.rst renamed from Documentation/RCU/whatisRCU.txt +177 -107

636 lines not on this page · raw message

Signature · 1 line
2.9.5
author maintainer
#4 lore raw

PATCH 4/7 doc: Convert to rcu_dereference.txt to rcu_dereference.rst

In reply to Paul E. McKenney

From: Amol Grover <[email protected]>

This patch converts rcu_dereference.txt to rcu_dereference.rst and adds it to index.rst

---
 Documentation/RCU/index.rst                        |  1 +
 .../{rcu_dereference.txt => rcu_dereference.rst}   | 75 ++++++++++++----------
 2 files changed, 42 insertions(+), 34 deletions(-)
 rename Documentation/RCU/{rcu_dereference.txt => rcu_dereference.rst} (88%)
Documentation/RCU/index.rst +1 -0
index b9b1148..c81d0e4 100644
@@ -8,6 +8,7 @@ RCU concepts
    :maxdepth: 3
 
    arrayRCU
+   rcu_dereference
    whatisRCU
    rcu
    listRCU
Documentation/RCU/rcu_dereference.rst renamed from Documentation/RCU/rcu_dereference.txt +41 -34

265 lines not on this page · raw message

Signature · 1 line
2.9.5
author maintainer
#5 lore raw

PATCH 5/7 doc: Convert to rcubarrier.txt to ReST

In reply to Paul E. McKenney

From: Amol Grover <[email protected]>

Convert rcubarrier.txt to rcubarrier.rst and add it to index.rst.

Format file according to reST
- Add headings and sub-headings
- Add code segments
- Add cross-references to quizes and answers

---
 Documentation/RCU/index.rst                        |   1 +
 .../RCU/{rcubarrier.txt => rcubarrier.rst}         | 222 ++++++++++++---------
 2 files changed, 126 insertions(+), 97 deletions(-)
 rename Documentation/RCU/{rcubarrier.txt => rcubarrier.rst} (72%)
Documentation/RCU/index.rst +1 -0
index c81d0e4..81a0a1e 100644
@@ -8,6 +8,7 @@ RCU concepts
    :maxdepth: 3
 
    arrayRCU
+   rcubarrier
    rcu_dereference
    whatisRCU
    rcu
Documentation/RCU/rcubarrier.rst renamed from Documentation/RCU/rcubarrier.txt +125 -97

345 lines not on this page · raw message

Signature · 1 line
2.9.5
author maintainer
#6 lore raw

PATCH 6/7 doc: Updated full list of RCU API in whatisRCU.rst

In reply to Paul E. McKenney

From: Madhuparna Bhowmik <[email protected]>

This patch updates the list of RCU API in whatisRCU.rst.

---
 Documentation/RCU/whatisRCU.rst | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/RCU/whatisRCU.rst +7 -2
index 2f6f6eb..c7f147b 100644
@@ -884,11 +884,14 @@ in docbook.  Here is the list, by category.
 RCU list traversal::
 
 	list_entry_rcu
+	list_entry_lockless
 	list_first_entry_rcu
 	list_next_rcu
 	list_for_each_entry_rcu
 	list_for_each_entry_continue_rcu
 	list_for_each_entry_from_rcu
+	list_first_or_null_rcu
+	list_next_or_null_rcu
 	hlist_first_rcu
 	hlist_next_rcu
 	hlist_pprev_rcu
@@ -902,7 +905,7 @@ RCU list traversal::
 	hlist_bl_first_rcu
 	hlist_bl_for_each_entry_rcu
 
-RCU pointer/list udate::
+RCU pointer/list update::
 
 	rcu_assign_pointer
 	list_add_rcu
@@ -912,10 +915,12 @@ RCU pointer/list udate::
 	hlist_add_behind_rcu
 	hlist_add_before_rcu
 	hlist_add_head_rcu
+	hlist_add_tail_rcu
 	hlist_del_rcu
 	hlist_del_init_rcu
 	hlist_replace_rcu
-	list_splice_init_rcu()
+	list_splice_init_rcu
+	list_splice_tail_init_rcu
 	hlist_nulls_del_init_rcu
 	hlist_nulls_del_rcu
 	hlist_nulls_add_head_rcu
Signature · 1 line
2.9.5
author maintainer
#7 lore raw

PATCH 7/7 doc: Fix typo s/deference/dereference/

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

---
 Documentation/RCU/lockdep-splat.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/RCU/lockdep-splat.txt +1 -1
index 9c01597..b809631 100644
@@ -99,7 +99,7 @@ With this change, the rcu_dereference() is always within an RCU
 read-side critical section, which again would have suppressed the
 above lockdep-RCU splat.
 
-But in this particular case, we don't actually deference the pointer
+But in this particular case, we don't actually dereference the pointer
 returned from rcu_dereference().  Instead, that pointer is just compared
 to the cic pointer, which means that the rcu_dereference() can be replaced
 by rcu_access_pointer() as follows:
Signature · 1 line
2.9.5