From 9405b35ad28aa27d3fdde1af87ac2f874195148a Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Fri, 6 Apr 2018 01:02:41 +0100 Subject: [PATCH] Create data/ dir, move cli, 9p and readfile there. --- .gitignore | 2 +- README.adoc | 25 ++++++++++++++----------- build | 3 +-- cli.gitignore.example => cli.example | 0 common | 5 ++++- gem5-bench-cache | 20 ++++++++++---------- run | 12 ++++++------ 7 files changed, 36 insertions(+), 31 deletions(-) rename cli.gitignore.example => cli.example (100%) diff --git a/.gitignore b/.gitignore index 46f53d0..eb80173 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,5 @@ gitignore* # Specific files. +/data /out -/9p diff --git a/README.adoc b/README.adoc index 61b902b..e950232 100644 --- a/README.adoc +++ b/README.adoc @@ -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: <>, 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[] diff --git a/build b/build index 6fb066b..12bbbee 100755 --- a/build +++ b/build @@ -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. diff --git a/cli.gitignore.example b/cli.example similarity index 100% rename from cli.gitignore.example rename to cli.example diff --git a/common b/common index f406690..8ceeb17 100644 --- a/common +++ b/common @@ -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 diff --git a/gem5-bench-cache b/gem5-bench-cache index 330fda1..7d227a3 100755 --- a/gem5-bench-cache +++ b/gem5-bench-cache @@ -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 diff --git a/run b/run index 4f66b92..d7bb85a 100755 --- a/run +++ b/run @@ -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'"