Skip to content

Commit

Permalink
Only disable SMP for the capture kernel when not using KVM acceleration
Browse files Browse the repository at this point in the history
Disabling SMP is necessary to work around a bug in QEMU's handling of
the capture kernel, but makes the tests run much slower. However, this
bug only appears to manifest when KVM acceleration is disabled, so the
testing harness has been modified to only disable SMP when this is true.

Signed-off-by: Kevin Svetlitski <[email protected]>
  • Loading branch information
Svetlitski committed Jan 11, 2022
1 parent d79ee95 commit c04889b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vmtest/enter_kdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
with open("/proc/cmdline", "rb") as f:
cmdline = f.read().rstrip(b"\n")
cmdline = re.sub(rb"(^|\s)crashkernel=\S+", b"", cmdline)
# `nosmp` is required to avoid QEMU sporadically failing an internal assertion
# `nokaslr` is required to avoid sporadically failing to reserve space for the
# capture kernel
cmdline += b" nosmp nokaslr"
cmdline += b" nokaslr"
if not os.path.exists("/dev/kvm_enabled"):
# `nosmp` is required to avoid QEMU sporadically failing an internal assertion
cmdline += b" nosmp"

with open(f"/lib/modules/{os.uname().release}/vmlinuz", "rb") as kernel:
if syscall(
Expand Down
5 changes: 5 additions & 0 deletions vmtest/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@
"$BUSYBOX" ln -s /proc/self/fd/1 /dev/stdout
"$BUSYBOX" ln -s /proc/self/fd/2 /dev/stderr
if {kvm_enabled}; then
"$BUSYBOX" touch /dev/kvm_enabled
fi
# Configure networking.
"$BUSYBOX" hostname "$HOSTNAME"
"$BUSYBOX" ip link set lo up
Expand Down Expand Up @@ -217,6 +221,7 @@ def run_in_vm(command: str, kernel_dir: Path, build_dir: Path) -> int:
busybox=shlex.quote(busybox),
python=shlex.quote(sys.executable),
command=shlex.quote(command),
kvm_enabled="true" if kvm_args else "false",
)
)
os.chmod(init, 0o755)
Expand Down

0 comments on commit c04889b

Please sign in to comment.