Skip to contentSkip to conversation

Misc updates and fixes

PATCH Superseded Akira Yokosawa 2 participants 15 messages Mar 13, 2017 – Mar 14, 2017

lore
Share & tools
lore
#0 lore raw

cover Misc updates and fixes

From 93e02eca9bb8361be47e0936f5d2ca56586bc093 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 14 Mar 2017 07:38:12 +0900
Subject: [PATCH 0/6] Misc updates and fixes

Hi Paul,

This patch set contains misc updates and fixes I noticed while comparing current perfbook contents and your draft LWN article.

Thanks, Akira
--
Akira Yokosawa (6):
runlatex.sh: Refactor further
formal/spinhint: Fix typo
formal/spinhint: Adjust option of enumerate list formal/spinhint: Refer explicit Figure labels advsync/memorybarriers: Refer explicit Figure label advsync/memorybarriers: Distinguish 'CPU family' from 'CPU'

 advsync/memorybarriers.tex | 13 +++++++------
 formal/spinhint.tex        | 16 +++++++++-------
 utilities/runlatex.sh      | 27 +++++++++++++++++----------
 3 files changed, 33 insertions(+), 23 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/6 runlatex.sh: Refactor further

From a87bed749d870ce45fd7b328f4099a58271dfa20 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:42:39 +0900
Subject: [PATCH 1/6] runlatex.sh: Refactor further

This won't result in reducing line count, but is worth doing.

---
 utilities/runlatex.sh | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)
utilities/runlatex.sh +17 -10
index e6b3938..cece545 100644
@@ -39,6 +39,17 @@ diff_warning () {
 	fi
 }
 
+identical_warnings () {
+	if test -r $basename-warning-prev.log
+	then
+		if test "$iter" -gt "$min_iter" && diff_warning
+		then
+			return 0 ;
+		fi
+	fi
+	return 1 ;
+}
+
 iterate_latex () {
 	pdflatex $basename > /dev/null 2>&1 < /dev/null || :
 	if grep -q '! Emergency stop.' $basename.log
@@ -76,27 +87,23 @@ rm -f $basename-first.log
 iter=2
 echo "pdflatex 2 for $basename.pdf # for possible bib update"
 iterate_latex
+min_iter=2
 while grep -q 'LaTeX Warning: There were undefined references' $basename.log
 do
-	if test -r $basename-warning-prev.log
+	if identical_warnings
 	then
-		if test "$iter" -gt 2 && diff_warning
-		then
-			break
-		fi
+		break
 	fi
 	iter=`expr $iter + 1`
 	echo "pdflatex $iter for $basename.pdf # remaining undefined refs"
 	iterate_latex
 done
+min_iter=3
 while grep -q 'LaTeX Warning: Label(s) may have changed' $basename.log
 do
-	if test -r $basename-warning-prev.log
+	if identical_warnings
 	then
-		if test "$iter" -gt 3 && diff_warning
-		then
-			break
-		fi
+		break
 	fi
 	iter=`expr $iter + 1`
 	echo "pdflatex $iter for $basename.pdf # label(s) may have changed"
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/6 formal/spinhint: Fix typo

In reply to Akira Yokosawa

From 32cf4c216eb3b0c8395ecff9ffa2e53e1e415c89 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:47:29 +0900
Subject: [PATCH 2/6] formal/spinhint: Fix typo

---
 formal/spinhint.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
formal/spinhint.tex +2 -2
index 87a7040..a10b57b 100644
@@ -854,8 +854,8 @@ latencies of most other RCU implementations.
 \item	There are \co{qrcu_read_lock()} and \co{qrcu_read_unlock()}
 	primitives that delimit QRCU read-side critical sections.
 	The corresponding \co{qrcu_struct} must be passed into
-	these primitives, and the return value from \co{rcu_read_lock()}
-	must be passed to \co{rcu_read_unlock()}.
+	these primitives, and the return value from \co{qrcu_read_lock()}
+	must be passed to \co{qrcu_read_unlock()}.
 
 	For example:
 
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/6 formal/spinhint: Adjust option of enumerate list

In reply to Akira Yokosawa

From fe01252839978d67b611eafca1c49e8772582fd2 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:47:56 +0900
Subject: [PATCH 3/6] formal/spinhint: Adjust option of enumerate list

This enumeration list can be optimized by specifying starting count and label format. It is also better to use a narrower item separation.

---
 formal/spinhint.tex | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
formal/spinhint.tex +4 -4
index a10b57b..d6acef1 100644
@@ -924,10 +924,10 @@ sections).
 The \co{readerprogress} array elements have values as follows,
 indicating the state of the corresponding reader:
 
-\begin{enumerate}
-\item	0: not yet started.
-\item	1: within QRCU read-side critical section.
-\item	2: finished with QRCU read-side critical section.
+\begin{enumerate}[label={\arabic*}:,start=0,itemsep=0pt]
+\item	not yet started.
+\item	within QRCU read-side critical section.
+\item	finished with QRCU read-side critical section.
 \end{enumerate}
 
 Finally, the \co{mutex} variable is used to serialize updaters' slowpaths.
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/6 formal/spinhint: Refer explicit Figure labels

In reply to Akira Yokosawa

From 7211be04d75a719b92754c2d14d7d23e5656be30 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:48:23 +0900
Subject: [PATCH 4/6] formal/spinhint: Refer explicit Figure labels

Referring floating figures should be done by labels.

---
 formal/spinhint.tex | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
formal/spinhint.tex +3 -1
index d6acef1..a18ae23 100644
@@ -742,7 +742,9 @@ Lines~30 and~31 initialize the control variables,
 lines~32-40 atomically sum the havelock array entries,
 line~41 is the assertion, and line~42 exits the loop.
 
-We can run this model by placing the above two code fragments into
+We can run this model by placing the two code fragments of
+Figures~\ref{fig:analysis:Promela Code for Spinlock}
+and~\ref{fig:analysis:Promela Code to Test Spinlocks} into
 files named \path{lock.h} and \path{lock.spin}, respectively, and then running
 the following commands:
 
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/6 advsync/memorybarriers: Refer explicit Figure label

In reply to Akira Yokosawa

From c6cab8f8a30053825be79d4701ade5e847b64fb3 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:50:12 +0900
Subject: [PATCH 5/6] advsync/memorybarriers: Refer explicit Figure label

---
 advsync/memorybarriers.tex | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
advsync/memorybarriers.tex +2 -1
index 98f7787..85e9162 100644
@@ -1135,7 +1135,8 @@ appears to be maintained.  Similarly, the compiler may also arrange the
 instructions it emits in any order it likes, provided it doesn't affect the
 apparent operation of the program.
 
-So in the above diagram, the effects of the memory operations performed by a
+So in Figure~\ref{fig:advsync:Abstract Memory Access Model},
+the effects of the memory operations performed by a
 CPU are perceived by the rest of the system as the operations cross the
 interface between the CPU and rest of the system (the dotted lines).
 
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/6 advsync/memorybarriers: Distinguish 'CPU family' from 'CPU'

In reply to Akira Yokosawa

From 93e02eca9bb8361be47e0936f5d2ca56586bc093 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:50:56 +0900
Subject: [PATCH 6/6] advsync/memorybarriers: Distinguish 'CPU family' from 'CPU'

In these paragraphs, "CPU" stands for either "CPU core" or "CPU family". Explicitly use "CPU family" for the latter.

---
 advsync/memorybarriers.tex | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
advsync/memorybarriers.tex +5 -5
index 85e9162..15ed1f6 100644
@@ -415,11 +415,11 @@ If you just want to be told what the rules are rather than suffering
 through the actual derivation,
 please feel free to skip to Section~\ref{sec:advsync:A Few Simple Rules}.
 
-The exact semantics of memory barriers vary wildly from one CPU to
+The exact semantics of memory barriers vary wildly from one CPU family to
 another, so portable code must rely only on the least-common-denominator
 semantics of memory barriers.
 
-Fortunately, all CPUs impose the following rules:
+Fortunately, all CPU families impose the following rules:
 \begin{enumerate}
 \item	All accesses by a given CPU will appear to that CPU to have
 	occurred in program order.
@@ -442,9 +442,9 @@ Each of these properties is described in the following sections.
 A given CPU will see its own accesses as occurring in ``program order'',
 as if the CPU was executing only one instruction at a time with no
 reordering or speculation.
-For older CPUs, this restriction is necessary for binary compatibility,
+For older CPU families, this restriction is necessary for binary compatibility,
 and only secondarily for the sanity of us software types.
-There have been a few CPUs that violate this rule to a limited extent,
+There have been a few CPU families that violate this rule to a limited extent,
 but in those cases, the compiler has been responsible
 for ensuring that ordering is explicitly enforced as needed.
 
@@ -511,7 +511,7 @@ of an external logic analyzer
 However, if CPU~2's access to B sees the result of CPU~1's access
 to B, then CPU~2's access to A is guaranteed to see the result of
 CPU~1's access to A.
-Although some CPUs' memory barriers do in fact provide stronger,
+Although some CPU families' memory barriers do in fact provide stronger,
 unconditional ordering guarantees, portable code may rely only
 on this weaker if-then conditional ordering guarantee.
 
Signature · 1 line
2.7.4
#7 lore raw

v2 cover Misc updates

In reply to Akira Yokosawa

From ad3fca471bd3a6178f7988bbe5c9ab903f86722a Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 14 Mar 2017 21:30:58 +0900
Subject: [PATCH v2 0/6] Misc updates

Hi Paul,

I fixed grammatical errors in commit logs.
No change in diffs.

Thanks, Akira
--
Akira Yokosawa (6):
runlatex.sh: Refactor further
formal/spinhint: Fix typo
formal/spinhint: Adjust option of enumerate list formal/spinhint: Reference by Figure labels advsync/memorybarriers: Reference by Figure label advsync/memorybarriers: Distinguish 'CPU family' from 'CPU'

 advsync/memorybarriers.tex | 13 +++++++------
 formal/spinhint.tex        | 16 +++++++++-------
 utilities/runlatex.sh      | 27 +++++++++++++++++----------
 3 files changed, 33 insertions(+), 23 deletions(-)
Signature · 1 line
2.7.4
#8 lore raw

PATCH v2 1/6 runlatex.sh: Refactor further

From a87bed749d870ce45fd7b328f4099a58271dfa20 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:42:39 +0900
Subject: [PATCH v2 1/6] runlatex.sh: Refactor further

This won't result in reducing line count, but is worth doing.

---
 utilities/runlatex.sh | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)
utilities/runlatex.sh +17 -10
index e6b3938..cece545 100644
@@ -39,6 +39,17 @@ diff_warning () {
 	fi
 }
 
+identical_warnings () {
+	if test -r $basename-warning-prev.log
+	then
+		if test "$iter" -gt "$min_iter" && diff_warning
+		then
+			return 0 ;
+		fi
+	fi
+	return 1 ;
+}
+
 iterate_latex () {
 	pdflatex $basename > /dev/null 2>&1 < /dev/null || :
 	if grep -q '! Emergency stop.' $basename.log
@@ -76,27 +87,23 @@ rm -f $basename-first.log
 iter=2
 echo "pdflatex 2 for $basename.pdf # for possible bib update"
 iterate_latex
+min_iter=2
 while grep -q 'LaTeX Warning: There were undefined references' $basename.log
 do
-	if test -r $basename-warning-prev.log
+	if identical_warnings
 	then
-		if test "$iter" -gt 2 && diff_warning
-		then
-			break
-		fi
+		break
 	fi
 	iter=`expr $iter + 1`
 	echo "pdflatex $iter for $basename.pdf # remaining undefined refs"
 	iterate_latex
 done
+min_iter=3
 while grep -q 'LaTeX Warning: Label(s) may have changed' $basename.log
 do
-	if test -r $basename-warning-prev.log
+	if identical_warnings
 	then
-		if test "$iter" -gt 3 && diff_warning
-		then
-			break
-		fi
+		break
 	fi
 	iter=`expr $iter + 1`
 	echo "pdflatex $iter for $basename.pdf # label(s) may have changed"
Signature · 1 line
2.7.4
#9 lore raw

Re: [PATCH v2 1/6] runlatex.sh: Refactor further

Quoted 6 lines · Akira Yokosawa
Quoted 1 line

From a87bed749d870ce45fd7b328f4099a58271dfa20 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:42:39 +0900
Subject: [PATCH v2 1/6] runlatex.sh: Refactor further

This won't result in reducing line count, but is worth doing.

I applied and pushed this v2 series, thank you!

Thanx, Paul

Quoted 65 lines
---
 utilities/runlatex.sh | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)
utilities/runlatex.sh +17 -10
index e6b3938..cece545 100644
@@ -39,6 +39,17 @@ diff_warning () {
 	fi
 }
 
+identical_warnings () {
+	if test -r $basename-warning-prev.log
+	then
+		if test "$iter" -gt "$min_iter" && diff_warning
+		then
+			return 0 ;
+		fi
+	fi
+	return 1 ;
+}
+
 iterate_latex () {
 	pdflatex $basename > /dev/null 2>&1 < /dev/null || :
 	if grep -q '! Emergency stop.' $basename.log
@@ -76,27 +87,23 @@ rm -f $basename-first.log
 iter=2
 echo "pdflatex 2 for $basename.pdf # for possible bib update"
 iterate_latex
+min_iter=2
 while grep -q 'LaTeX Warning: There were undefined references' $basename.log
 do
-	if test -r $basename-warning-prev.log
+	if identical_warnings
 	then
-		if test "$iter" -gt 2 && diff_warning
-		then
-			break
-		fi
+		break
 	fi
 	iter=`expr $iter + 1`
 	echo "pdflatex $iter for $basename.pdf # remaining undefined refs"
 	iterate_latex
 done
+min_iter=3
 while grep -q 'LaTeX Warning: Label(s) may have changed' $basename.log
 do
-	if test -r $basename-warning-prev.log
+	if identical_warnings
 	then
-		if test "$iter" -gt 3 && diff_warning
-		then
-			break
-		fi
+		break
 	fi
 	iter=`expr $iter + 1`
 	echo "pdflatex $iter for $basename.pdf # label(s) may have changed"
Signature · 1 line
2.7.4
#10 lore raw

PATCH v2 2/6 formal/spinhint: Fix typo

In reply to Akira Yokosawa

From 32cf4c216eb3b0c8395ecff9ffa2e53e1e415c89 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:47:29 +0900
Subject: [PATCH v2 2/6] formal/spinhint: Fix typo

---
 formal/spinhint.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
formal/spinhint.tex +2 -2
index 87a7040..a10b57b 100644
@@ -854,8 +854,8 @@ latencies of most other RCU implementations.
 \item	There are \co{qrcu_read_lock()} and \co{qrcu_read_unlock()}
 	primitives that delimit QRCU read-side critical sections.
 	The corresponding \co{qrcu_struct} must be passed into
-	these primitives, and the return value from \co{rcu_read_lock()}
-	must be passed to \co{rcu_read_unlock()}.
+	these primitives, and the return value from \co{qrcu_read_lock()}
+	must be passed to \co{qrcu_read_unlock()}.
 
 	For example:
 
Signature · 1 line
2.7.4
#11 lore raw

PATCH v2 3/6 formal/spinhint: Adjust option of enumerate list

In reply to Akira Yokosawa

From fe01252839978d67b611eafca1c49e8772582fd2 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:47:56 +0900
Subject: [PATCH v2 3/6] formal/spinhint: Adjust option of enumerate list

This enumeration list can be optimized by specifying starting count and label format. It is also better to use a narrower item separation.

---
 formal/spinhint.tex | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
formal/spinhint.tex +4 -4
index a10b57b..d6acef1 100644
@@ -924,10 +924,10 @@ sections).
 The \co{readerprogress} array elements have values as follows,
 indicating the state of the corresponding reader:
 
-\begin{enumerate}
-\item	0: not yet started.
-\item	1: within QRCU read-side critical section.
-\item	2: finished with QRCU read-side critical section.
+\begin{enumerate}[label={\arabic*}:,start=0,itemsep=0pt]
+\item	not yet started.
+\item	within QRCU read-side critical section.
+\item	finished with QRCU read-side critical section.
 \end{enumerate}
 
 Finally, the \co{mutex} variable is used to serialize updaters' slowpaths.
Signature · 1 line
2.7.4
#12 lore raw

PATCH v2 4/6 formal/spinhint: Reference by Figure labels

In reply to Akira Yokosawa

From 267bc5727f8f50d389818c22c81ea9a6e1d810e4 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:48:23 +0900
Subject: [PATCH v2 4/6] formal/spinhint: Reference by Figure labels

Reference to floating figures should be done by labels.

---
 formal/spinhint.tex | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
formal/spinhint.tex +3 -1
index d6acef1..a18ae23 100644
@@ -742,7 +742,9 @@ Lines~30 and~31 initialize the control variables,
 lines~32-40 atomically sum the havelock array entries,
 line~41 is the assertion, and line~42 exits the loop.
 
-We can run this model by placing the above two code fragments into
+We can run this model by placing the two code fragments of
+Figures~\ref{fig:analysis:Promela Code for Spinlock}
+and~\ref{fig:analysis:Promela Code to Test Spinlocks} into
 files named \path{lock.h} and \path{lock.spin}, respectively, and then running
 the following commands:
 
Signature · 1 line
2.7.4
#13 lore raw

PATCH v2 5/6 advsync/memorybarriers: Reference by Figure label

In reply to Akira Yokosawa

From e495d83986561ebddebc268abdd82284060f1a50 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:50:12 +0900
Subject: [PATCH v2 5/6] advsync/memorybarriers: Reference by Figure label

---
 advsync/memorybarriers.tex | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
advsync/memorybarriers.tex +2 -1
index 98f7787..85e9162 100644
@@ -1135,7 +1135,8 @@ appears to be maintained.  Similarly, the compiler may also arrange the
 instructions it emits in any order it likes, provided it doesn't affect the
 apparent operation of the program.
 
-So in the above diagram, the effects of the memory operations performed by a
+So in Figure~\ref{fig:advsync:Abstract Memory Access Model},
+the effects of the memory operations performed by a
 CPU are perceived by the rest of the system as the operations cross the
 interface between the CPU and rest of the system (the dotted lines).
 
Signature · 1 line
2.7.4
#14 lore raw

PATCH v2 6/6 advsync/memorybarriers: Distinguish 'CPU family' from 'CPU'

In reply to Akira Yokosawa

From ad3fca471bd3a6178f7988bbe5c9ab903f86722a Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 13 Mar 2017 20:50:56 +0900
Subject: [PATCH v2 6/6] advsync/memorybarriers: Distinguish 'CPU family' from 'CPU'

In these paragraphs, "CPU" stands for either "CPU core" or "CPU family". Explicitly use "CPU family" for the latter.

---
 advsync/memorybarriers.tex | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
advsync/memorybarriers.tex +5 -5
index 85e9162..15ed1f6 100644
@@ -415,11 +415,11 @@ If you just want to be told what the rules are rather than suffering
 through the actual derivation,
 please feel free to skip to Section~\ref{sec:advsync:A Few Simple Rules}.
 
-The exact semantics of memory barriers vary wildly from one CPU to
+The exact semantics of memory barriers vary wildly from one CPU family to
 another, so portable code must rely only on the least-common-denominator
 semantics of memory barriers.
 
-Fortunately, all CPUs impose the following rules:
+Fortunately, all CPU families impose the following rules:
 \begin{enumerate}
 \item	All accesses by a given CPU will appear to that CPU to have
 	occurred in program order.
@@ -442,9 +442,9 @@ Each of these properties is described in the following sections.
 A given CPU will see its own accesses as occurring in ``program order'',
 as if the CPU was executing only one instruction at a time with no
 reordering or speculation.
-For older CPUs, this restriction is necessary for binary compatibility,
+For older CPU families, this restriction is necessary for binary compatibility,
 and only secondarily for the sanity of us software types.
-There have been a few CPUs that violate this rule to a limited extent,
+There have been a few CPU families that violate this rule to a limited extent,
 but in those cases, the compiler has been responsible
 for ensuring that ordering is explicitly enforced as needed.
 
@@ -511,7 +511,7 @@ of an external logic analyzer
 However, if CPU~2's access to B sees the result of CPU~1's access
 to B, then CPU~2's access to A is guaranteed to see the result of
 CPU~1's access to A.
-Although some CPUs' memory barriers do in fact provide stronger,
+Although some CPU families' memory barriers do in fact provide stronger,
 unconditional ordering guarantees, portable code may rely only
 on this weaker if-then conditional ordering guarantee.
 
Signature · 1 line
2.7.4