Download Diplomarbeit Lightweight Virtualization on Microkernel
Transcript
4 Design Figure 4.5: Staged Virtualization. established by KVM, which does faithful virtualization, and runs unmodified OSes will be called second-stage VM. To support staged virtualization, KVM needs to be modified. Instead of building guest physical memory using Linux mechanism, and running the vmrun instruction itself, it needs to use hypercalls. The VMM translates these calls into the appropriate L4 system calls. Figure 4.5 gives an impression of this setup. The second-stage VM is run in the following way: VM execution starts in Qemu, which does its initialization. As soon as possible, it switches from emulation to execution using hardware virtualization. It therefore instructs KVM (a) to do a world switch. Contrary to native KVM, which does the world switch itself, in staged virtualization, KVM does a hypercall to instruct the VMM to do the world switch (b). The VMM then does the world switch on behalf of KVM using the microkernel interface (c). On intercepts, the second-stage VM is left (d), and the VMM resumes execution of the first-stage VM (e). Upon receiving control, KVM analyzes the exit reason of the second-stage VM, and switches back to Qemu (f) if needed. 4.7 Summary The system architecture is illustrated in Figure 4.6. The VMM uses the microkernel’s interface to control the VM execution (control loop) and memory. It uses L4 device managers as back ends for virtual devices. The guest’s stub drivers communicate using hypercalls, which the VMM translates into IPC messages that are sent to the corresponding device managers. Asynchronous system events are received by blocking threads, flagged at the virtual IC, and eventually injected into the VM by the control loop. 38