Skip to content

Commit f5a997b

Browse files
committed
do-release: sketch + a bunch of fixes from bench-all
qemu: monitor command from guest
1 parent 380000c commit f5a997b

File tree

7 files changed

+48
-18
lines changed

7 files changed

+48
-18
lines changed

README.adoc

+19
Original file line numberDiff line numberDiff line change
@@ -6899,6 +6899,10 @@ Getting everything to work required careful choice of QEMU command line options:
68996899
* https://stackoverflow.com/questions/49716931/how-to-run-qemu-with-nographic-and-monitor-but-still-be-able-to-send-ctrlc-to/49751144#49751144
69006900
* https://unix.stackexchange.com/questions/167165/how-to-pass-ctrl-c-to-the-guest-when-running-qemu-with-nographic/436321#436321
69016901

6902+
==== QEMU monitor from guest
6903+
6904+
Peter Maydell said potentially not possible nicely as of August 2018: https://stackoverflow.com/questions/51747744/how-to-run-a-qemu-monitor-command-from-inside-the-guest/51764110#51764110
6905+
69026906
=== Debug the emulator
69036907

69046908
When you start hacking QEMU or gem5, it is useful to see what is going on inside the emulator themselves.
@@ -8855,6 +8859,9 @@ All benchmarks were run on the <<p51>> machine, unless stated otherwise.
88558859
Run all benchmarks and upload the results:
88568860

88578861
....
8862+
cd ..
8863+
git clone https://github.com/cirosantilli/linux-kernel-module-cheat-regression
8864+
cd -
88588865
./bench-all -A
88598866
....
88608867

@@ -9391,6 +9398,18 @@ This can be used to check the determinism of:
93919398
* <<norandmaps>>
93929399
* <<qemu-record-and-replay>>
93939400

9401+
==== Releases
9402+
9403+
This is not yet super stable, but one day maybe:
9404+
9405+
....
9406+
./do-release
9407+
....
9408+
9409+
Source: link:do-release[].
9410+
9411+
This should in particular enable <<prebuilt>>.
9412+
93949413
=== About
93959414

93969415
This project is for people who want to learn and modify low level system components:

bench-all

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env bash
2-
# Run all benchmarks for this repo, and save the results to the
3-
# benchmark repo, which should be cloned at ../linux-kernel-module-cheat-benchmarks.
42
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
53
set -x
64
bench_build=false
@@ -44,7 +42,6 @@ shift "$(($OPTIND - 1))"
4442
comment="${1:-}"
4543

4644
# Create output directory.
47-
sha="$(git log -1 --format="%H")"
4845
benchmark_repo="${common_root_dir}/../linux-kernel-module-cheat-regression"
4946
mkdir -p "$benchmark_repo"
5047
last_dir="$(ls "$benchmark_repo" | grep -E '^[0-9]' | tail -n 1)"
@@ -54,8 +51,7 @@ else
5451
seq_id=0
5552
fi
5653
seq_id="$(printf '%0.4d' "$seq_id")"
57-
sha="$(git log -1 --format="%H")"
58-
dir_basename="${seq_id}_${sha}"
54+
dir_basename="${seq_id}_${common_sha}"
5955
new_dir="${benchmark_repo}/${dir_basename}"
6056
mkdir "$new_dir"
6157

@@ -64,7 +60,7 @@ if "$bench_build"; then
6460
common_suffix=bench
6561
common_setup
6662
rm -rf "$common_out_arch_dir"
67-
./build -a "$common_arch" -B 'BR2_CCACHE=n' -s "$suffix"
63+
./build -a "$common_arch" -B 'BR2_CCACHE=n' -s "$common_suffix"
6864
cp "${common_build_dir}/build-time.log" "${new_dir}/build-time-${common_arch}.log"
6965
rm -rf "$common_out_arch_dir"
7066
fi
@@ -90,16 +86,15 @@ if "$bench_gem5_build"; then
9086
arches='x86_64 arm'
9187
for common_arch in $arches; do
9288
common_setup
93-
cd "${common_root_dir}/gem5/gem5"
89+
cd "${common_gem5_src_dir}"
9490
git clean -xdf
95-
cd "${common_root_dir}/gem5"
9691
results_file="${common_gem5_out_dir}/bench-build.txt"
9792
gem5_outdir="${common_out_dir}/bench_build"
9893
rm -fr "$results_file" "${gem5_outdir}"
9994
# TODO understand better: --foreground required otherwise we cannot
10095
# kill the build with Ctrl+C if something goes wrong, can be minimized to:
10196
# bash -c "eval 'timeout 5 sleep 3'"
102-
common_bench_cmd "timeout --foreground 900 ./build -a '$common_arch' -o '${gem5_outdir}'" "$results_file"
97+
common_bench_cmd "timeout --foreground 900 ../build -a '$common_arch' -o '${gem5_outdir}'" "$results_file"
10398
cp "$results_file" "${new_dir}/gem5-bench-build-${common_arch}.txt"
10499
cd "${common_root_dir}/gem5/gem5"
105100
git clean -xdf

build

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ kernel_config_fragments=
1818
post_script_args=
1919
qemu_sdl='--enable-sdl --with-sdlabi=2.0'
2020
v=0
21-
while getopts 'a:B:b:C:c:fGgj:hIiK:kL:lM:p:Q:qSst::v' OPT; do
21+
while getopts 'a:B:b:C:c:fGgj:hIiK:kL:lM:p:Q:qSs:t:v' OPT; do
2222
case "$OPT" in
2323
a)
2424
common_arch="$OPTARG"

common

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ common_setup() {
4848
common_buildroot_dir="${common_root_dir}/buildroot"
4949
common_arch_dir="$common_arch"
5050
if [ -n "$common_suffix" ]; then
51-
common_arch_dir="${arch_dir}-${common_suffix}"
51+
common_arch_dir="${common_arch_dir}-${common_suffix}"
5252
fi
5353
common_out_arch_dir="${common_out_dir}/${common_arch_dir}"
5454
common_buildroot_out_dir="${common_out_arch_dir}/buildroot"
@@ -146,6 +146,7 @@ common_gem5_worktree=
146146
common_linux_variant=default
147147
common_qemu_variant=default
148148
common_run_id=0
149+
common_sha="$(git log -1 --format="%H")"
149150
common_suffix=
150151

151152
f="${common_data_dir}/config"

do-release

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
3+
common_setup
4+
./build-all
5+
./zip-img
6+
tag="sha-${common_sha}"
7+
upload_basename="images-${common_sha}.zip"
8+
git tag "$tag"
9+
git push --tags
10+
#curl "https://api.github.com/repos/cirosantilli/linux-kernel-module-cheat/releases/tags/${tag}/assets?access_token=$(cat data/access_token)&tag_name=${upload_basename}" \
11+
# --header 'Content-Type: application/zip' \
12+
# --upload-file "${common_out_dir}/${upload_basename}" \
13+
# -H 'Accept: application/vnd.github.v3+json' \
14+
# -X POST \
15+
#;
16+
./bench-all -u

run

-2
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ ${qemu_common} \
364364
-append '${root} ${extra_append}' \\
365365
-cpu cortex-a57 \\
366366
${virtio_gpu_pci} \
367-
-kernel '${common_images_dir}/Image' \\
368367
${extra_flags} \
369368
"
370369
;;
@@ -380,7 +379,6 @@ ${qemu_common} \
380379
-M malta \\
381380
-append '${root} ${extra_append}' \\
382381
-cpu I6400 \\
383-
-kernel '${common_vmlinux}' \\
384382
${extra_flags} \
385383
"
386384
;;

zip-img

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env bash
2-
set -eu
3-
outfile="out/out.zip"
2+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
3+
common_setup
4+
outfile="${common_out_dir}/lkmc-${common_sha}.zip"
45
rm -f "$outfile"
56
for arch in x86_64 arm aarch64; do
6-
img_dir="out/${arch}/buildroot/images"
7-
rm -f "${img_dir}/rootfs.ext2"
8-
zip -r "$outfile" "${img_dir}"
7+
common_setup
8+
rm -f "${common_images_dir}/rootfs.ext2"
9+
zip -r "$outfile" "$common_images_dir"
910
done

0 commit comments

Comments
 (0)