Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with QEMU(x86_64) >= pc-i440fx-7.1 and TCG and paging #1040

Open
skuenzer opened this issue Aug 11, 2023 · 0 comments
Open

Crash with QEMU(x86_64) >= pc-i440fx-7.1 and TCG and paging #1040

skuenzer opened this issue Aug 11, 2023 · 0 comments
Labels
kind/bug Something isn't working

Comments

@skuenzer
Copy link
Member

skuenzer commented Aug 11, 2023

Describe the bug

Unikraft's KVM platform library crashes early during boot on x86_64 with TCG (no KVM virtualization) with Paging API enabled. This only happens with QEMU pc models starting from 7.1: pc-i440fx-7.1, pc-i440fx-7.2, ...
I could not reproduce the crash with KVM acceleration (Tested on GCP Debian11 Linux: 5.10.0-23-cloud-amd64).

A workaround for avoiding the crash (failing assertion) can be achieved by using an QEMU pc machine model < 7.1: like pc-i440fx-7.0.

Steps to reproduce

It can be reproduced just with Unikraft (x86_64) and the following settings. The important one that causes the crash is CONFIG_PAGING-y:

CONFIG_PLAT_KVM=y
# CONFIG_KVM_KERNEL_VGA_CONSOLE is not set
# CONFIG_KVM_DEBUG_VGA_CONSOLE is not set
# CONFIG_KVM_PCI is not set
CONFIG_PAGING=y
CONFIG_LIBUKDEBUG_PRINTK_INFO=y
CONFIG_LIBUKDEBUG_PRINTD=y

QEMU (must be version >= 7.1) can be launched with:

qemu-system-x86_64 \
    -machine pc,accel=tcg -cpu qemu64,-vmx,-svm,+pdpe1gb \
    -nographic \
    -vga none \
    -display none
    -m 64 \
    -net none \
    -kernel build/unikraft_qemu-x86_64 \

Expected behavior

The crash should not appear and the system should continue booting further, up to the application.

Which architectures were you using or does this bug affect?

x86_64

Which platforms were you using or does this bug affect?

kvm

Relevant log output

SeaBIOS (version rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org)
Booting from ROM..[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 13000 - 14000 ()
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 14000 - 18000 (fl 2, 16384)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 18000 - 20000 (fl 3, 32768)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 20000 - 40000 (fl 5, 131072)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 40000 - 80000 (fl 6, 262144)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 80000 - 90000 (fl 4, 65536)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 90000 - 98000 (fl 3, 32768)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 98000 - 9c000 (fl 2, 16384)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 9c000 - 9e000 (fl 1, 8192)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 9e000 - 9f000 (fl 0, 4096)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 174000 - 178000 (fl 2, 16384)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 178000 - 180000 (fl 3, 32768)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 180000 - 200000 (fl 7, 524288)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 200000 - 400000 (fl 9, 2097152)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 400000 - 800000 (fl 10, 4194304)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 800000 - 1000000 (fl 11, 8388608)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 1000000 - 2000000 (fl 12, 1677721)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 2000000 - 3000000 (fl 12, 1677721)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 3000000 - 3800000 (fl 11, 8388608)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 3800000 - 3c00000 (fl 10, 4194304)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 3c00000 - 3e00000 (fl 9, 2097152)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 3e00000 - 3f00000 (fl 8, 1048576)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 3f00000 - 3f80000 (fl 7, 524288)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 3f80000 - 3fc0000 (fl 6, 262144)
[    0.000000] dbg:  [libukfallocbuddy] <fallocbuddy.c @  932> ffffff8000012000: Adding physical memory 3fc0000 - 3fe0000 (fl 5, 131072)
[    0.000000] CRIT: [libkvmplat] <paging.c @  541> Assertion failure: ukarch_paddr_range_isvalid(paddr, paddr + len)
[    0.000000] Info: [libkvmplat] <shutdown.c @   59> Unikraft halted
@skuenzer skuenzer added the kind/bug Something isn't working label Aug 11, 2023
skuenzer added a commit to skuenzer/unikraft that referenced this issue Aug 11, 2023
Limits QEMU PC machine model up to version 7.0 (pc-i440fx-7.0) for
x86. This is primarily done to keep Unikraft compatibility with TCG.

GitHub-Issue: unikraft#1040
Signed-off-by: Simon Kuenzer <simon@unikraft.io>
skuenzer added a commit to skuenzer/unikraft that referenced this issue Aug 14, 2023
Limits QEMU PC machine model up to version 7.0 (pc-i440fx-7.0) for
x86. This is primarily done to keep Unikraft compatibility with TCG.

GitHub-Issue: unikraft#1040
Signed-off-by: Simon Kuenzer <simon@unikraft.io>
unikraft-bot pushed a commit that referenced this issue Aug 16, 2023
Limits QEMU PC machine model up to version 7.0 (pc-i440fx-7.0) for
x86. This is primarily done to keep Unikraft compatibility with TCG.

GitHub-Issue: #1040
Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1041
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Status: 🧊 Icebox
Development

No branches or pull requests

1 participant