From 01a84e7f79b220aa025b4a22869cdb028844b99f Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Wed, 28 Mar 2018 23:06:45 +0100 Subject: [PATCH] OK, direct the annoying traces to the output folder Otherwise it was getting messy to distinguish between trace-events and trace- in the .gitignore. Now only the latest trace will be kept, with a fixed name. --- .gitignore | 1 - build-usage.adoc | 44 ++++++++++++++++---------------- run | 7 +++++- run-usage.adoc | 65 ++++++++++++++++++++++++++---------------------- trace-boot | 2 +- 5 files changed, 64 insertions(+), 55 deletions(-) diff --git a/.gitignore b/.gitignore index d3ebcdf..9d986ba 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ gitignore* # Specific files. /9p /README.html -/trace-[0-9]* # GEM5 /m5out diff --git a/build-usage.adoc b/build-usage.adoc index 4e421b2..1a6350a 100644 --- a/build-usage.adoc +++ b/build-usage.adoc @@ -8,28 +8,28 @@ [options="header"] |=== -|Name |Argument name | Description -|`-a` |`ARCH` | Build for architecture `ARCH`. -|`-b` |`BR2_FILE` | Also use the given Buildroot configuration fragment file. - Pass multiple times to use multiple fragment files. -|`-B` |`BR2_CONFIG` | Add a single Buildroot option to the current build. - Example: `-B 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"'` -|`-c` |`BR2_FILE` | Also use the given Buildroot configuration fragment file. - Pass multiple times to use multiple fragment files. -|`-C` | | Skip the Buildroot configuration. Saves a few seconds, - but requires you to know what you are doing :-) -|`-g` | | Enable gem5 build and disable QEMU build. You also need - to use `-G` or `-- gem5-reconfigure` to rebuild gem5 - after the initial build. -|`-h` | | Show this help message. -|`-I` | | Enable initramfs for the current build. -|`-i` | | Enable initrd for the current build. -|`-K` |`KERNEL_CONFIG_FILE` | Use `KERNEL_CONFIG_FILE` as the exact Linux kernel - configuration. Ignore the default `kernel_config_fragment`. -|`-p` | | Pass extra arguments to the `rootfs_post_build_script`. -|`-S` | | Don't build QEMU with SDL support. - Graphics such as X11 won't work, only the terminal. -|`-v` | | Do a verbose build. +|Name |Argument name |Description +|`-a` |`ARCH` |Build for architecture `ARCH`. +|`-b` |`BR2_FILE` |Also use the given Buildroot configuration fragment file. + Pass multiple times to use multiple fragment files. +|`-B` |`BR2_CONFIG` |Add a single Buildroot option to the current build. + Example: `-B 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"'` +|`-c` |`BR2_FILE` |Also use the given Buildroot configuration fragment file. + Pass multiple times to use multiple fragment files. +|`-C` | |Skip the Buildroot configuration. Saves a few seconds, + but requires you to know what you are doing :-) +|`-g` | |Enable gem5 build and disable QEMU build. You also need + to use `-G` or `-- gem5-reconfigure` to rebuild gem5 + after the initial build. +|`-h` | |Show this help message. +|`-I` | |Enable initramfs for the current build. +|`-i` | |Enable initrd for the current build. +|`-K` |`KERNEL_CONFIG_FILE` |Use `KERNEL_CONFIG_FILE` as the exact Linux kernel + configuration. Ignore the default `kernel_config_fragment`. +|`-p` | |Pass extra arguments to the `rootfs_post_build_script`. +|`-S` | |Don't build QEMU with SDL support. + Graphics such as X11 won't work, only the terminal. +|`-v` | |Do a verbose build. |=== == build target options diff --git a/run b/run index 412788d..fd030c7 100755 --- a/run +++ b/run @@ -25,7 +25,8 @@ initramfs=false memory=256M nographic=true root='' -while getopts a:c:DdE:e:f:G:ghIiKkm:x OPT; do +trace_enable='' +while getopts a:c:DdE:e:f:G:ghIiKkm:T:x OPT; do case "$OPT" in a) arch="$OPTARG" @@ -78,6 +79,9 @@ while getopts a:c:DdE:e:f:G:ghIiKkm:x OPT; do m) memory="$OPTARG" ;; + T) + trace_enable="$OPTARG" + ;; x) nographic=false ;; @@ -169,6 +173,7 @@ ${debug_vm} \ -monitor telnet::45454,server,nowait \ -netdev user,hostfwd=tcp::45455-:45455,hostfwd=tcp::45456-:22,id=net0 \ -smp ${cpus} \ +-trace enable=${trace_enable},file='${lkmc_out_dir}/trace.bin' \ -virtfs local,path=9p,mount_tag=host_scratch,security_model=mapped,id=host_scratch \ -virtfs local,path=${out_dir}/build,mount_tag=host_out,security_model=mapped,id=host_out \ " diff --git a/run-usage.adoc b/run-usage.adoc index 8cb7d6f..d15c6ff 100644 --- a/run-usage.adoc +++ b/run-usage.adoc @@ -6,34 +6,39 @@ [options="header"] |=== -|Name |Argument name | Description -|`-a` |`ARCH` | Run architecture `ARCH`. -|`-c` |`NCPUS` | Emulate `NCPUS` guest CPUs. -|`-D` | | Run GDB on the emulator itself. -|`-d` | | Run in debug mode, expect a GDB connection to guest. -|`-E` |`CMDSTR` | Replace the normal init with a minimal init that just evals - with given `CMDSTR` bash command string. Example: - `-E 'insmod /hello.ko;'` -|`-e` |`CLI_OPTIONS` | Pass an extra Linux kernel command line options, - and place them before the dash separator `-`. - Only options that come before the `-`, i.e. "standard" - options, should be passed with this option. - Example: `./run -a arm -e 'init=/poweroff.out'` -|`-f` |`CLI_OPTIONS` | Pass an extra Linux kernel command line options, - add a dash `-` separator, and place the options after the dash. - Intended for custom options understood by our `init` scripts, - most of which are prefixed by `lkmc_`, e.g.: - `./run -f 'lkmc_eval="wget google.com" lkmc_lala=y'` - Mnenomic: comes after `-e`. -|`-G` | | Pass extra options to the gem5 executable. - Do not confuse with the arguments passed to config scripts, - like `fs.py`. Example: `./run -G '--help' -g` -|`-g` | | Use gem5 instead of QEMU. -|`-h` | | Show this help message. -|`-I` | | Run with initramfs. -|`-i` | | Run with initrd. -|`-K` | | Use KVM. Only works if guest arch == host arch. -|`-k` | | Enable KGDB. -|`-m` | | Set the memory size of the guest. E.g.: `-m 512M`. Default: `256M`. -|`-x` | | Run in graphic mode. Mnemonic: X11. +|Name |Argument name |Description +|`-a` |`ARCH` |Run architecture `ARCH`. +|`-c` |`NCPUS` |Emulate `NCPUS` guest CPUs. +|`-D` | |Run GDB on the emulator itself. +|`-d` | |Run in debug mode, expect a GDB connection to guest. +|`-E` |`CMDSTR` |Replace the normal init with a minimal init that just evals + with given `CMDSTR` bash command string. Example: + `-E 'insmod /hello.ko;'` +|`-e` |`CLI_OPTIONS` |Pass an extra Linux kernel command line options, + and place them before the dash separator `-`. + Only options that come before the `-`, i.e. "standard" + options, should be passed with this option. + Example: `./run -a arm -e 'init=/poweroff.out'` +|`-f` |`CLI_OPTIONS` |Pass an extra Linux kernel command line options, + add a dash `-` separator, and place the options after the dash. + Intended for custom options understood by our `init` scripts, + most of which are prefixed by `lkmc_`, e.g.: + `./run -f 'lkmc_eval="wget google.com" lkmc_lala=y'` + Mnenomic: comes after `-e`. +|`-G` | |Pass extra options to the gem5 executable. + Do not confuse with the arguments passed to config scripts, + like `fs.py`. Example: `./run -G '--help' -g` +|`-g` | |Use gem5 instead of QEMU. +|`-h` | |Show this help message. +|`-I` | |Run with initramfs. +|`-i` | |Run with initrd. +|`-K` | |Use KVM. Only works if guest arch == host arch. +|`-k` | |Enable KGDB. +|`-m` | |Set the memory size of the guest. E.g.: `-m 512M`. Default: `256M`. +|`-T` | |Enable extra QEMU trace events. + `./configure --enable-trace-backends=simple` seems to enable + some by default, e.g. `pr_manager_run`, and I don't know how to + get rid of them. But those events are rare and should not impact + performance, so we just ignore them for now. +|`-x` | |Run in graphic mode. Mnemonic: X11. |=== diff --git a/trace-boot b/trace-boot index dca50b3..07c0635 100755 --- a/trace-boot +++ b/trace-boot @@ -10,7 +10,7 @@ while getopts a: OPT; do esac done set_common_vars "$arch" false -time ./run -a "$arch" -e 'init=/poweroff.out' -- -trace exec_tb,file="${lkmc_out_dir}/trace.bin" +time ./run -a "$arch" -e 'init=/poweroff.out' -T exec_tb time ./qemu/scripts/simpletrace.py "${out_dir}/build/host-qemu-custom/trace-events-all" "${lkmc_out_dir}/trace.bin" >"${lkmc_out_dir}/trace.txt" # Instruction count.