Skip to content

Instantly share code, notes, and snippets.

View bjackman's full-sized avatar

Brendan Jackman bjackman

View GitHub Profile

QEMU Wrappers

QEMU is a pain to use, lots of people have built wrappers for it that can be used for kernel testing.

  • At Google we wrote an internal one called go/vm-cli. It is slightly coupled with Debian, it generates an image via Debootstrap.
  • At Isovalent they wrote https://github.com/cilium/little-vm-helper which is similar but has a JSON config language and also knows how to build kernels and manage Kconfigs.

Trying to run some mm selftests on QEMU using virtme-ng

Build kselftests:

make -j100 CC='ccache gcc' -C tools/testing/selftests  TARGETS=mm EXTRA_CFLAGS=-static install

Rootfs is a Debian system built like this:

TAP version 13
# ---------------------
# running ./gup_test -u
# ---------------------
# TAP version 13
# 1..1
# # GUP_FAST_BENCHMARK: Time: get:1777 put:239 us#
# ok 1 ioctl status 0
# # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
# [PASS]
TAP version 13
# ---------------------
# running ./gup_test -u
# ---------------------
# TAP version 13
# 1..1
# # GUP_FAST_BENCHMARK: Time: get:1777 put:239 us#
# ok 1 ioctl status 0
# # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
# [PASS]
Traceback (most recent call last):
File "/usr/local/google/home/jackmanb/.local/bin/b4", line 8, in <module>
sys.exit(cmd())
^^^^^
File "/usr/local/google/home/jackmanb/.local/share/pipx/venvs/b4/lib/python3.11/site-packages/b4/command.py", line 417, in cmd
cmdargs.func(cmdargs)
File "/usr/local/google/home/jackmanb/.local/share/pipx/venvs/b4/lib/python3.11/site-packages/b4/command.py", line 93, in cmd_send
b4.ez.cmd_send(cmdargs)
File "/usr/local/google/home/jackmanb/.local/share/pipx/venvs/b4/lib/python3.11/site-packages/b4/ez.py", line 2133, in cmd_send
reroll(mybranch, tag_msg, cl_msgid)
[System Info]
git version:
git version 2.47.0.296.gc08e6fccd8
cpu: x86_64
built from commit: c08e6fccd86136592273e319042f44cc8eadbb2a
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
OpenSSL: OpenSSL 3.0.13 30 Jan 2024
zlib: 1.3
‣ Loading configuration file /usr/local/google/home/jackmanb/src/mkosi-exp/mkosi.conf
‣ + /usr/bin/systemd-repart --version
‣ Validating certificates and keys
‣ Copying cached package manager metadata
‣ + cp --recursive --no-dereference --preserve=mode,links,timestamps,ownership,xattr --reflink=auto --copy-contents '/work/usr/local/google/home/jackmanb/src/mkosi-exp/.mkosi.cache/debian~testing~x86-64.metadata.cache' /work/usr/local/google/home/jackmanb/.cache/mkosi/mkosi-metadata-1hg9zdqd --no-target-directory
‣ Building default image
‣ Copying cached trees
‣ + cp --recursive --no-dereference --preserve=mode,links,timestamps,ownership,xattr --reflink=auto --copy-contents '/work/usr/local/google/home/jackmanb/src/mkosi-exp/.mkosi.cache/debian~testing~x86-64.cache' /work/usr/local/google/home/jackmanb/.cache/mkosi/mkosi-workspace-63kcm_me/root --no-target-directory
‣ Copying in extra file trees…
‣ + cp --version
execve("/usr/bin/stty", ["stty", "sane"], 0x7ffca3118bc8 /* 51 vars */) = 0
brk(NULL) = 0x562578367000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffbdbfb6000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/glibc-hwcaps/x86-64-v4/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/glibc-hwcaps/x86-64-v4/", 0x7ffec7dabbe0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/glibc-hwcaps/x86-64-v3/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/glibc-hwcaps/x86-64-v3/", 0x7ffec7dabbe0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/glibc-hwcaps/x86-64-v2/libc.so.6", O_RDONLY|O_CL
[Running: strace stty sane]
execve("/usr/bin/stty", ["stty", "sane"], 0x7ffc4fd030e8 /* 52 vars */) = 0
brk(NULL) = 0x5654e1a0c000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f13ee500000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/glibc-hwcaps/x86-64-v4/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/glibc-hwcaps/x86-64-v4/", 0x7ffe06702ba0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/glibc-hwcaps/x86-64-v3/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/glibc-hwcaps/x86-64-v3/", 0x7ffe06702ba0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/google/home/jackmanb/.local/lib/gli
‣ Loading configuration file /usr/local/google/home/jackmanb/src/mkosi-kernel/mkosi.local.conf
‣ Loading configuration file /usr/local/google/home/jackmanb/src/mkosi-kernel/mkosi.conf
‣ Setting CacheDirectory should be configured in [Build], not [Output].
‣ Setting BuildDirectory should be configured in [Build], not [Output].
‣ Setting WithNetwork should be configured in [Build], not [Content].
‣ Setting BuildSources should be configured in [Build], not [Content].
‣ Setting Incremental should be configured in [Build], not [Host].
‣ Setting ToolsTree should be configured in [Build], not [Host].
‣ Loading configuration file /usr/local/google/home/jackmanb/src/mkosi-kernel/mkosi.conf.d/20-debian/mkosi.conf
‣ Setting ToolsTreePackages should be configured in [Build], not [Host].