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* gitignore*
# Specific files. # Specific files.
/data
/out /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: 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. 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: As usual, we have already set everything up for you. On host:
.... ....
cd 9p cd data/9p
uname -a > host uname -a > host
.... ....
@@ -2401,17 +2401,17 @@ arch=aarch64
# Generate a checkpoint after Linux boots. # Generate a checkpoint after Linux boots.
# The boot takes a while, be patient young Padawan. # 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' ./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. # Restore the checkpoint, and run the benchmark with parameter 1.000.
# We skip the boot completely, saving time! # 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 ./run -a "$arch" -g -- -r 1
./gem5-stat -a "$arch" ./gem5-stat -a "$arch"
# Now with another parameter 10.000. # 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 ./run -a "$arch" -g -- -r 1
./gem5-stat -a "$arch" ./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: 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' ./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 ./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 ./run -a aarch64 -g -- -r 1
.... ....
@@ -3382,7 +3382,7 @@ https://stackoverflow.com/questions/49516399/how-to-use-m5-readfile-and-m5-execf
Host: Host:
.... ....
date > readfile.gitignore date > data/readfile
.... ....
Guest: Guest:
@@ -3397,7 +3397,7 @@ Host:
.... ....
printf '#!/bin/sh printf '#!/bin/sh
echo asdf' > readfile.gitignore echo asdf' > data/readfile
.... ....
Guest: Guest:
@@ -3973,6 +3973,9 @@ then `dtc a.dts` gives:
=== Directory structure === 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 :leveloffset: +3
include::buildroot_patches/README.adoc[] 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 make O="$buildroot_out_dir" olddefconfig
fi fi
# Build.
mkdir -p \ mkdir -p \
"${gem5_out_dir}" \ "${gem5_out_dir}" \
"${qemu_out_dir}" \ "${qemu_out_dir}" \
"${root_dir}/9p" \ "${p9_dir}" \
; ;
cd "${buildroot_dir}" cd "${buildroot_dir}"
# HOST_QEMU_OPTS is a hack that happens to work because the QEMU package luckly uses += at all times. # 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)" root_dir="$(pwd)"
out_dir="${root_dir}/out" 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" common_dir="${out_dir}/common"
f=cli.gitignore f="${data_dir}/cli"
if [ -f "$f" ]; then if [ -f "$f" ]; then
. "$f" . "$f"
fi fi

View File

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

12
run
View File

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