mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-28 12:34:26 +01:00
kvm
This commit is contained in:
50
README.adoc
50
README.adoc
@@ -882,23 +882,6 @@ Debug:
|
|||||||
|
|
||||||
Known quirks of the supported architectures are documented in this section.
|
Known quirks of the supported architectures are documented in this section.
|
||||||
|
|
||||||
=== x86
|
|
||||||
|
|
||||||
You can make QEMU <<gem5-vs-qemu-performance,run faster>> by passing it the `-enable-kvm` option as in:
|
|
||||||
|
|
||||||
....
|
|
||||||
./run - -enable-kvm
|
|
||||||
....
|
|
||||||
|
|
||||||
This uses the link:https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine[KVM Linux kernel feature] of the host to run most instructions natively, and therefore.
|
|
||||||
|
|
||||||
There are several downsides to this however:
|
|
||||||
|
|
||||||
* only works for x86 guest
|
|
||||||
* limits visibility, since more things are running natively
|
|
||||||
|
|
||||||
So for those reasons we don't turn it on by default.
|
|
||||||
|
|
||||||
=== arm
|
=== arm
|
||||||
|
|
||||||
TODOs:
|
TODOs:
|
||||||
@@ -1090,6 +1073,32 @@ Kernel modules built from the Linux mainline tree with `CONFIG_SOME_MOD=m`, are
|
|||||||
modprobe dummy-irq
|
modprobe dummy-irq
|
||||||
....
|
....
|
||||||
|
|
||||||
|
== KVM
|
||||||
|
|
||||||
|
You can make QEMU or gem5 <<gem5-vs-qemu-performance,run faster>> by passing enabling KVM with:
|
||||||
|
|
||||||
|
....
|
||||||
|
./run -K
|
||||||
|
....
|
||||||
|
|
||||||
|
but it was broken in gem5 with pending patches: https://www.mail-archive.com/gem5-users@gem5.org/msg15046.html
|
||||||
|
|
||||||
|
KVM uses the link:https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine[KVM Linux kernel feature] of the host to run most instructions natively.
|
||||||
|
|
||||||
|
We don't enable KVM by default because:
|
||||||
|
|
||||||
|
* only works if the architecture of the guest equals that of the host.
|
||||||
|
+
|
||||||
|
We have only tested / supported it on x86, but it is rumoured that QEMU and gem5 also have ARM KVM support if you are link:https://www.youtube.com/watch?v=8ItXpmLsINs[running an ARM desktop for some weird reason] :-)
|
||||||
|
* limits visibility, since more things are running natively:
|
||||||
|
** can't use GDB
|
||||||
|
** can't do instruction tracing
|
||||||
|
* kernel boots are already fast enough without `-enable-kvm`
|
||||||
|
|
||||||
|
The main use case for `-enable-kvm` in this repository is to test if something that takes a long time to run is functionally correct.
|
||||||
|
|
||||||
|
For example, when porting a benchmark to Buildroot, you can first use QEMU's KVM to test that benchmarks is producing the correct results, before analysing them more deeply in gem5, which runs much slower.
|
||||||
|
|
||||||
== X11
|
== X11
|
||||||
|
|
||||||
Only tested successfully in `x86_64`.
|
Only tested successfully in `x86_64`.
|
||||||
@@ -1616,7 +1625,7 @@ time ./run -a arm -e 'init=/poweroff.out'
|
|||||||
time ./run -a arm -e 'm5 exit' -g
|
time ./run -a arm -e 'm5 exit' -g
|
||||||
time ./run -a arm -e 'm5 exit' -g -- --caches --cpu-type=HPI
|
time ./run -a arm -e 'm5 exit' -g -- --caches --cpu-type=HPI
|
||||||
time ./run -a x86_64 -e 'init=/poweroff.out'
|
time ./run -a x86_64 -e 'init=/poweroff.out'
|
||||||
time ./run -a x86_64 -e 'init=/poweroff.out' - -enable-kvm
|
time ./run -a x86_64 -e 'init=/poweroff.out' -- -enable-kvm
|
||||||
time ./run -a x86_64 -e 'init=/poweroff.out' -g
|
time ./run -a x86_64 -e 'init=/poweroff.out' -g
|
||||||
....
|
....
|
||||||
|
|
||||||
@@ -1879,7 +1888,7 @@ External open source benchmarks. We will try to create Buildroot packages for th
|
|||||||
|
|
||||||
===== PARSEC benchmark
|
===== PARSEC benchmark
|
||||||
|
|
||||||
We have ported the PARSEC benchmark http://parsec.cs.princeton.edu for cross compilation at: https://github.com/cirosantilli/parsec-benchmark
|
We have ported parts of the link:http://parsec.cs.princeton.edu[PARSEC benchmark] for cross compilation at: https://github.com/cirosantilli/parsec-benchmark See the documentation on that repo to find out which benchmarks have been ported.
|
||||||
|
|
||||||
This repo makes it trivial to get started with it:
|
This repo makes it trivial to get started with it:
|
||||||
|
|
||||||
@@ -1888,8 +1897,6 @@ configure -gpq && ./build -a arm -g -i buildroot_config_fragment_parsec
|
|||||||
./run -a arm -g
|
./run -a arm -g
|
||||||
....
|
....
|
||||||
|
|
||||||
As mentioned at link:https://github.com/cirosantilli/parsec-benchmark[], only SPLASH2 was currently ported.
|
|
||||||
|
|
||||||
Once inside the guest, we could in theory launch PARSEC exactly as you would launch it on the host:
|
Once inside the guest, we could in theory launch PARSEC exactly as you would launch it on the host:
|
||||||
|
|
||||||
....
|
....
|
||||||
@@ -1971,6 +1978,7 @@ If you want to remove PARSEC later, Buildroot doesn't provide an automated packa
|
|||||||
rm -rf \
|
rm -rf \
|
||||||
./buildroot/dl/parsec-* \
|
./buildroot/dl/parsec-* \
|
||||||
./buildroot/output.arm-gem5~/build/parsec-* \
|
./buildroot/output.arm-gem5~/build/parsec-* \
|
||||||
|
./buildroot/output.arm-gem5~/build/packages-file-list.txt \
|
||||||
./buildroot/output.arm-gem5~/images/rootfs.* \
|
./buildroot/output.arm-gem5~/images/rootfs.* \
|
||||||
./buildroot/output.arm-gem5~/target/parsec-* \
|
./buildroot/output.arm-gem5~/target/parsec-* \
|
||||||
;
|
;
|
||||||
|
|||||||
12
run
12
run
@@ -7,6 +7,7 @@ arch=x86_64
|
|||||||
cpus=1
|
cpus=1
|
||||||
debug_vm=''
|
debug_vm=''
|
||||||
kgdb=false
|
kgdb=false
|
||||||
|
kvm=false
|
||||||
nographic=false
|
nographic=false
|
||||||
# norandmaps: Don't use address space randomization. Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space.
|
# norandmaps: Don't use address space randomization. Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space.
|
||||||
# printk.time=y: log in format: "[time ] msg" for all printk messages.
|
# printk.time=y: log in format: "[time ] msg" for all printk messages.
|
||||||
@@ -19,7 +20,7 @@ gem5=false
|
|||||||
gem5opts=''
|
gem5opts=''
|
||||||
initrd=false
|
initrd=false
|
||||||
root=''
|
root=''
|
||||||
while getopts a:c:Dde:G:giknt:x OPT; do
|
while getopts a:c:Dde:G:giKknt:x OPT; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
a)
|
a)
|
||||||
arch="$OPTARG"
|
arch="$OPTARG"
|
||||||
@@ -36,6 +37,9 @@ while getopts a:c:Dde:G:giknt:x OPT; do
|
|||||||
e)
|
e)
|
||||||
extra_append="$extra_append $OPTARG"
|
extra_append="$extra_append $OPTARG"
|
||||||
;;
|
;;
|
||||||
|
K)
|
||||||
|
kvm=true
|
||||||
|
;;
|
||||||
k)
|
k)
|
||||||
extra_append="$extra_append kgdbwait"
|
extra_append="$extra_append kgdbwait"
|
||||||
# For those who want to try KDB.
|
# For those who want to try KDB.
|
||||||
@@ -66,6 +70,9 @@ if $gem5; then
|
|||||||
outdir="$(pwd)/buildroot/output.${arch}-gem5~"
|
outdir="$(pwd)/buildroot/output.${arch}-gem5~"
|
||||||
gem5_dir="$(pwd)/gem5/gem5"
|
gem5_dir="$(pwd)/gem5/gem5"
|
||||||
if [ "$arch" = x86_64 ]; then
|
if [ "$arch" = x86_64 ]; then
|
||||||
|
if "$kvm"; then
|
||||||
|
extra_flags="$extra_flags --cpu-type=X86KvmCPU"
|
||||||
|
fi
|
||||||
cmd="\
|
cmd="\
|
||||||
M5_PATH='$(pwd)/gem5/gem5-system' \
|
M5_PATH='$(pwd)/gem5/gem5-system' \
|
||||||
'${gem5_dir}/build/X86/gem5.opt' \
|
'${gem5_dir}/build/X86/gem5.opt' \
|
||||||
@@ -95,6 +102,9 @@ $extra_flags \
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
buildroot_out_dir="./buildroot/output.${arch}~"
|
buildroot_out_dir="./buildroot/output.${arch}~"
|
||||||
|
if "$kvm"; then
|
||||||
|
extra_flags="$extra_flags -enable-kvm"
|
||||||
|
fi
|
||||||
extra_flags="$extra_flags_qemu $extra_flags"
|
extra_flags="$extra_flags_qemu $extra_flags"
|
||||||
images_dir="$buildroot_out_dir/images"
|
images_dir="$buildroot_out_dir/images"
|
||||||
qemu_common="\
|
qemu_common="\
|
||||||
|
|||||||
Reference in New Issue
Block a user