Add Makefile in CodeSamples/formal/herd
cover Add Makefile in CodeSamples/formal/herd
From 180abe9a72d4e3fbe200ce2a032a6c616a70ce03 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 22 Nov 2017 00:04:40 +0900
Subject: [PATCH 0/2] Add Makefile in CodeSamples/formal/herd
(Resending with To: Paul)
Hi Paul,
This is my attempt to add Makefile in CodeSamples/formal/herd. The recipes here assumes that the memory-model's repository resides beside the perfbook's repository on your machine.
The targets include conversion of litmus7 compatible tests under litmus/ directory to herd7/klitmus7 compatible ones, running converted litmus tests by herd7,
running herd7 benchmark tests by herd7,
and preparing directory for klitmus7 cross-compile of converted tests.
Currently, there is no test other than benchmarks under herd/ directory which is not compatible with litmus7. When such tests are added there, the Makefile can be updated to run and cross-compile them along with the converted tests.
Patch #1 adds the Makefile and a helper script.
Patch #2 is a fix of compiler warnings revealed in klitmus7 cross- compiling.
These C-WWC-o+o-* litmus tests were modified by me in this August. That looked sufficient for litmus7, but definitions in kernel header files used in klitmus7 aren't satisfied. The change here is the result of some try-and-errors. There can be smarter way to describe these tests. They are not used in the text at the moment, so their fix is not urgent, I suppose.
Thanks, Akira
--
Akira Yokosawa (2):
CodeSamples/formal/herd: Add Makefile and utility script CodeSamples/formal/litmus: Fix type of 2:r2 in C-WWC+o+o-*.litmus test
CodeSamples/formal/herd/.gitignore | 4 ++ CodeSamples/formal/herd/Makefile | 60 ++++++++++++++++++++++ CodeSamples/formal/herd/litmus2herd.sh | 20 ++++++++ .../formal/litmus/C-WWC+o+o-data-o+o-addr-o.litmus | 9 ++-- .../formal/litmus/C-WWC+o+o-r+o-addr-o.litmus | 9 ++-- 5 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 CodeSamples/formal/herd/.gitignore create mode 100644 CodeSamples/formal/herd/Makefile create mode 100644 CodeSamples/formal/herd/litmus2herd.sh
Signature · 1 line
2.7.4
PATCH 1/2 CodeSamples/formal/herd: Add Makefile and utility script
From 4ec89fb990662f555202908eff08ea29ffe87fa8 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 20 Nov 2017 00:09:46 +0900
Subject: [PATCH 1/2] CodeSamples/formal/herd: Add Makefile and utility script
Also add .gitignore for generated files to be ignored.
--- CodeSamples/formal/herd/.gitignore | 4 +++ CodeSamples/formal/herd/Makefile | 60 ++++++++++++++++++++++++++++++++++ CodeSamples/formal/herd/litmus2herd.sh | 20 ++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 CodeSamples/formal/herd/.gitignore create mode 100644 CodeSamples/formal/herd/Makefile create mode 100644 CodeSamples/formal/herd/litmus2herd.sh
CodeSamples/formal/herd/.gitignore new file +4 -0
@@ -0,0 +1,4 @@ +*.out +*.herd +klitmus +klitmus.tar
CodeSamples/formal/herd/Makefile new file +60 -0
60 lines not on this page · raw message
CodeSamples/formal/herd/litmus2herd.sh new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Remove 2nd {} in litmus tests compatible with litmus7: +# { +# #include <api.h> +# } +# +# Borrowed from one of the answers in: +# https://unix.stackexchange.comm/questions/213385/ +# Not the selected answer because it read input file twice. +# But this is easier to follow. +# +# Copyright (C) Akira Yokosawa, 2017 +# +# Authors: Akira Yokosawa <[email protected]> + +grep -n -A1 -B1 "api.h" $1 | \ +sed -n 's/^\([0-9]\{1,\}\).*/\1d/p' | \ +sed -f - $1 > $2
Signature · 1 line
2.7.4
PATCH 1/1 CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmus
From 62491d966a645d08ffc6bb0c5bae9f725458cbec Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Thu, 23 Nov 2017 12:07:18 +0900
Subject: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmus
Target "cross-klitmus" does not depend on memory model. Remove the implicit dependency of "cd $(LKMM_DIR)" from the recipe.
--- CodeSamples/formal/herd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
CodeSamples/formal/herd/Makefile +1 -1
@@ -73,7 +73,7 @@ cross-klitmus: klitmus.tar klitmus.tar: litmus2herd mkdir -p klitmus - cd $(LKMM_DIR); klitmus7 -o $(HERD_DIR)/klitmus $(addprefix $(HERD_DIR)/,$(LITMUS7_HERD_TEST)) + klitmus7 -o klitmus $(LITMUS7_HERD_TEST) tar cf klitmus.tar ./klitmus clean:
Signature · 1 line
2.7.4
Re: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmus
Quoted 10 lines · Akira Yokosawa
Quoted 1 line
From
62491d966a645d08ffc6bb0c5bae9f725458cbecMon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Thu, 23 Nov 2017 12:07:18 +0900
Subject: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmusTarget "cross-klitmus" does not depend on memory model. Remove the implicit dependency of "cd $(LKMM_DIR)" from the recipe.
Fixes ef76630632df ("CodeSamples/formal/herd: Add Makefile and utility script")Signed-off-by Akira Yokosawa <[email protected]>
I applied and pushed both, the first just before the release and the one below as the first commit after the release.
I also attached the (very crude) scripts that I use to collect herd performance data, just in case they are useful.
Thanx, Paul
Quoted 21 lines
--- CodeSamples/formal/herd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)CodeSamples/formal/herd/Makefile +1
-1@@ -73,7 +73,7 @@ cross-klitmus: klitmus.tar klitmus.tar: litmus2herd mkdir -p klitmus - cd $(LKMM_DIR); klitmus7 -o $(HERD_DIR)/klitmus $(addprefix $(HERD_DIR)/,$(LITMUS7_HERD_TEST)) + klitmus7 -o klitmus $(LITMUS7_HERD_TEST) tar cf klitmus.tar ./klitmus clean:Signature · 1 line
2.7.4
Re: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmus
Quoted 9 lines · Paul E. McKenney
Quoted 8 lines · Akira Yokosawa
Quoted 1 line
From
62491d966a645d08ffc6bb0c5bae9f725458cbecMon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Thu, 23 Nov 2017 12:07:18 +0900
Subject: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmusTarget "cross-klitmus" does not depend on memory model. Remove the implicit dependency of "cd $(LKMM_DIR)" from the recipe.
Quoted 8 lines
Quoted 2 lines
Fixes ef76630632df ("CodeSamples/formal/herd: Add Makefile and utility script")Signed-off-by Akira Yokosawa <[email protected]>I applied and pushed both, the first just before the release and the one below as the first commit after the release.
I also attached the (very crude) scripts that I use to collect herd performance data, just in case they are useful.
Well, I have no idea how to use absperf-reduce.sh.
It's partly because I'm not good at awk, but I can't figure out what kind of input and arguments the script assumes.
Can you show me an example?
I know absperf.sh runs each litmus test 10 times with timeout of 15 minutes.
I'd be happy to integrate the collection feature into formal/herd/Makefile, once I know what is expected.
Thanks, Akira
Quoted 2 lines
Thanx, Paul
[...]
Re: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmus
Quoted 16 lines · Akira Yokosawa
Quoted 15 lines · Paul E. McKenney
Quoted 10 lines · Akira Yokosawa
Quoted 1 line
From
62491d966a645d08ffc6bb0c5bae9f725458cbecMon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Thu, 23 Nov 2017 12:07:18 +0900
Subject: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmusTarget "cross-klitmus" does not depend on memory model. Remove the implicit dependency of "cd $(LKMM_DIR)" from the recipe.
Fixes ef76630632df ("CodeSamples/formal/herd: Add Makefile and utility script")Signed-off-by Akira Yokosawa <[email protected]>I applied and pushed both, the first just before the release and the one below as the first commit after the release.
Quoted 6 lines
Quoted 2 lines
I also attached the (very crude) scripts that I use to collect herd performance data, just in case they are useful.
Well, I have no idea how to use
absperf-reduce.sh.
It's partly because I'm not good at awk, but I can't figure out what kind of input and arguments the script assumes.
Good point...
Quoted 6 lines
Can you show me an example?
I know
absperf.shruns each litmus test 10 times with timeout of 15 minutes.I'd be happy to integrate the collection feature into formal/herd/Makefile, once I know what is expected.
So you run absperf.sh and feed its output into absperf-reduce.sh as its standard input.
I normally dump the absperf.sh to a file and then run absperf-reduce.sh on that file. The output is the litmus-test name followed by the average, minimum, and maximum runtimes for that litmus test.
One oddity is that both scripts expect the scripts to be in the directory litmus-tests/absperf -- this is hard-coded into absperf.sh's for-loop and into the first pattern of absperf-reduce.sh's awk script (the "/^litmus-tests/ {" line).
So here is how the absperf-reduce.sh script operates, in the likely event that you would prefer to just rewrite it (which would be fine by me):
o Each awk statement block is preceded by a pattern, and
contains a "{}"-enclosed sequence of statements. These statements are executed only when the pattern matches the current line. The special pattern "END" executes after the input has been consumed and processed.
o The "/^litmus-tests/" matches lines beginning with "litmus-tests".
These lines are those "echo"ed by absperf.sh. This check relies on the fact that herd7 doesn't output lines beginning with "litmus-tests", which is admittedly a very fragile approach.
Upon match, the variable "curtest" is set to the first word on the current line (which is the litmus-test pathname) and the variable "testrun" is set to zero to say that we do not yet have any evidence that the test ran to completion.
o The "/^Test/" is output by herd7, and indicates that the
litmus test actually completed. So we set "testran" to 1.
o The "/maxresident)k/" matches output from /bin/time. If
herd7 ran, the following lines parse the /bin/time output, and accumulate the number of runs, the total time, and the minimum and maximum time in awk associative arrays.
(In awk, 'a["efwefew"]++' is a perfectly valid expression, and it increments the element of "a" indexed by the string "efwefew". I am pretty sure that most scripting languages do this these days, but it was pretty surprising back when awk came out with it.)
o The "END" loops through all elements of the array, with
the variable "i" taking on each index of that array in turn. The print statement thus prints the litmus test name along with its statistics.
I then hand-edited the output to make various tables in email and Table 12.3 in perfbook.
Why awk? Back when I was starting scripting languages, it was the only one availalble on UNIX. This would have been some time in the 1980s. It is very unlikely to be the best choice for someone starting out today. ;-)
Thanx, Paul
Re: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmus
Quoted 36 lines · Paul E. McKenney
Quoted 16 lines · Akira Yokosawa
Quoted 15 lines · Paul E. McKenney
Quoted 10 lines · Akira Yokosawa
Quoted 1 line
From
62491d966a645d08ffc6bb0c5bae9f725458cbecMon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Thu, 23 Nov 2017 12:07:18 +0900
Subject: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmusTarget "cross-klitmus" does not depend on memory model. Remove the implicit dependency of "cd $(LKMM_DIR)" from the recipe.
Fixes ef76630632df ("CodeSamples/formal/herd: Add Makefile and utility script")Signed-off-by Akira Yokosawa <[email protected]>I applied and pushed both, the first just before the release and the one below as the first commit after the release.
Quoted 6 lines
Quoted 2 lines
I also attached the (very crude) scripts that I use to collect herd performance data, just in case they are useful.
Well, I have no idea how to use
absperf-reduce.sh.
It's partly because I'm not good at awk, but I can't figure out what kind of input and arguments the script assumes.Good point...
Quoted 6 lines
Can you show me an example?
I know
absperf.shruns each litmus test 10 times with timeout of 15 minutes.I'd be happy to integrate the collection feature into formal/herd/Makefile, once I know what is expected.
So you run
absperf.shand feed its output intoabsperf-reduce.shas its standard input.
Quoted 8 lines
I normally dump the
absperf.shto a file and then runabsperf-reduce.shon that file. The output is the litmus-test name followed by the average, minimum, and maximum runtimes for that litmus test.One oddity is that both scripts expect the scripts to be in the directory litmus-tests/absperf -- this is hard-coded into absperf.sh's for-loop and into the first pattern of absperf-reduce.sh's awk script (the "/^litmus-tests/ {" line).
Ah, this is the key point I could not figure out. Now I can run the scripts using short litmus tests.
We also need memory model files in the current directory.
So the current scheme in CodeSamples/formal/herd/ of "cd memory-model; herd7 ..." conflicts with the above assumption.
Let me think what approach is suitable for perfbook's CodeSamples. This may take a while.
Thanks, Akira
Quoted 52 lines
So here is how the
absperf-reduce.shscript operates, in the likely event that you would prefer to just rewrite it (which would be fine by me):o Each awk statement block is preceded by a pattern, and
contains a "{}"-enclosed sequence of statements. These statements are executed only when the pattern matches the current line. The special pattern "END" executes after the input has been consumed and processed.o The "/^litmus-tests/" matches lines beginning with "litmus-tests".
These lines are those "echo"ed byabsperf.sh. This check relies on the fact that herd7 doesn't output lines beginning with "litmus-tests", which is admittedly a very fragile approach.Upon match, the variable "curtest" is set to the first word on the current line (which is the litmus-test pathname) and the variable "testrun" is set to zero to say that we do not yet have any evidence that the test ran to completion.
o The "/^Test/" is output by herd7, and indicates that the
litmus test actually completed. So we set "testran" to 1.o The "/maxresident)k/" matches output from
/bin/time. If
herd7 ran, the following lines parse the/bin/timeoutput, and accumulate the number of runs, the total time, and the minimum and maximum time in awk associative arrays.(In awk, 'a["efwefew"]++' is a perfectly valid expression, and it increments the element of "a" indexed by the string "efwefew". I am pretty sure that most scripting languages do this these days, but it was pretty surprising back when awk came out with it.)
o The "END" loops through all elements of the array, with
the variable "i" taking on each index of that array in turn. The print statement thus prints the litmus test name along with its statistics.I then hand-edited the output to make various tables in email and Table 12.3 in perfbook.
Why awk? Back when I was starting scripting languages, it was the only one availalble on UNIX. This would have been some time in the 1980s. It is very unlikely to be the best choice for someone starting out today. ;-)
Thanx, Paul
Re: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmus
Quoted 46 lines · Akira Yokosawa
Quoted 36 lines · Paul E. McKenney
Quoted 16 lines · Akira Yokosawa
Quoted 15 lines · Paul E. McKenney
Quoted 10 lines · Akira Yokosawa
Quoted 1 line
From
62491d966a645d08ffc6bb0c5bae9f725458cbecMon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Thu, 23 Nov 2017 12:07:18 +0900
Subject: [PATCH] CodeSamples/formal/herd: Remove dependency to memory model in cross-klitmusTarget "cross-klitmus" does not depend on memory model. Remove the implicit dependency of "cd $(LKMM_DIR)" from the recipe.
Fixes ef76630632df ("CodeSamples/formal/herd: Add Makefile and utility script")Signed-off-by Akira Yokosawa <[email protected]>I applied and pushed both, the first just before the release and the one below as the first commit after the release.
Quoted 6 lines
Quoted 2 lines
I also attached the (very crude) scripts that I use to collect herd performance data, just in case they are useful.
Well, I have no idea how to use
absperf-reduce.sh.
It's partly because I'm not good at awk, but I can't figure out what kind of input and arguments the script assumes.Good point...
Quoted 6 lines
Can you show me an example?
I know
absperf.shruns each litmus test 10 times with timeout of 15 minutes.I'd be happy to integrate the collection feature into formal/herd/Makefile, once I know what is expected.
So you run
absperf.shand feed its output intoabsperf-reduce.shas its standard input.Quoted 8 lines
I normally dump the
absperf.shto a file and then runabsperf-reduce.shon that file. The output is the litmus-test name followed by the average, minimum, and maximum runtimes for that litmus test.One oddity is that both scripts expect the scripts to be in the directory litmus-tests/absperf -- this is hard-coded into absperf.sh's for-loop and into the first pattern of absperf-reduce.sh's awk script (the "/^litmus-tests/ {" line).
Quoted 7 lines
Ah, this is the key point I could not figure out. Now I can run the scripts using short litmus tests.
We also need memory model files in the current directory.
So the current scheme in CodeSamples/formal/herd/ of "cd memory-model; herd7 ..." conflicts with the above assumption.
Indeed, and one more reason to rewrite. ;-)
Quoted 2 lines
Let me think what approach is suitable for perfbook's CodeSamples. This may take a while.
Not an emergency as far as I know, especially given that I can continue using the old scripts. ;-)
Thanx, Paul
Quoted 55 lines
Thanks, Akira
Quoted 52 lines
So here is how the
absperf-reduce.shscript operates, in the likely event that you would prefer to just rewrite it (which would be fine by me):o Each awk statement block is preceded by a pattern, and
contains a "{}"-enclosed sequence of statements. These statements are executed only when the pattern matches the current line. The special pattern "END" executes after the input has been consumed and processed.o The "/^litmus-tests/" matches lines beginning with "litmus-tests".
These lines are those "echo"ed byabsperf.sh. This check relies on the fact that herd7 doesn't output lines beginning with "litmus-tests", which is admittedly a very fragile approach.Upon match, the variable "curtest" is set to the first word on the current line (which is the litmus-test pathname) and the variable "testrun" is set to zero to say that we do not yet have any evidence that the test ran to completion.
o The "/^Test/" is output by herd7, and indicates that the
litmus test actually completed. So we set "testran" to 1.o The "/maxresident)k/" matches output from
/bin/time. If
herd7 ran, the following lines parse the/bin/timeoutput, and accumulate the number of runs, the total time, and the minimum and maximum time in awk associative arrays.(In awk, 'a["efwefew"]++' is a perfectly valid expression, and it increments the element of "a" indexed by the string "efwefew". I am pretty sure that most scripting languages do this these days, but it was pretty surprising back when awk came out with it.)
o The "END" loops through all elements of the array, with
the variable "i" taking on each index of that array in turn. The print statement thus prints the litmus test name along with its statistics.I then hand-edited the output to make various tables in email and Table 12.3 in perfbook.
Why awk? Back when I was starting scripting languages, it was the only one availalble on UNIX. This would have been some time in the 1980s. It is very unlikely to be the best choice for someone starting out today. ;-)
Thanx, Paul
PATCH 2/2 CodeSamples/formal/litmus: Fix type of 2:r2 in C-WWC+o+o-*.litmus test
In reply to Akira YokosawaFrom 180abe9a72d4e3fbe200ce2a032a6c616a70ce03 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 21 Nov 2017 22:26:53 +0900
Subject: [PATCH 2/2] CodeSamples/formal/litmus: Fix type of 2:r2 in C-WWC+o+o-*.litmus test
This change gets rid of warnings in klitmus7 cross-compile:
-------
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from ./include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from [...]/CodeSamples/formal/herd/klitmus/litmus012.c:11:
[...]/CodeSamples/formal/herd/klitmus/litmus012.c: In function 'code2':
include/linux/compiler.h:297:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
{ .__val = (__force typeof(x)) (val) }; \
^[...]/CodeSamples/formal/herd/klitmus/litmus012.c:414:2: note: in expansion of macro 'WRITE_ONCE'
WRITE_ONCE(*r2, c);
^
-------
r2 is declared as "int *r2;", and WRITE_ONCE(*r2, c) will store to an int variable. r2 should have been "int**" type.
Also revert the variable used in the WRITE_ONCE to "a" as had been before the changes listed in the "Fixes:" tags below.
--- CodeSamples/formal/litmus/C-WWC+o+o-data-o+o-addr-o.litmus | 9 ++++----- CodeSamples/formal/litmus/C-WWC+o+o-r+o-addr-o.litmus | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-)
CodeSamples/formal/litmus/C-WWC+o+o-data-o+o-addr-o.litmus +4 -5
@@ -3,7 +3,6 @@ C C-WWC+o+o-data-o+o-addr-o { int a = 0; int b = 0; -int *c = &b; int *x = &a; int *y = &b; }
@@ -25,12 +24,12 @@ P1(int **x, int **y) WRITE_ONCE(*y, r1); } -P2(int **y, int **c) +P2(int **y, int *a) { - int *r2; + int **r2; - r2 = READ_ONCE(*y); - WRITE_ONCE(*r2, c); + r2 = (int**)READ_ONCE(*y); + WRITE_ONCE(*r2, a); } exists(1:r1=x /\ 2:r2=x /\ x=x)
CodeSamples/formal/litmus/C-WWC+o+o-r+o-addr-o.litmus +4 -5
@@ -3,7 +3,6 @@ C C-WWC+o+o-r+o-addr-o { int a = 0; int b = 0; -int *c = &b; int *x = &a; int *y = &b; }
@@ -25,12 +24,12 @@ P1(int **x, int **y) smp_store_release(y, r1); } -P2(int **y, int **c) +P2(int **y, int *a) { - int *r2; + int **r2; - r2 = READ_ONCE(*y); - WRITE_ONCE(*r2, c); + r2 = (int**)READ_ONCE(*y); + WRITE_ONCE(*r2, a); } exists(1:r1=x /\ 2:r2=x /\ x=x)
Signature · 1 line
2.7.4
Quoted 26 lines · Akira Yokosawa
Quoted 1 line
From
180abe9a72d4e3fbe200ce2a032a6c616a70ce03Mon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Wed, 22 Nov 2017 00:04:40 +0900
Subject: [PATCH 0/2] AddMakefilein CodeSamples/formal/herd(Resending with To: Paul)
Hi Paul,This is my attempt to add
Makefilein CodeSamples/formal/herd. The recipes here assumes that the memory-model's repository resides beside the perfbook's repository on your machine.The targets include conversion of litmus7 compatible tests under litmus/ directory to herd7/klitmus7 compatible ones, running converted litmus tests by herd7,
running herd7 benchmark tests by herd7,
and preparing directory for klitmus7 cross-compile of converted tests.Currently, there is no test other than benchmarks under herd/ directory which is not compatible with litmus7. When such tests are added there, the
Makefilecan be updated to run and cross-compile them along with the converted tests.Patch #1 adds the
Makefileand a helper script.
Quoted 8 lines
Patch #2 is a fix of compiler warnings revealed in klitmus7 cross- compiling.
These C-WWC-o+o-* litmus tests were modified by me in this August. That looked sufficient for litmus7, but definitions in kernel header files used in klitmus7 aren't satisfied. The change here is the result of some try-and-errors. There can be smarter way to describe these tests. They are not used in the text at the moment, so their fix is not urgent, I suppose.
I queued these, but let's talk about the memory model. Currently, it is available in this git archive:
https://github.com/aparri/memory-model.git
Specifically, these files:
linux-kernel.bell
linux-kernel.cat
linux-kernel.cfg
linux-kernel.def
linux-kernel-hardware.cat
lock.cat
We hope to get these upstream into the Linux kernel during the next merge window. So maybe the right thing to do is to require that the user copy the files into the formal/herd directory, and have Makefile give instructions and stop if they are not present.
Thoughts?
Thanx, Paul
Quoted 24 lines
Thanks, Akira
--
Akira Yokosawa (2):
CodeSamples/formal/herd: AddMakefileand utility script CodeSamples/formal/litmus: Fix type of 2:r2 in C-WWC+o+o-*.litmus testCodeSamples/formal/herd/.gitignore | 4 ++ CodeSamples/formal/herd/Makefile | 60 ++++++++++++++++++++++ CodeSamples/formal/herd/litmus2herd.sh | 20 ++++++++ .../formal/litmus/C-WWC+o+o-data-o+o-addr-o.litmus | 9 ++-- .../formal/litmus/C-WWC+o+o-r+o-addr-o.litmus | 9 ++-- 5 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 CodeSamples/formal/herd/.gitignore create mode 100644 CodeSamples/formal/herd/Makefile create mode 100644 CodeSamples/formal/herd/litmus2herd.shSignature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe perfbook" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 50 lines · 2017/11/22 9:12 +0900、Paul E. McKenney <[email protected]> wrote:
Quoted 26 lines · Akira Yokosawa
Quoted 1 line
From
180abe9a72d4e3fbe200ce2a032a6c616a70ce03Mon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Wed, 22 Nov 2017 00:04:40 +0900
Subject: [PATCH 0/2] AddMakefilein CodeSamples/formal/herd(Resending with To: Paul)
Hi Paul,This is my attempt to add
Makefilein CodeSamples/formal/herd. The recipes here assumes that the memory-model's repository resides beside the perfbook's repository on your machine.The targets include conversion of litmus7 compatible tests under litmus/ directory to herd7/klitmus7 compatible ones, running converted litmus tests by herd7,
running herd7 benchmark tests by herd7,
and preparing directory for klitmus7 cross-compile of converted tests.Currently, there is no test other than benchmarks under herd/ directory which is not compatible with litmus7. When such tests are added there, the
Makefilecan be updated to run and cross-compile them along with the converted tests.Patch #1 adds the
Makefileand a helper script.Quoted 8 lines
Patch #2 is a fix of compiler warnings revealed in klitmus7 cross- compiling.
These C-WWC-o+o-* litmus tests were modified by me in this August. That looked sufficient for litmus7, but definitions in kernel header files used in klitmus7 aren't satisfied. The change here is the result of some try-and-errors. There can be smarter way to describe these tests. They are not used in the text at the moment, so their fix is not urgent, I suppose.I queued these, but let's talk about the memory model. Currently, it is available in this git archive:
https://github.com/aparri/memory-model.git
Specifically, these files:
linux-kernel.bell
linux-kernel.cat
linux-kernel.cfg
linux-kernel.def
linux-kernel-hardware.cat
lock.cat
Quoted 6 lines
We hope to get these upstream into the Linux kernel during the next merge window. So maybe the right thing to do is to require that the user copy the files into the formal/herd directory, and have
Makefilegive instructions and stop if they are not present.Thoughts?
I’m kind of against having those untracked files there.
The directory where they reside can be specified by
overriding LKMM_DIR variable in the Makefile by an option to make command. So change of the location of memory model won’t be a problem.
But yes, the check of the existence of the directory can help users. I’ll see what l can do.
Thoughts?
Akira
(from mobile, might be QP encoded)
Quoted 28 lines
Thanx, Paul
Quoted 24 lines
Thanks, Akira
--
Akira Yokosawa (2):
CodeSamples/formal/herd: AddMakefileand utility script CodeSamples/formal/litmus: Fix type of 2:r2 in C-WWC+o+o-*.litmus testCodeSamples/formal/herd/.gitignore | 4 ++ CodeSamples/formal/herd/Makefile | 60 ++++++++++++++++++++++ CodeSamples/formal/herd/litmus2herd.sh | 20 ++++++++ .../formal/litmus/C-WWC+o+o-data-o+o-addr-o.litmus | 9 ++-- .../formal/litmus/C-WWC+o+o-r+o-addr-o.litmus | 9 ++-- 5 files changed, 92 insertions(+), 10 deletions(-)create mode 100644 CodeSamples/formal/herd/.gitignore create mode 100644 CodeSamples/formal/herd/Makefile create mode 100644
CodeSamples/formal/herd/litmus2herd.shSignature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe perfbook" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 62 lines · Akira Yokosawa
Quoted 50 lines · 2017/11/22 9:12 +0900、Paul E. McKenney <[email protected]> wrote:
Quoted 26 lines · Akira Yokosawa
Quoted 1 line
From
180abe9a72d4e3fbe200ce2a032a6c616a70ce03Mon Sep 17 00:00:00 2001From: Akira Yokosawa <[email protected]>
Date: Wed, 22 Nov 2017 00:04:40 +0900
Subject: [PATCH 0/2] AddMakefilein CodeSamples/formal/herd(Resending with To: Paul)
Hi Paul,This is my attempt to add
Makefilein CodeSamples/formal/herd. The recipes here assumes that the memory-model's repository resides beside the perfbook's repository on your machine.The targets include conversion of litmus7 compatible tests under litmus/ directory to herd7/klitmus7 compatible ones, running converted litmus tests by herd7,
running herd7 benchmark tests by herd7,
and preparing directory for klitmus7 cross-compile of converted tests.Currently, there is no test other than benchmarks under herd/ directory which is not compatible with litmus7. When such tests are added there, the
Makefilecan be updated to run and cross-compile them along with the converted tests.Patch #1 adds the
Makefileand a helper script.Quoted 8 lines
Patch #2 is a fix of compiler warnings revealed in klitmus7 cross- compiling.
These C-WWC-o+o-* litmus tests were modified by me in this August. That looked sufficient for litmus7, but definitions in kernel header files used in klitmus7 aren't satisfied. The change here is the result of some try-and-errors. There can be smarter way to describe these tests. They are not used in the text at the moment, so their fix is not urgent, I suppose.I queued these, but let's talk about the memory model. Currently, it is available in this git archive:
https://github.com/aparri/memory-model.git
Specifically, these files:
linux-kernel.bell
linux-kernel.cat
linux-kernel.cfg
linux-kernel.def
linux-kernel-hardware.cat
lock.catQuoted 6 lines
We hope to get these upstream into the Linux kernel during the next merge window. So maybe the right thing to do is to require that the user copy the files into the formal/herd directory, and have
Makefilegive instructions and stop if they are not present.Thoughts?
Quoted 8 lines
I’m kind of against having those untracked files there.
The directory where they reside can be specified by
overridingLKMM_DIRvariable in theMakefileby an option to make command. So change of the location of memory model won’t be a problem.But yes, the check of the existence of the directory can help users. I’ll see what l can do.
Thoughts?
As long as the directory can be a symbolic link to the actual directory, that should work fine.
Thanx, Paul
Quoted 36 lines
Akira
(from mobile, might be QP encoded)Quoted 28 lines
Thanx, Paul
Quoted 24 lines
Thanks, Akira
--
Akira Yokosawa (2):
CodeSamples/formal/herd: AddMakefileand utility script CodeSamples/formal/litmus: Fix type of 2:r2 in C-WWC+o+o-*.litmus testCodeSamples/formal/herd/.gitignore | 4 ++ CodeSamples/formal/herd/Makefile | 60 ++++++++++++++++++++++ CodeSamples/formal/herd/litmus2herd.sh | 20 ++++++++ .../formal/litmus/C-WWC+o+o-data-o+o-addr-o.litmus | 9 ++-- .../formal/litmus/C-WWC+o+o-r+o-addr-o.litmus | 9 ++-- 5 files changed, 92 insertions(+), 10 deletions(-)create mode 100644 CodeSamples/formal/herd/.gitignore create mode 100644 CodeSamples/formal/herd/Makefile create mode 100644
CodeSamples/formal/herd/litmus2herd.shSignature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe perfbook" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe perfbook" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 CodeSamples/formal/herd: Add existence check of memory model
From 53df3405f334e7cda1d650fefbf5fba416aa4abe Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 22 Nov 2017 20:08:09 +0900
Subject: [PATCH] CodeSamples/formal/herd: Add existence check of memory model
If any of the necessary files is lacking, output a message to give instructions for preparation of the memory model.
--- CodeSamples/formal/herd/.gitignore | 1 + CodeSamples/formal/herd/Makefile | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-)
CodeSamples/formal/herd/.gitignore +1 -0
@@ -2,3 +2,4 @@ *.herd klitmus klitmus.tar +memory-model
CodeSamples/formal/herd/Makefile +25 -3
@@ -9,14 +9,24 @@ # # run-herd7-bench: Run benchmark tests of herd7 itself # -# Note: LKMM model is assumed to reside in a directory next to perfbook's -# local repository. +# Note: There need to be a symbolic link "memory-model" under +# CodeSamples/formal/herd for herd7 to work. +# The memory model is available at the git archive: +# https://github.com/aparri/memory-model.git. +# Make sure the symbolic link points to the actual directory. +# Alternatively, you can copy the files listed in LKMM_FILES to +# a subdirectory "memory-model". +# +# klitmus7 doesn't require the memory model. # # Copyright (C) Akira Yokosawa, 2017 # # Authors: Akira Yokosawa <[email protected]> -LKMM_DIR := ../../../../memory-model +LKMM_DIR := memory-model +LKMM_FILES := linux-kernel.bell linux-kernel.cat linux-kernel.cfg \ + linux-kernel.def linux-kernel-hardware.cat lock.cat +LKMM_LIST := $(addprefix $(LKMM_DIR)/,$(LKMM_FILES)) HERD_DIR := $(shell pwd) HERD7_CMD := $(shell which herd7) KLITMUS7_CMD := $(shell which klitmus7)
@@ -41,6 +51,18 @@ run-herd7: $(LITMUS7_HERD_OUT) run-herd7-bench: $(HERD_BENCH_OUT) +$(LKMM_LIST): + @echo "#####################################################" + @echo "### Please prepare Linux Kernel Memory Model. ###" + @echo "### You can get it at the git archive: ###" + @echo "### https://github.com/aparri/memory-model.git ###" + @echo "### ###" + @echo "### Refer to comment in Makefile for more info. ###" + @echo "#####################################################" + @exit 1 + +$(LITMUS7_HERD_OUT) $(HERD_BENCH_OUT): $(LKMM_LIST) + $(LITMUS7_HERD_OUT): %.out: %.herd cd $(LKMM_DIR); herd7 -conf linux-kernel.cfg $(HERD_DIR)/$< > $(HERD_DIR)/$@
Signature · 1 line
2.7.4