Create data/ dir, move cli, 9p and readfile there.

This commit is contained in:
Ciro Santilli
2018-04-06 01:02:41 +01:00
parent d23e7ee183
commit 9405b35ad2
7 changed files with 36 additions and 31 deletions

2
.gitignore vendored
View File

@@ -6,5 +6,5 @@
gitignore*
# Specific files.
/data
/out
/9p

View File

@@ -117,10 +117,10 @@ It gets annoying to retype `-a aarch64` for every single command, or to remember
So simplify that, do:
....
cp cli.gitignore.example cli.gitignore
cp cli.example data/cli
....
and then edit the `cli.gitignore` file to your needs.
and then edit the `data/cli` file to your needs.
That file is used to pass extra command line arguments to most of our utilities.
@@ -1960,7 +1960,7 @@ TODO performance compared to NFS.
As usual, we have already set everything up for you. On host:
....
cd 9p
cd data/9p
uname -a > host
....
@@ -2401,17 +2401,17 @@ arch=aarch64
# Generate a checkpoint after Linux boots.
# The boot takes a while, be patient young Padawan.
printf 'm5 exit' >readfile.gitignore
printf 'm5 exit' >data/readfile
./run -a "$arch" -g -E 'm5 checkpoint;m5 readfile > a.sh;sh a.sh'
# Restore the checkpoint, and run the benchmark with parameter 1.000.
# We skip the boot completely, saving time!
printf 'm5 resetstats;dhrystone 1000;m5 exit' >readfile.gitignore
printf 'm5 resetstats;dhrystone 1000;m5 exit' >data/readfile
./run -a "$arch" -g -- -r 1
./gem5-stat -a "$arch"
# Now with another parameter 10.000.
printf 'm5 resetstats;dhrystone 10000;m5 exit' >readfile.gitignore
printf 'm5 resetstats;dhrystone 10000;m5 exit' >data/readfile
./run -a "$arch" -g -- -r 1
./gem5-stat -a "$arch"
....
@@ -3036,11 +3036,11 @@ The problem is that after the checkpoint, the memory and disk states are fixed,
There is however one loophole: <<m5-readfile>>, which reads whatever is present on the host, so we can do it like:
....
printf 'echo "setup run";m5 exit' >readfile.gitignore
printf 'echo "setup run";m5 exit' >data/readfile
./run -a aarch64 -g -E 'm5 checkpoint;m5 readfile > a.sh;sh a.sh'
printf 'echo "first benchmark";m5 exit' >readfile.gitignore
printf 'echo "first benchmark";m5 exit' >data/readfile
./run -a aarch64 -g -- -r 1
printf 'echo "second benchmark";m5 exit' >readfile.gitignore
printf 'echo "second benchmark";m5 exit' >data/readfile
./run -a aarch64 -g -- -r 1
....
@@ -3382,7 +3382,7 @@ https://stackoverflow.com/questions/49516399/how-to-use-m5-readfile-and-m5-execf
Host:
....
date > readfile.gitignore
date > data/readfile
....
Guest:
@@ -3397,7 +3397,7 @@ Host:
....
printf '#!/bin/sh
echo asdf' > readfile.gitignore
echo asdf' > data/readfile
....
Guest:
@@ -3973,6 +3973,9 @@ then `dtc a.dts` gives:
=== Directory structure
* `/data`: gitignored user created data. Deleting this might lead to loss of data. Of course, if something there becomes is important enough to you, git track it.
* `/out`: gitignored Build outputs. You won't lose data by deleting this folder since everything there can be re-generated, only time.
:leveloffset: +3
include::buildroot_patches/README.adoc[]

3
build
View File

@@ -159,11 +159,10 @@ BR2_ROOTFS_POST_SCRIPT_ARGS=\"$post_script_args\"
make O="$buildroot_out_dir" olddefconfig
fi
# Build.
mkdir -p \
"${gem5_out_dir}" \
"${qemu_out_dir}" \
"${root_dir}/9p" \
"${p9_dir}" \
;
cd "${buildroot_dir}"
# HOST_QEMU_OPTS is a hack that happens to work because the QEMU package luckly uses += at all times.

5
common
View File

@@ -17,8 +17,11 @@ set_common_vars() {
}
root_dir="$(pwd)"
out_dir="${root_dir}/out"
data_dir="${root_dir}/data"
p9_dir="${data_dir}/9p"
readfile_file="${data_dir}/readfile"
common_dir="${out_dir}/common"
f=cli.gitignore
f="${data_dir}/cli"
if [ -f "$f" ]; then
. "$f"
fi

View File

@@ -20,7 +20,7 @@ result_file="${gem5_out_dir}/bench-cache.txt"
bench() (
cmd="$1"
eeval "$cmd" "$result_file"
./eeval "$cmd" "$result_file"
./gem5-ncycles -a "$arch" >> "$result_file"
)
@@ -39,25 +39,25 @@ rm -rf \
;
# Create the checkpoints after the kernel boot.
printf 'm5 exit' >readfile.gitignore
eeval "$cmd $cpt"
eeval "$cmd $cpt -- $cache_small"
eeval "$cmd $cpt -- $cache_large"
eeval "$cmd $cpt -- $cache_small --cpu-type=HPI"
eeval "$cmd $cpt -- $cache_large --cpu-type=HPI"
printf 'm5 exit' >"${readfile_file}"
./eeval "$cmd $cpt"
./eeval "$cmd $cpt -- $cache_small"
./eeval "$cmd $cpt -- $cache_large"
./eeval "$cmd $cpt -- $cache_small --cpu-type=HPI"
./eeval "$cmd $cpt -- $cache_large --cpu-type=HPI"
# dhrystone 1.000
printf '#!/bin/sh
m5 resetstats
dhrystone 1000
m5 exit
' >readfile.gitignore
' >"${readfile_file}"
bench-all
# dhrystone 10.000
sed -Ei 's/^dhrystone .*/dhrystone 10000/' readfile.gitignore
sed -Ei 's/^dhrystone .*/dhrystone 10000/' "${readfile_file}"
bench-all
# dhrystone 100.000
sed -Ei 's/^dhrystone .*/dhrystone 100000/' readfile.gitignore
sed -Ei 's/^dhrystone .*/dhrystone 100000/' "${readfile_file}"
bench-all

12
run
View File

@@ -143,7 +143,7 @@ ${gem5opts} \
--kernel='${buildroot_out_dir}/build/linux-custom/vmlinux' \
--mem-size=${memory} \
--num-cpus='${cpus}' \
--script='${root_dir}/readfile.gitignore' \
--script='${readfile_file}' \
"
if [ "$arch" = x86_64 ]; then
if "$kvm"; then
@@ -173,13 +173,13 @@ else
${debug_vm} \
'${buildroot_out_dir}/host/usr/bin/qemu-system-${arch}' \
-gdb tcp::1234 \
-m ${memory} \
-m '${memory}' \
-monitor telnet::45454,server,nowait \
-netdev user,hostfwd=tcp::45455-:45455,hostfwd=tcp::45456-:22,id=net0 \
-smp ${cpus} \
-trace enable=${trace_enable},file='${qemu_out_dir}/trace.bin' \
-virtfs local,path=9p,mount_tag=host_scratch,security_model=mapped,id=host_scratch \
-virtfs local,path=${buildroot_out_dir}/build,mount_tag=host_out,security_model=mapped,id=host_out \
-smp '${cpus}' \
-trace 'enable=${trace_enable},file=${qemu_out_dir}/trace.bin' \
-virtfs 'local,path=${p9_dir},mount_tag=host_scratch,security_model=mapped,id=host_scratch' \
-virtfs 'local,path=${buildroot_out_dir}/build,mount_tag=host_out,security_model=mapped,id=host_out' \
"
if "$initrd"; then
extra_flags="${extra_flags} -initrd '${images_dir}/rootfs.cpio'"