Links
KVM and Qemu:
KVM and Qemu:
- Kernel-based Virtual Machine Technology
- QEMU/KVM VM Execution Basics
- https://dev.goodwu.net/post/2018-03-25-qemu-kvm-exec-basics/
- Qemu Internals:
- http://itanium.iis.sinica.edu.tw/~chenwj/qemu-tech.html
- http://blog.vmsplice.net/2011/03/qemu-internals-big-picture-overview.html
- QEMU Internal: Memory Region, Address Space and QEMU IO
- QEMU Internals: Overall architecture and threading model
- Minimal code for guest execution (check kvm_cpu_exec function of qemu/accel/kvm/kvm-all.c for Qemu implementation and KVM doc for IOCTLs)
open("/dev/kvm")
ioctl(KVM_CREATE_VM)
ioctl(KVM_CREATE_VCPU)
for (;;) {
ioctl(KVM_RUN)
switch (exit_reason) {
case KVM_EXIT_IO: /* ... */
case KVM_EXIT_HLT: /* ... */
}
}
- kvm_arch_vcpu_ioctl_run
- multiple-iothreads.txt
- https://github.com/qemu/qemu/blob/master/docs/devel/multiple-iothreads.txt
Perf on KVM
Perf on KVM
- Context resolution is a challenge
- PEBS for guest OS is disabled
- How to measure VM events using perf-event
I/O Emulation in KVM/QEMU hypervisor
I/O Emulation in KVM/QEMU hypervisor
Understanding Context in VT-x
Understanding Context in VT-x
Figure 6.7 schematically illustrates the aforementioned interactions for the KVM/QEMU
hypervisor. Generally, every hosted virtual machine is encapsulated within a QEMU process,
such that different VMs reside in different processes. Internally, a QEMU process represents the
VCPUs (virtual cores) of its VM using different threads. Additionally, for every virtual device that
QEMU hands to its VM, it spawns another thread, denoted as “I/O thread”. VCPU threads have
two execution contexts: one for the guest VM and one for the host QEMU. The role of the host
VCPU context is to handle exits of the guest VCPU context. The role of the I/O thread is to handle
asynchronous activity related to the corresponding virtual device, which is not synchronously
initiated by guest VCPU contexts. For example, handling incoming network packets.
The illustration in Figure 6.7 depicts a VM that has two VCPUs and one I/O device. The
guest VM device driver issues MMIOs/PIOs to drive the device. But the device is virtual, so
these operations are directed at ordinary, read/write-protected memory locations, triggering exits
that suspend the VM VCPU context and invoke KVM. The latter relays the events back to the
very same VCPU thread, but to its host, rather than guest, execution context. QEMU’s device
emulation layer then processes these events, using the physical resources of the system, typically
through regular system calls.
Publications on Performance Profiling on VM
Publications on Performance Profiling on VM
- Du, Jiaqing, Nipun Sehrawat, and Willy Zwaenepoel. "Performance profiling in a virtualized environment." Proceedings of the 2nd USENIX Workshop on Hot Topics in Cloud Computing. No. EPFL-CONF-149112. 2010.
- Bratanov, Stanislav, Roman Belenov, and Nikita Manovich. "Virtual machines: a whole new world for performance analysis." ACM SIGOPS Operating Systems Review 43.2 (2009): 46-55.
- Nikolaev, Ruslan, and Godmar Back. "Perfctr-xen: a framework for performance counter virtualization." Acm Sigplan Notices. Vol. 46. No. 7. ACM, 2011.
- James Snee, Lucian Carata, Oliver R. A. Chick, Ripduman Sohan, Ramsey M. Faragher, Andrew Rice, and Andy Hopper. 2015. Soroban: attributing latency in virtualized environments. In Proceedings of the 7th USENIX Conference on Hot Topics in Cloud Computing (HotCloud'15). USENIX Association, Berkeley, CA, USA, 11-11.
Supported guests by KVM
Supported guests by KVM
- https://www.linux-kvm.org/page/Guest_Support_Status
Random Reading
Random Reading
- The Performance Cost of Shadow Stacks and Stack Canaries