XenHVMAcct: Accurate CPU Time Accounting for Hardware-Assisted Virtual Machine
Huacai Chen, Hai Jin, Kan Hu · 2010
CPU time accounting is a basis of performance measurement and process scheduling in operating system. Accounting operations are traditionally completed in timer interrupt handler since timer interrupt is periodically delivered to OS. However, when virtualization introduced, the CPU time is shared by multiple virtual CPUs (i.e., VCPU for short) and the virtual timer interrupt is paused for those ones be scheduled out. This makes the time accounting be inaccurate, and we should consider new method for VM to provide a stable and reliable data source, especially for the hardware-assisted virtual machines (i.e., HVM for short) which are not aware of VMM. The key point of accurate CPU time accounting is to distinguish the time allocated to “this VCPU” and “other VCPUs”. Para-virtualization (i.e., PV for short) achieves this goal by modifying the timer handling routines. For HVM, we propose an accurate accounting method (named XenHVMAcct) within Xen virtual platform. XenHVMAcct is designed by using the mechanisms of virtual interrupt and loadable kernel module, without direct modifications to guest OS. Experimental results show that our accounting method is as accurate as the PV solution.