Skip to contentSkip to conversation

advsync: Misc. fixes around litmus tests

PATCH In review Akira Yokosawa 2 participants 10 messages Jul 12, 2017 – Jul 13, 2017

lore
Share & tools
lore
#0 lore raw

cover advsync: Misc. fixes around litmus tests

From de45acd5a73354cbe03abaf3130177687c77e4cb Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 12 Jul 2017 23:45:17 +0900
Subject: [PATCH 0/6] advsync: Misc. fixes around litmus tests

Hi Paul,

This patch set tries to cleanup recently updated material in advsync.

Patches 1 to 3 are fixes of litmus tests under CodeSamples/advsync/herd and their corresponding snippets in memorybarriers.tex.

Patch 4 is trivial fixes.

Patch 5 is my attempt for the sentence to make sense.

Patch 6 updates the usage of x0 and x1 in the tables of Store-Buffering Sequence of Events. I stopped short of using READ_ONCE() and WRITE_ONCE() in the "Instruction" columns. The change seems unnecessary for me. I think we can assume a reader of this section can easily translate READ_ONCE() and WRITE_ONCE() to simple assignments in his/her mind. Also, you are calling x0 and x1 as if they are variables in the text. But I don't think the current way of description is ambiguous.

So, Patches 1 to 4 should be all right. You might feel otherwise to Patches 5 and 6.

Thoughts?

Thanks, Akira

Signature · 16 lines
Akira Yokosawa (6):
  advsync: Fix typo of litmus name
  advsync: Fix typos in load-buffering litmus tests
  advsync: Fix remaining typo in exists condition
  advsync: Trivial typo fixes
  advsync: Fix grammatical error
  advsync: Adjust value expressions in Tables 14.1 and 14.2

 CodeSamples/advsync/herd/C-LB+o-o+o-o.litmus       |   2 +-
 CodeSamples/advsync/herd/C-LB+o-r+a-o.litmus       |   4 +-
 .../advsync/herd/C-MP+o-wmb-o+o-rmb-o.litmus       |   2 +-
 advsync/memorybarriers.tex                         | 103 ++++++++++-----------
 4 files changed, 55 insertions(+), 56 deletions(-)

-- 
2.7.4
#1 lore raw

PATCH 1/6 advsync: Fix typo of litmus name

From fa84a8b089a721ea67ba631eb76d6b10e1965541 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 12 Jul 2017 20:09:43 +0900
Subject: [PATCH 1/6] advsync: Fix typo of litmus name

---
 CodeSamples/advsync/herd/C-MP+o-wmb-o+o-rmb-o.litmus | 2 +-
 advsync/memorybarriers.tex                           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
CodeSamples/advsync/herd/C-MP+o-wmb-o+o-rmb-o.litmus +1 -1
index e604eb5..1e92453 100644
@@ -1,4 +1,4 @@
-C C-MP+o-wmb-o+o-o.litmus
+C C-MP+o-wmb-o+o-rmb-o.litmus
 
 {
 }
advsync/memorybarriers.tex +1 -1
index a1c3327..a354a54 100644
@@ -636,7 +636,7 @@ this~\cite{JadeAlglave2011ppcmem}.
 \begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
- 1 C C-MP+o-wmb-o+o-o.litmus
+ 1 C C-MP+o-wmb-o+o-rmb-o.litmus
  2
  3 {
  4 }
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/6 advsync: Fix typos in load-buffering litmus tests

In reply to Akira Yokosawa

From 5fd378b832e773d13db4196c6c8b6145eea00774 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 12 Jul 2017 20:41:26 +0900
Subject: [PATCH 2/6] advsync: Fix typos in load-buffering litmus tests

Also replace contents of Figure 14.11: Load-Buffering Litmus Test with the correct one.

---
 CodeSamples/advsync/herd/C-LB+o-o+o-o.litmus |  2 +-
 CodeSamples/advsync/herd/C-LB+o-r+a-o.litmus |  4 +--
 advsync/memorybarriers.tex                   | 43 ++++++++++++++--------------
 3 files changed, 24 insertions(+), 25 deletions(-)
CodeSamples/advsync/herd/C-LB+o-o+o-o.litmus +1 -1
index 808071f..8ee530d 100644
@@ -23,4 +23,4 @@ P1(int *x0, int *x1)
 	WRITE_ONCE(*x1, 2);
 }
 
-exists (1:r2=1 /\ 0:r2=1)
+exists (1:r2=2 /\ 0:r2=2)
CodeSamples/advsync/herd/C-LB+o-r+a-o.litmus +2 -2
index e171ce5..f1b6dba 100644
@@ -1,4 +1,4 @@
-C C-LB+o-mb-o+o-mb-o.litmus
+C C-LB+o-r+a-o.litmus
 {
 }
 
@@ -23,4 +23,4 @@ P1(int *x0, int *x1)
 	WRITE_ONCE(*x1, 2);
 }
 
-exists (1:r2=1 /\ 0:r2=1)
+exists (1:r2=2 /\ 0:r2=2)
advsync/memorybarriers.tex +21 -22

64 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/6 advsync: Fix remaining typo in exists condition

In reply to Akira Yokosawa

From 2dd610086d6a4599dab6287b8e1180bbc3f92f88 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 12 Jul 2017 21:20:14 +0900
Subject: [PATCH 3/6] advsync: Fix remaining typo in exists condition

---
 advsync/memorybarriers.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
advsync/memorybarriers.tex +1 -1
index 936b95e..10d28f0 100644
@@ -613,7 +613,7 @@ loads and stores.
 22
 23 }
 24
-25 exists (1:r2=1 /\ 1:r3=0)
+25 exists (1:r2=2 /\ 1:r3=0)
 \end{verbbox}
 }
 \centering
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/6 advsync: Trivial typo fixes

In reply to Akira Yokosawa

From 4e13865babb05ec6bd0521ae74d523fd562af6ce Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 12 Jul 2017 22:49:00 +0900
Subject: [PATCH 4/6] advsync: Trivial typo fixes

---
 advsync/memorybarriers.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
advsync/memorybarriers.tex +2 -2
index 10d28f0..b085443 100644
@@ -670,7 +670,7 @@ this~\cite{JadeAlglave2011ppcmem}.
 \end{figure}
 
 Therefore, portable code relying on ordering in this case should
-add explicit ordering, for example, the \co{smp_rmb(} shown on
+add explicit ordering, for example, the \co{smp_rmb()} shown on
 line~20 of
 Figure~\ref{fig:advsync:Enforcing Order of Message-Passing Litmus Test}.
 
@@ -956,7 +956,7 @@ Figure~\ref{fig:advsync:S Address-Dependency Litmus Test}?
 Because no production-quality architecture speculated writes,
 it is not possible for the \co{WRITE_ONCE()} on line~10 to overwrite
 the \co{WRITE_ONCE()} on line~21, meaning that the \co{exists}
-clause on line`25 cannot be satisfied, even on DEC Alpha, even
+clause on line~25 cannot be satisfied, even on DEC Alpha, even
 without the \co{lockless_dereference()} that is required in the
 dependent-read case.
 
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/6 advsync: Fix grammatical error

In reply to Akira Yokosawa

From b97b1a0383b55fb5202e4799f2c1dafe576de5ee Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 12 Jul 2017 22:50:16 +0900
Subject: [PATCH 5/6] advsync: Fix grammatical error

---
 advsync/memorybarriers.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
advsync/memorybarriers.tex +2 -2
index b085443..8693cac 100644
@@ -847,9 +847,9 @@ instruction.
 
 Figure~\ref{fig:advsync:Message-Passing Address-Dependency Litmus Test}
 shows a linked variant of the message-passing pattern.
-The head pointer is \co{x1}, which is initially
+The head pointer is \co{x1}, which initially
 references the \co{int} variable \co{y} (line~5), which is in turn 
-is initialized to the value $1$ (line~4).
+initialized to the value $1$ (line~4).
 
 \co{P0()} updates head pointer \co{x1} to reference \co{x0} (line~12),
 but only afer initializing it to $2$ (line~10) and forcing ordering
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/6 advsync: Adjust value expressions in Tables 14.1 and 14.2

In reply to Akira Yokosawa

From de45acd5a73354cbe03abaf3130177687c77e4cb Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 12 Jul 2017 23:21:52 +0900
Subject: [PATCH 6/6] advsync: Adjust value expressions in Tables 14.1 and 14.2

As x0 and x1 are pointers, they should be in dereferenced form.

---
 advsync/memorybarriers.tex | 48 +++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 24 deletions(-)
advsync/memorybarriers.tex +24 -24
index 8693cac..b9dd1fa 100644
@@ -179,7 +179,7 @@ Figure~\ref{fig:advsync:Memory Misordering: Store-Buffering Litmus Test}.
 
 \begin{table*}
 \small
-\centering\OneColumnHSpace{-.1in}
+\centering\OneColumnHSpace{-.2in}
 \begin{tabular}{r||l|l|l||l|l|l}
 	& \multicolumn{3}{c||}{CPU 0} & \multicolumn{3}{c}{CPU 1} \\
 	\cline{2-7}
@@ -187,20 +187,20 @@ Figure~\ref{fig:advsync:Memory Misordering: Store-Buffering Litmus Test}.
 		Instruction & Store Buffer & Cache \\
 	\hline
 	\hline
-	1 & (Initial state) & & \tco{x1==0} &
-		(Initial state) & & \tco{x0==0} \\
+	1 & (Initial state) & & \tco{*x1==0} &
+		(Initial state) & & \tco{*x0==0} \\
 	\hline
-	2 & \tco{*x0 = 2} & \tco{x0==2} & \tco{x1==0} &
-		\tco{*x1 = 2;} & \tco{x1==2} & \tco{x0==0} \\
+	2 & \tco{*x0 = 2;} & \tco{*x0==2} & \tco{*x1==0} &
+		\tco{*x1 = 2;} & \tco{*x1==2} & \tco{*x0==0} \\
 	\hline
-	3 & \tco{r2 = *x1;} (0) & \tco{x0==2} & \tco{x1==0} &
-		\tco{r2 = *x0;} (0) & \tco{x1==2} & \tco{x0==0} \\
+	3 & \tco{r2 = *x1;} (0) & \tco{*x0==2} & \tco{*x1==0} &
+		\tco{r2 = *x0;} (0) & \tco{*x1==2} & \tco{*x0==0} \\
 	\hline
-	4 & (Read-invalidate) & \tco{x0==2} & \tco{x0==0} &
-		(Read-invalidate) & \tco{x1==2} & \tco{x1==0} \\
+	4 & (Read-invalidate) & \tco{*x0==2} & \tco{*x0==0} &
+		(Read-invalidate) & \tco{*x1==2} & \tco{*x1==0} \\
 	\hline
-	5 & (Finish store) & & \tco{x0==2} &
-		(Finish store) & & \tco{x1==2} \\
+	5 & (Finish store) & & \tco{*x0==2} &
+		(Finish store) & & \tco{*x1==2} \\
 \end{tabular}
 \caption{Memory Misordering: Store-Buffering Sequence of Events}
 \label{tab:advsync:Memory Misordering: Store-Buffering Sequence of Events}
@@ -343,7 +343,7 @@ Figure~\ref{fig:advsync:Memory Misordering: Store-Buffering Litmus Test}.
 
 \begin{table*}
 \small
-\centering\OneColumnHSpace{-0.75in}
+\centering\OneColumnHSpace{-0.2in}
 \begin{tabular}{r||l|l|l||l|l|l}
 	& \multicolumn{3}{c||}{CPU 0} & \multicolumn{3}{c}{CPU 1} \\
 	\cline{2-7}
@@ -351,23 +351,23 @@ Figure~\ref{fig:advsync:Memory Misordering: Store-Buffering Litmus Test}.
 		Instruction & Store Buffer & Cache \\
 	\hline
 	\hline
-	1 & (Initial state) & & \tco{x1==0} &
-		(Initial state) & & \tco{x0==0} \\
+	1 & (Initial state) & & \tco{*x1==0} &
+		(Initial state) & & \tco{*x0==0} \\
 	\hline
-	2 & \tco{*x0 = 2} & \tco{x0==2} & \tco{x1==0} &
-		\tco{*x1 = 2;} & \tco{x1==2} & \tco{x0==0} \\
+	2 & \tco{*x0 = 2;} & \tco{*x0==2} & \tco{*x1==0} &
+		\tco{*x1 = 2;} & \tco{*x1==2} & \tco{*x0==0} \\
 	\hline
-	3 & \tco{smp_mb()} & \tco{x0==2} & \tco{x1==0} &
-		\tco{smp_mb()} & \tco{x1==2} & \tco{x0==0} \\
+	3 & \tco{smp_mb();} & \tco{*x0==2} & \tco{*x1==0} &
+		\tco{smp_mb();} & \tco{*x1==2} & \tco{*x0==0} \\
 	\hline
-	4 & (Read-invalidate) & \tco{x0==2} & \tco{x0==0} &
-		(Read-invalidate) & \tco{x1==2} & \tco{x1==0} \\
+	4 & (Read-invalidate) & \tco{*x0==2} & \tco{*x0==0} &
+		(Read-invalidate) & \tco{*x1==2} & \tco{*x1==0} \\
 	\hline
-	5 & (Finish store) & & \tco{x0==2} &
-		(Finish store) & & \tco{x1==2} \\
+	5 & (Finish store) & & \tco{*x0==2} &
+		(Finish store) & & \tco{*x1==2} \\
 	\hline
-	6 & \tco{r2 = *x1;} (2) & & \tco{x1==2} &
-		\tco{r2 = *x0;} (2) & & \tco{x0==2} \\
+	6 & \tco{r2 = *x1;} (2) & & \tco{*x1==2} &
+		\tco{r2 = *x0;} (2) & & \tco{*x0==2} \\
 \end{tabular}
 \caption{Memory Ordering: Store-Buffering Sequence of Events}
 \label{tab:advsync:Memory Ordering: Store-Buffering Sequence of Events}
Signature · 1 line
2.7.4
#7 lore raw

[PATCH 7/6] advsync: Catch up changes in litmus tests

In reply to Akira Yokosawa

From 9a30f29d248fbe1e6a7b25f2af2b233889639837 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Thu, 13 Jul 2017 21:43:43 +0900
Subject: [PATCH 7/6] advsync: Catch up changes in litmus tests

---
Hi Paul,

This patch is a followup to the previous patch set. It won't conflict with any one in the set.

Thanks, Akira
--

 advsync/memorybarriers.tex | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
advsync/memorybarriers.tex +9 -9
index a1c3327..4d81d44 100644
@@ -23,8 +23,8 @@ RCU.
  6 {
  7   int r2;
  8
- 9   WRITE_ONCE(x0, 2);
-10   r2 = READ_ONCE(x1);
+ 9   WRITE_ONCE(*x0, 2);
+10   r2 = READ_ONCE(*x1);
 11 }
 12
 13
@@ -32,8 +32,8 @@ RCU.
 15 {
 16   int r2;
 17
-18   WRITE_ONCE(x1, 2);
-19   r2 = READ_ONCE(x0);
+18   WRITE_ONCE(*x1, 2);
+19   r2 = READ_ONCE(*x0);
 20 }
 21
 22 exists (1:r2=0 /\ 0:r2=0)
@@ -293,9 +293,9 @@ thus allowing you to stop reading this section.
  6 {
  7   int r2;
  8
- 9   WRITE_ONCE(x0, 2);
+ 9   WRITE_ONCE(*x0, 2);
 10   smp_mb();
-11   r2 = READ_ONCE(x1);
+11   r2 = READ_ONCE(*x1);
 12 }
 13
 14
@@ -303,9 +303,9 @@ thus allowing you to stop reading this section.
 16 {
 17   int r2;
 18
-19   WRITE_ONCE(x1, 2);
+19   WRITE_ONCE(*x1, 2);
 20   smp_mb();
-21   r2 = READ_ONCE(x0);
+21   r2 = READ_ONCE(*x0);
 22 }
 23
 24 exists (1:r2=0 /\ 0:r2=0)
@@ -598,7 +598,7 @@ loads and stores.
  7 P0(int* x0, int* x1) {
  8
  9   WRITE_ONCE(*x0, 2);
-10   smp_mb();
+10   smp_wmb();
 11   WRITE_ONCE(*x1, 2);
 12
 13 }
Signature · 1 line
2.7.4
#8 lore raw
In reply to Akira Yokosawa
Quoted 24 lines · Akira Yokosawa
Quoted 1 line

From de45acd5a73354cbe03abaf3130177687c77e4cb Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Wed, 12 Jul 2017 23:45:17 +0900
Subject: [PATCH 0/6] advsync: Misc. fixes around litmus tests

Hi Paul,

This patch set tries to cleanup recently updated material in advsync.

Patches 1 to 3 are fixes of litmus tests under CodeSamples/advsync/herd and their corresponding snippets in memorybarriers.tex.

Patch 4 is trivial fixes.

Patch 5 is my attempt for the sentence to make sense.

Patch 6 updates the usage of x0 and x1 in the tables of Store-Buffering Sequence of Events. I stopped short of using READ_ONCE() and WRITE_ONCE() in the "Instruction" columns. The change seems unnecessary for me. I think we can assume a reader of this section can easily translate READ_ONCE() and WRITE_ONCE() to simple assignments in his/her mind. Also, you are calling x0 and x1 as if they are variables in the text. But I don't think the current way of description is ambiguous.

Quoted 2 lines

So, Patches 1 to 4 should be all right. You might feel otherwise to Patches 5 and 6.

Good catches, thank you!!!

The only think I didn't take was the addition of indirection to the variables in the tables. The litmus tests have the indirection on the function parameters, and omit it in the exists clause. So there is potential for confusion either way. So I came down on the side of the shortest way, that is, omitting the indirection.

And yes, my original tables were inconsistent! ;-)

I also took your 7/6 patch, and thank you again.

Thanx, Paul

Quoted 21 lines

Thoughts?

Thanks, Akira

Signature · 16 lines
Akira Yokosawa (6):
  advsync: Fix typo of litmus name
  advsync: Fix typos in load-buffering litmus tests
  advsync: Fix remaining typo in exists condition
  advsync: Trivial typo fixes
  advsync: Fix grammatical error
  advsync: Adjust value expressions in Tables 14.1 and 14.2

 CodeSamples/advsync/herd/C-LB+o-o+o-o.litmus       |   2 +-
 CodeSamples/advsync/herd/C-LB+o-r+a-o.litmus       |   4 +-
 .../advsync/herd/C-MP+o-wmb-o+o-rmb-o.litmus       |   2 +-
 advsync/memorybarriers.tex                         | 103 ++++++++++-----------
 4 files changed, 55 insertions(+), 56 deletions(-)

-- 
2.7.4
#9 lore raw
Quoted 36 lines · Paul E. McKenney
Quoted 24 lines · Akira Yokosawa
Quoted 1 line

From de45acd5a73354cbe03abaf3130177687c77e4cb Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Wed, 12 Jul 2017 23:45:17 +0900
Subject: [PATCH 0/6] advsync: Misc. fixes around litmus tests

Hi Paul,

This patch set tries to cleanup recently updated material in advsync.

Patches 1 to 3 are fixes of litmus tests under CodeSamples/advsync/herd and their corresponding snippets in memorybarriers.tex.

Patch 4 is trivial fixes.

Patch 5 is my attempt for the sentence to make sense.

Patch 6 updates the usage of x0 and x1 in the tables of Store-Buffering Sequence of Events. I stopped short of using READ_ONCE() and WRITE_ONCE() in the "Instruction" columns. The change seems unnecessary for me. I think we can assume a reader of this section can easily translate READ_ONCE() and WRITE_ONCE() to simple assignments in his/her mind. Also, you are calling x0 and x1 as if they are variables in the text. But I don't think the current way of description is ambiguous.

Quoted 2 lines

So, Patches 1 to 4 should be all right. You might feel otherwise to Patches 5 and 6.

Good catches, thank you!!!

The only think I didn't take was the addition of indirection to the variables in the tables. The litmus tests have the indirection on the function parameters, and omit it in the exists clause. So there is potential for confusion either way. So I came down on the side of the shortest way, that is, omitting the indirection.

Quoted 3 lines

And yes, my original tables were inconsistent! ;-)

I also took your 7/6 patch, and thank you again.

And kernel.org is having some issues, so I pushed to my github perfbook repo. Hopefully kernel.org will be feeling better later...

Thanx, Paul

Quoted 21 lines
Quoted 21 lines

Thoughts?

Thanks, Akira

Signature · 16 lines
Akira Yokosawa (6):
  advsync: Fix typo of litmus name
  advsync: Fix typos in load-buffering litmus tests
  advsync: Fix remaining typo in exists condition
  advsync: Trivial typo fixes
  advsync: Fix grammatical error
  advsync: Adjust value expressions in Tables 14.1 and 14.2

 CodeSamples/advsync/herd/C-LB+o-o+o-o.litmus       |   2 +-
 CodeSamples/advsync/herd/C-LB+o-r+a-o.litmus       |   4 +-
 .../advsync/herd/C-MP+o-wmb-o+o-rmb-o.litmus       |   2 +-
 advsync/memorybarriers.tex                         | 103 ++++++++++-----------
 4 files changed, 55 insertions(+), 56 deletions(-)

-- 
2.7.4