‏مجموعات Google

OSv boots in 3ms on QEMU microvm machine


Waldek Kozaczuk 22/11/2019 05:34 ص
تم نشره في المجموعة: OSv Development
As you may have heard QEMU developers added new machine type: microvm - https://github.com/qemu/qemu/blob/master/docs/microvm.rst. It has been merged into master but not part of any official QEMU release. So if you want to try you need to build QEMU from the source.

Recently I have played with it and eventually managed to boot OSv successfully on it after some adjustments (see some of my recent virtio code tweaks). And the same OSv ROFS image that would boot in ~5 ms on firecracker, can boot in only ~3ms on QEMU microvm.

OSv v0.54.0-34-gccb9cd12
Booted up in 2.91 ms
Cmdline: /hello 
Hello from C code

real 0m0.057s
user 0m0.037s
sys 0m0.020s

and with these options:
qemu-system-x86_64 \
-m 64M \
-smp 1 \
--nographic \
-kernel ./scripts/../build/last/loader-stripped.elf \
-append "--nopci /hello" \
-M microvm,x-option-roms=off,pit=off,pic=off,rtc=off \
-nodefaults \
-no-user-config \
-no-reboot \
-global virtio-mmio.force-legacy=off \
-device virtio-blk-device,id=blk0,drive=hd0,scsi=off \
-drive file=./build/last/usr.img,if=none,id=hd0,cache=writeback,aio=threads \
-enable-kvm \
-cpu host,+x2apic \
-serial stdio

Adding 1 NIC makes it boot slower by ~1 ms:
OSv v0.54.0-34-gccb9cd12
eth0: 192.168.122.15
Booted up in 4.30 ms
Cmdline: /hello  
Hello from C code

Regards,
Waldek