gem5: integrate fs_bigLITTLE.py into run

This commit is contained in:
Ciro Santilli
2018-06-17 12:05:00 +01:00
parent 57dbe81f33
commit 18c1c823fe
4 changed files with 112 additions and 82 deletions

View File

@@ -6390,9 +6390,9 @@ The out of build tree is required, because otherwise Buildroot would copy the ou
=== gem5 fs_bigLITTLE === gem5 fs_bigLITTLE
TODO integrate into `run`. There is no way to pass command line arguments except by hacking the script, this is a pre-requisite for good integration. By default, we use `configs/example/fs.py` script.
This system is more representative of ARM, which almost always has the big little cluster. The `-X-b` option enables the alternative `configs/example/arm/fs_bigLITTLE.py` script instead.
First apply: First apply:
@@ -6418,14 +6418,20 @@ index 7d66c03a6..d71e714fe 100644
then: then:
.... ....
./fs-biglittle ./run -aA -g -X-b
.... ....
Source: link:fs-biglittle[] Advantages over `fs.py`:
Boot messages start at 5 minutes, boot finishes at 10 minutes and gives a shell. * more representative of mobile ARM SoCs, which almost always have big little cluster
* simpler than `fs.py`, and therefore easier to understand and modify
`cat /proc/cpuinfo` shows 4 identical CPUs instead of 2 of two different types, likely because gem5 does not expose some informational register much like the caches: https://www.mail-archive.com/gem5-users@gem5.org/msg15426.html `config.ini` does show that the two big ones are `DerivO3CPU` and the small ones are `MinorCPU`. Disadvantages over `fs.py`:
* only works for ARM, not other archs
* not as many configuration options as `fs.py`, many things are hardcoded
We setup 2 big and 2 small CPUs, but `cat /proc/cpuinfo` shows 4 identical CPUs instead of 2 of two different types, likely because gem5 does not expose some informational register much like the caches: https://www.mail-archive.com/gem5-users@gem5.org/msg15426.html `config.ini` does show that the two big ones are `DerivO3CPU` and the small ones are `MinorCPU`.
TODO: why is the `--dtb` required despite `fs_bigLITTLE.py` having a DTB generation capability? Without it, nothing shows on terminal, and the simulation terminates with `simulate() limit reached @ 18446744073709551615`. The magic `vmlinux.vexpress_gem5_v1.20170616` works however without a DTB. TODO: why is the `--dtb` required despite `fs_bigLITTLE.py` having a DTB generation capability? Without it, nothing shows on terminal, and the simulation terminates with `simulate() limit reached @ 18446744073709551615`. The magic `vmlinux.vexpress_gem5_v1.20170616` works however without a DTB.

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env bash
. common
set_common_vars -L "${common_linux_variant}" -M "${common_gem5_variant}" aarch64 true
M5_PATH="${common_gem5_system_dir}" \
"${common_gem5_build_dir}/ARM/gem5.opt" \
"${common_gem5_default_src_dir}/configs/example/arm/fs_bigLITTLE.py" \
--big-cpus=2 \
--caches \
--disk="${common_images_dir}/rootfs.ext2" \
--dtb "${common_gem5_system_dir}/arm/dt/armv8_gem5_v1_big_little_2_2.dtb" \
--kernel="${common_vmlinux}" \
--little-cpus=2 \
;

52
run
View File

@@ -18,8 +18,10 @@ extra_append='console_msg_format=syslog nokaslr norandmaps printk.devkmsg=on pri
extra_append_after_dash= extra_append_after_dash=
extra_flags= extra_flags=
extra_flags_qemu= extra_flags_qemu=
extra_opts=
gem5=false gem5=false
gem5opts= gem5opts=
gem5_fsbiglittle=false
lkmc_eval= lkmc_eval=
initrd=false initrd=false
initramfs=false initramfs=false
@@ -34,7 +36,7 @@ trace_enabled=false
# just to prevent QEMU from emitting a warning that '' is not valid. # just to prevent QEMU from emitting a warning that '' is not valid.
trace_type=pr_manager_run trace_type=pr_manager_run
vnc= vnc=
while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:n:PT:U:uVx OPT; do while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:n:PT:U:uVX:x OPT; do
case "$OPT" in case "$OPT" in
a) a)
arch="$OPTARG" arch="$OPTARG"
@@ -114,6 +116,9 @@ while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:n:PT:U:uVx OPT; do
u) u)
tmux=true tmux=true
;; ;;
X)
extra_opts="${extra_opts} ${OPTARG}"
;;
x) x)
nographic=false nographic=false
;; ;;
@@ -128,6 +133,17 @@ while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:n:PT:U:uVx OPT; do
done done
shift "$(($OPTIND - 1))" shift "$(($OPTIND - 1))"
extra_flags="$extra_flags $@" extra_flags="$extra_flags $@"
OPTIND=1
while getopts b OPT "$extra_opts"; do
case "$OPT" in
b)
gem5_fsbiglittle=true
;;
?)
exit 2
;;
esac
done
set_common_vars -L "$common_linux_variant" -M "$common_gem5_variant" -n "$common_run_id" "$arch" "$gem5" set_common_vars -L "$common_linux_variant" -M "$common_gem5_variant" -n "$common_run_id" "$arch" "$gem5"
if "$debug" && "$kvm"; then if "$debug" && "$kvm"; then
echo 'error: -d and -K are incompatible' 1>&2 echo 'error: -d and -K are incompatible' 1>&2
@@ -176,6 +192,21 @@ ${debug_vm} \
--debug-file=trace.txt \\ --debug-file=trace.txt \\
${gem5opts} \ ${gem5opts} \
-d '${common_m5out_dir}' \\ -d '${common_m5out_dir}' \\
"
if "$gem5_fsbiglittle"; then
cmd="${gem5_common} \
"${common_gem5_default_src_dir}/configs/example/arm/fs_bigLITTLE.py" \
--big-cpus=2 \\
--cpu-type=atomic \\
--disk="${common_images_dir}/rootfs.ext2" \\
--dtb "${common_gem5_system_dir}/arm/dt/armv8_gem5_v1_big_little_2_2.dtb" \\
--kernel="${common_vmlinux}" \\
--little-cpus=2 \\
${extra_flags} \\
"
else
gem5_common="\
${gem5_common} \
'${common_gem5_src_dir}/configs/example/fs.py' \\ '${common_gem5_src_dir}/configs/example/fs.py' \\
--disk-image='${common_images_dir}/rootfs.ext2' \\ --disk-image='${common_images_dir}/rootfs.ext2' \\
--kernel='${common_vmlinux}' \\ --kernel='${common_vmlinux}' \\
@@ -183,24 +214,25 @@ ${gem5opts} \
--num-cpus='${cpus}' \\ --num-cpus='${cpus}' \\
--script='${readfile_file}' \\ --script='${readfile_file}' \\
" "
if [ "$arch" = x86_64 ]; then if [ "$arch" = x86_64 ]; then
if "$kvm"; then if "$kvm"; then
extra_flags="$extra_flags --cpu-type=X86KvmCPU" extra_flags="$extra_flags --cpu-type=X86KvmCPU"
fi fi
cmd="\ cmd="\
${gem5_common} \ ${gem5_common} \
--command-line='earlyprintk=ttyS0 console=ttyS0 lpj=7999923 root=/dev/sda ${extra_append}' \\ --command-line='earlyprintk=ttyS0 console=ttyS0 lpj=7999923 root=/dev/sda ${extra_append}' \\
${extra_flags} \ ${extra_flags} \
" "
elif [ "$arch" = arm ] || [ "$arch" = aarch64 ]; then elif [ "$arch" = arm ] || [ "$arch" = aarch64 ]; then
# TODO why is it mandatory to pass mem= here? Not true for QEMU. # TODO why is it mandatory to pass mem= here? Not true for QEMU.
# Anything smaller than physical blows up as expected, but why can't it auto-detect the right value? # Anything smaller than physical blows up as expected, but why can't it auto-detect the right value?
cmd="${gem5_common} \ cmd="${gem5_common} \
--command-line='earlyprintk=pl011,0x1c090000 console=ttyAMA0 lpj=19988480 rw loglevel=8 mem=${memory} root=/dev/sda ${extra_append}' \\ --command-line='earlyprintk=pl011,0x1c090000 console=ttyAMA0 lpj=19988480 rw loglevel=8 mem=${memory} root=/dev/sda ${extra_append}' \\
--dtb-file='${common_gem5_system_dir}/arm/dt/$([ "$arch" = arm ] && echo "armv7_gem5_v1_${cpus}cpu" || echo "armv8_gem5_v1_${cpus}cpu").dtb' \\ --dtb-file='${common_gem5_system_dir}/arm/dt/$([ "$arch" = arm ] && echo "armv7_gem5_v1_${cpus}cpu" || echo "armv8_gem5_v1_${cpus}cpu").dtb' \\
--machine-type=VExpress_GEM5_V1 \\ --machine-type=VExpress_GEM5_V1 \\
${extra_flags} \ ${extra_flags} \
" "
fi
fi fi
else else
mkdir -p "$common_qemu_run_dir" mkdir -p "$common_qemu_run_dir"

View File

@@ -6,57 +6,62 @@
[options="header"] [options="header"]
|=== |===
|Name |Argument name |Description |Name |Argument name |Description
|`-a` |`ARCH` |Run architecture `ARCH`. |`-a` |`ARCH` |Run architecture `ARCH`.
|`-c` |`NCPUS` |Emulate `NCPUS` guest CPUs. |`-c` |`NCPUS` |Emulate `NCPUS` guest CPUs.
|`-D` | |Run GDB on the emulator itself. |`-D` | |Run GDB on the emulator itself.
|`-d` | |Wait for GDB to connect before starting execution. |`-d` | |Wait for GDB to connect before starting execution.
|`-E` |`CMDSTR` |Replace the normal init with a minimal init that just evals |`-E` |`CMDSTR` |Replace the normal init with a minimal init that just evals
with given `CMDSTR` bash command string. Example: with given `CMDSTR` bash command string. Example:
`-E 'insmod /hello.ko;'` `-E 'insmod /hello.ko;'`
|`-e` |`CLI_OPTIONS` |Pass an extra Linux kernel command line options, |`-e` |`CLI_OPTIONS` |Pass an extra Linux kernel command line options,
and place them before the dash separator `-`. and place them before the dash separator `-`.
Only options that come before the `-`, i.e. "standard" Only options that come before the `-`, i.e. "standard"
options, should be passed with this option. options, should be passed with this option.
Example: `./run -a arm -e 'init=/poweroff.out'` Example: `./run -a arm -e 'init=/poweroff.out'`
|`-F` |`CMDSTR` |Much like `-f`, but base64 encodes the string. |`-F` |`CMDSTR` |Much like `-f`, but base64 encodes the string.
Mnemonic: `-F` is to `-f` what `-E` is to `-e`. Mnemonic: `-F` is to `-f` what `-E` is to `-e`.
|`-f` |`CLI_OPTIONS` |Pass an extra Linux kernel command line options, |`-f` |`CLI_OPTIONS` |Pass an extra Linux kernel command line options,
add a dash `-` separator, and place the options after the dash. add a dash `-` separator, and place the options after the dash.
Intended for custom options understood by our `init` scripts, Intended for custom options understood by our `init` scripts,
most of which are prefixed by `lkmc_`, e.g.: most of which are prefixed by `lkmc_`, e.g.:
`./run -f 'lkmc_eval="wget google.com" lkmc_lala=y'` `./run -f 'lkmc_eval="wget google.com" lkmc_lala=y'`
Mnenomic: comes after `-e`. Mnenomic: comes after `-e`.
|`-G` | |Pass extra options to the gem5 executable. |`-G` | |Pass extra options to the gem5 executable.
Do not confuse with the arguments passed to config scripts, Do not confuse with the arguments passed to config scripts,
like `fs.py`. Example: `./run -G '--debug-flags=Exec --debug' -g` like `fs.py`. Example: `./run -G '--debug-flags=Exec --debug' -g`
|`-g` | |Use gem5 instead of QEMU. |`-g` | |Use gem5 instead of QEMU.
|`-h` | |Show this help message. |`-h` | |Show this help message.
|`-I` | |Run with initramfs. |`-I` | |Run with initramfs.
|`-i` | |Run with initrd. |`-i` | |Run with initrd.
|`-K` | |Use KVM. Only works if guest arch == host arch. |`-K` | |Use KVM. Only works if guest arch == host arch.
|`-k` | |Enable KGDB. |`-k` | |Enable KGDB.
|`-L` | |Linux kernel build variant. |`-L` | |Linux kernel build variant.
|`-m` | |Set the memory size of the guest. E.g.: `-m 512M`. Default: `256M`. |`-m` | |Set the memory size of the guest. E.g.: `-m 512M`. Default: `256M`.
The default is the minimum amount that boots all archs without extra The default is the minimum amount that boots all archs without extra
options added. Anything lower will lead some arch to fail to boot. options added. Anything lower will lead some arch to fail to boot.
Any Any
|`-n` | |Run ID. |`-n` | |Run ID.
|`-P` | |Run the downloaded prebuilt images. |`-P` | |Run the downloaded prebuilt images.
|`-T` |`TRACE_TYPES` |Set trace events to be enabled. |`-T` |`TRACE_TYPES` |Set trace events to be enabled.
If not given, gem5 tracing is completely disabled, while QEMU tracing If not given, gem5 tracing is completely disabled, while QEMU tracing
is enabled but uses default traces that are very rare and don't affect is enabled but uses default traces that are very rare and don't affect
performance. `./configure --enable-trace-backends=simple` seems to enable performance. `./configure --enable-trace-backends=simple` seems to enable
some traces by default, e.g. `pr_manager_run`, and I don't know how to some traces by default, e.g. `pr_manager_run`, and I don't know how to
get rid of them. get rid of them.
|`-U` | |Pass extra parameters to the program running on the `-u` tmux split. |`-U` | |Pass extra parameters to the program running on the `-u` tmux split.
|`-u` | |Create a tmUx split the window. |`-u` | |Create a tmUx split the window.
You must already be inside of a `tmux` session to use this option. You must already be inside of a `tmux` session to use this option.
* on the main window, run the emulator as usual * on the main window, run the emulator as usual
* on the split: * on the split:
** if on QEMU and `-d` is given, GDB ** if on QEMU and `-d` is given, GDB
** if on gem5, the gem5 terminal ** if on gem5, the gem5 terminal
|`-V` | |Run QEMU with VNC instead of the default SDL. |`-V` | |Run QEMU with VNC instead of the default SDL.
Connect to it with: `vinagre localhost:5900`. Connect to it with: `vinagre localhost:5900`.
|`-x` | |Run in graphic mode. Mnemonic: X11. |`-X` |`EXTRA_OPTS` |Extra options that did not fit into `A-z`!
This string is parsed by `getopt` on a separate parse step with different
meanings for each flag.
|`-X-b` | |Use `fs_bigLITTLE.py` instead of `fs.py` on gem5 simulation.
Ignored by QEMU.
|`-x` | |Run in graphic mode. Mnemonic: X11.
|=== |===