vhost-user Negotiation

Introduction When adapting gokvm to vhost-user, I investigated the initialization part, so I’m leaving it as a memo. The QEMU documentation Vhost-user Protocol 1 summarizes it in detail, but there are parts that can’t be understood without actually running it (exception handling, request order, log output, etc.), so I tried it. After various trial and error, I was able to test it easily with just QEMU and DPDK. Here, I ran QEMU in server mode and DPDK in client mode....

March 8, 2023

Self-made VMM: u-root-based initrd

Introduction Continuation of gokvm development 1 2 3 4 5 6. As introduced up to last time, by supporting virtio-blk and virtio-net, the virtual machine can now communicate with the outside through IO. This time, I changed the initrd from busybox-based to u-root-based, so I’ll talk about that. 0d89a47f Introduction of u-root-based initrd I received a Pull Request suggesting that a VMM written in Go language should have an initrd also written in Go....

June 13, 2022

virtio-blk Support for Custom VMM

Introduction Continuing gokvm development 1 2 3 4 5. Following the previous virtio-net support, I added support for virtio-blk. The data structure and behavior of virt queue can be reused as is. I’m impressed that Virtio is well designed in this regard. 7389ff59 Adjust Guest Kernel Compile Options To achieve block IO through the filesystem from the guest kernel, I enabled the following options: CONFIG_VIRTIO_BLK=y CONFIG_XFS_FS=y CONFIG_EXT3_FS=y CONFIG_EXT4_FS=y 4f4bbb78 virtio-blk Implementation Now, let’s move on to the main topic of virtio-blk implementation....

April 12, 2022

virtio-net Support for Custom VMM

Introduction Continuing gokvm development 1 2 3 4. Through recent development, I was able to provide a virtual NIC to VMs on gokvm via virtio-net. Networking support was one of the initial goals, so I feel a sense of accomplishment. With this support, VMs on gokvm can now communicate with the host (or the outside via a software switch). It broadens what you can do, such as providing a web server or logging in via SSH, which I think is a major change....

March 18, 2022

PCI Device Support for Custom VMM

Introduction Continuing gokvm development 1 2 3. I’ve been developing to enable VMs on gokvm to handle PCI devices. The road will be long, but ultimately I want to establish IP connectivity between the VM and the outside via virtio-net. At the moment, I was able to get the guest kernel to recognize the virtio-net device as a network interface, so I’ll leave a log up to that point for now....

January 24, 2022

SMP Support for Custom VMM with KVM

Introduction A progress report on gokvm development 1 2. Until now, I only supported a single virtual CPU. I wanted to support SMP (Symmetric Multiprocessing) for multi-CPU, and after about 2-3 weeks of trial and error, I was able to implement it successfully. As far as I know, while searching for efforts to create a VMM with KVM, I couldn’t find many resources that explain what SMP support specifically looks like in implementation....

November 25, 2021

Building a VMM with KVM to Boot Linux - Development Log 2

2021/2/24 WSL2 Support 4f6b785 When running gokvm on Ubuntu 20.04 on WSL2 (Windows Subsystem for Linux 2), output to IO port 0x64 was repeated infinitely and didn’t reach the Init process startup. It seems the behavior around the PS/2 keyboard was the cause. In kvmtool, it returns 0x20 for in (0x61) 1, so I followed that approach. IO port 0x61 appears to be used as NMI (Non-Maskable Interrupt) status and control register 2....

March 3, 2021

Building a VMM with KVM to Boot Linux - Development Log

Introduction I created a naive and experimental VMM using KVM. It creates virtual machines by calling /dev/kvm through ioctl, and can boot the Linux Kernel and user processes on them. I also implemented a very simple serial console emulation that can be recognized by the kernel’s device driver, allowing operation from the login shell. On the other hand, networking and disks are not yet supported at this time. Recently, KVM has been used not only as a traditional virtual machine, but also to strengthen isolation levels in multi-tenant cloud environments, such as Google gVisor 1, Kata Containers 2, and Amazon Firecracker 3, for use in containers and micro VMs....

February 18, 2021