All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	linux-kernel@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	Robert Love <rml@tech9.net>,
	kpreempt-tech@lists.sourceforge.net
Subject: [PATCH v2 02/26] preempt-locking.txt: standardize document format
Date: Sat, 17 Jun 2017 12:26:42 -0300	[thread overview]
Message-ID: <08f8cbeda85c646d869775f202eb476192d586fb.1497713221.git.mchehab@s-opensource.com> (raw)
In-Reply-To: <1a82f2bf2de4b016964cb71ff92dc3a472044f40.1497713221.git.mchehab@s-opensource.com>
In-Reply-To: <1a82f2bf2de4b016964cb71ff92dc3a472044f40.1497713221.git.mchehab@s-opensource.com>

Each text file under Documentation follows a different
format. Some doesn't even have titles!

Change its representation to follow the adopted standard,
using ReST markups for it to be parseable by Sphinx:

- mark titles;
- mark literal blocks;
- adjust identation where needed;
- use :Author: for authorship.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 Documentation/preempt-locking.txt | 40 ++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/Documentation/preempt-locking.txt b/Documentation/preempt-locking.txt
index e89ce6624af2..c945062be66c 100644
--- a/Documentation/preempt-locking.txt
+++ b/Documentation/preempt-locking.txt
@@ -1,10 +1,13 @@
-		  Proper Locking Under a Preemptible Kernel:
-		       Keeping Kernel Code Preempt-Safe
-			 Robert Love <rml@tech9.net>
-			  Last Updated: 28 Aug 2002
+===========================================================================
+Proper Locking Under a Preemptible Kernel: Keeping Kernel Code Preempt-Safe
+===========================================================================
 
+:Author: Robert Love <rml@tech9.net>
+:Last Updated: 28 Aug 2002
 
-INTRODUCTION
+
+Introduction
+============
 
 
 A preemptible kernel creates new locking issues.  The issues are the same as
@@ -17,9 +20,10 @@ requires protecting these situations.
  
 
 RULE #1: Per-CPU data structures need explicit protection
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
-Two similar problems arise. An example code snippet:
+Two similar problems arise. An example code snippet::
 
 	struct this_needs_locking tux[NR_CPUS];
 	tux[smp_processor_id()] = some_value;
@@ -35,6 +39,7 @@ You can also use put_cpu() and get_cpu(), which will disable preemption.
 
 
 RULE #2: CPU state must be protected.
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
 Under preemption, the state of the CPU must be protected.  This is arch-
@@ -52,6 +57,7 @@ However, fpu__restore() must be called with preemption disabled.
 
 
 RULE #3: Lock acquire and release must be performed by same task
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
 A lock acquired in one task must be released by the same task.  This
@@ -61,17 +67,20 @@ like this, acquire and release the task in the same code path and
 have the caller wait on an event by the other task.
 
 
-SOLUTION
+Solution
+========
 
 
 Data protection under preemption is achieved by disabling preemption for the
 duration of the critical region.
 
-preempt_enable()		decrement the preempt counter
-preempt_disable()		increment the preempt counter
-preempt_enable_no_resched()	decrement, but do not immediately preempt
-preempt_check_resched()		if needed, reschedule
-preempt_count()			return the preempt counter
+::
+
+  preempt_enable()		decrement the preempt counter
+  preempt_disable()		increment the preempt counter
+  preempt_enable_no_resched()	decrement, but do not immediately preempt
+  preempt_check_resched()	if needed, reschedule
+  preempt_count()		return the preempt counter
 
 The functions are nestable.  In other words, you can call preempt_disable
 n-times in a code path, and preemption will not be reenabled until the n-th
@@ -89,7 +98,7 @@ So use this implicit preemption-disabling property only if you know that the
 affected codepath does not do any of this. Best policy is to use this only for
 small, atomic code that you wrote and which calls no complex functions.
 
-Example:
+Example::
 
 	cpucache_t *cc; /* this is per-CPU */
 	preempt_disable();
@@ -102,7 +111,7 @@ Example:
 	return 0;
 
 Notice how the preemption statements must encompass every reference of the
-critical variables.  Another example:
+critical variables.  Another example::
 
 	int buf[NR_CPUS];
 	set_cpu_val(buf);
@@ -114,7 +123,8 @@ This code is not preempt-safe, but see how easily we can fix it by simply
 moving the spin_lock up two lines.
 
 
-PREVENTING PREEMPTION USING INTERRUPT DISABLING
+Preventing preemption using interrupt disabling
+===============================================
 
 
 It is possible to prevent a preemption event using local_irq_disable and
-- 
2.9.4

  reply	other threads:[~2017-06-17 15:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-17 15:26 [PATCH v2 01/26] pnp.txt: standardize document format Mauro Carvalho Chehab
2017-06-17 15:26 ` Mauro Carvalho Chehab [this message]
2017-06-17 15:26 ` [PATCH v2 03/26] printk-formats.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 04/26] pwm.txt: " Mauro Carvalho Chehab
2017-07-06  6:24   ` Thierry Reding
2017-06-17 15:26 ` [PATCH v2 05/26] rbtree.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 06/26] remoteproc.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 07/26] rfkill.txt: " Mauro Carvalho Chehab
2017-06-19  7:38   ` Johannes Berg
2017-06-17 15:26 ` [PATCH v2 08/26] robust-futex-ABI.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 09/26] robust-futexes.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 10/26] rpmsg.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 11/26] SAK.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 12/26] sgi-ioc4.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 13/26] siphash.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 14/26] SM501.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 15/26] smsc_ece1099.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 16/26] static-keys.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 17/26] svga.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 18/26] this_cpu_ops.txt: " Mauro Carvalho Chehab
2017-06-17 15:26 ` [PATCH v2 19/26] unaligned-memory-access.txt: " Mauro Carvalho Chehab
2017-06-17 15:27 ` [PATCH v2 20/26] vfio-mediated-device.txt: " Mauro Carvalho Chehab
2017-06-17 15:27 ` [PATCH v2 21/26] vfio.txt: " Mauro Carvalho Chehab
2017-06-17 15:27 ` [PATCH v2 22/26] video-output.txt: " Mauro Carvalho Chehab
2017-06-17 15:27 ` [PATCH v2 23/26] xillybus.txt: " Mauro Carvalho Chehab
2017-06-17 15:27 ` [PATCH v2 24/26] xz.txt: " Mauro Carvalho Chehab
2017-06-17 15:27 ` [PATCH v2 25/26] zorro.txt: " Mauro Carvalho Chehab
2017-06-19  8:35   ` Geert Uytterhoeven
2017-06-17 15:27 ` [PATCH v2 26/26] dell_rbu.txt: " Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=08f8cbeda85c646d869775f202eb476192d586fb.1497713221.git.mchehab@s-opensource.com \
    --to=mchehab@s-opensource.com \
    --cc=corbet@lwn.net \
    --cc=kpreempt-tech@lists.sourceforge.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=rml@tech9.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.