mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
OK, direct the annoying traces to the output folder
Otherwise it was getting messy to distinguish between trace-events and trace-<pid> in the .gitignore. Now only the latest trace will be kept, with a fixed name.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,7 +9,6 @@ gitignore*
|
|||||||
# Specific files.
|
# Specific files.
|
||||||
/9p
|
/9p
|
||||||
/README.html
|
/README.html
|
||||||
/trace-[0-9]*
|
|
||||||
|
|
||||||
# GEM5
|
# GEM5
|
||||||
/m5out
|
/m5out
|
||||||
|
|||||||
@@ -8,28 +8,28 @@
|
|||||||
|
|
||||||
[options="header"]
|
[options="header"]
|
||||||
|===
|
|===
|
||||||
|Name |Argument name | Description
|
|Name |Argument name |Description
|
||||||
|`-a` |`ARCH` | Build for architecture `ARCH`.
|
|`-a` |`ARCH` |Build for architecture `ARCH`.
|
||||||
|`-b` |`BR2_FILE` | Also use the given Buildroot configuration fragment file.
|
|`-b` |`BR2_FILE` |Also use the given Buildroot configuration fragment file.
|
||||||
Pass multiple times to use multiple fragment files.
|
Pass multiple times to use multiple fragment files.
|
||||||
|`-B` |`BR2_CONFIG` | Add a single Buildroot option to the current build.
|
|`-B` |`BR2_CONFIG` |Add a single Buildroot option to the current build.
|
||||||
Example: `-B 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"'`
|
Example: `-B 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"'`
|
||||||
|`-c` |`BR2_FILE` | Also use the given Buildroot configuration fragment file.
|
|`-c` |`BR2_FILE` |Also use the given Buildroot configuration fragment file.
|
||||||
Pass multiple times to use multiple fragment files.
|
Pass multiple times to use multiple fragment files.
|
||||||
|`-C` | | Skip the Buildroot configuration. Saves a few seconds,
|
|`-C` | |Skip the Buildroot configuration. Saves a few seconds,
|
||||||
but requires you to know what you are doing :-)
|
but requires you to know what you are doing :-)
|
||||||
|`-g` | | Enable gem5 build and disable QEMU build. You also need
|
|`-g` | |Enable gem5 build and disable QEMU build. You also need
|
||||||
to use `-G` or `-- gem5-reconfigure` to rebuild gem5
|
to use `-G` or `-- gem5-reconfigure` to rebuild gem5
|
||||||
after the initial build.
|
after the initial build.
|
||||||
|`-h` | | Show this help message.
|
|`-h` | |Show this help message.
|
||||||
|`-I` | | Enable initramfs for the current build.
|
|`-I` | |Enable initramfs for the current build.
|
||||||
|`-i` | | Enable initrd for the current build.
|
|`-i` | |Enable initrd for the current build.
|
||||||
|`-K` |`KERNEL_CONFIG_FILE` | Use `KERNEL_CONFIG_FILE` as the exact Linux kernel
|
|`-K` |`KERNEL_CONFIG_FILE` |Use `KERNEL_CONFIG_FILE` as the exact Linux kernel
|
||||||
configuration. Ignore the default `kernel_config_fragment`.
|
configuration. Ignore the default `kernel_config_fragment`.
|
||||||
|`-p` | | Pass extra arguments to the `rootfs_post_build_script`.
|
|`-p` | |Pass extra arguments to the `rootfs_post_build_script`.
|
||||||
|`-S` | | Don't build QEMU with SDL support.
|
|`-S` | |Don't build QEMU with SDL support.
|
||||||
Graphics such as X11 won't work, only the terminal.
|
Graphics such as X11 won't work, only the terminal.
|
||||||
|`-v` | | Do a verbose build.
|
|`-v` | |Do a verbose build.
|
||||||
|===
|
|===
|
||||||
|
|
||||||
== build target options
|
== build target options
|
||||||
|
|||||||
7
run
7
run
@@ -25,7 +25,8 @@ initramfs=false
|
|||||||
memory=256M
|
memory=256M
|
||||||
nographic=true
|
nographic=true
|
||||||
root=''
|
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
|
case "$OPT" in
|
||||||
a)
|
a)
|
||||||
arch="$OPTARG"
|
arch="$OPTARG"
|
||||||
@@ -78,6 +79,9 @@ while getopts a:c:DdE:e:f:G:ghIiKkm:x OPT; do
|
|||||||
m)
|
m)
|
||||||
memory="$OPTARG"
|
memory="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
T)
|
||||||
|
trace_enable="$OPTARG"
|
||||||
|
;;
|
||||||
x)
|
x)
|
||||||
nographic=false
|
nographic=false
|
||||||
;;
|
;;
|
||||||
@@ -169,6 +173,7 @@ ${debug_vm} \
|
|||||||
-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='${lkmc_out_dir}/trace.bin' \
|
||||||
-virtfs local,path=9p,mount_tag=host_scratch,security_model=mapped,id=host_scratch \
|
-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 \
|
-virtfs local,path=${out_dir}/build,mount_tag=host_out,security_model=mapped,id=host_out \
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -6,34 +6,39 @@
|
|||||||
|
|
||||||
[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` | | Run in debug mode, expect a GDB connection to guest.
|
|`-d` | |Run in debug mode, expect a GDB connection to guest.
|
||||||
|`-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` |`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 '--help' -g`
|
like `fs.py`. Example: `./run -G '--help' -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.
|
||||||
|`-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`.
|
||||||
|`-x` | | Run in graphic mode. Mnemonic: X11.
|
|`-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.
|
||||||
|===
|
|===
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ while getopts a: OPT; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set_common_vars "$arch" false
|
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"
|
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.
|
# Instruction count.
|
||||||
|
|||||||
Reference in New Issue
Block a user