My question is regarding interrupts and how are they handed when the guest is executing in KVM?
Lets say when kvm calls vmentry or vmresume, the guest code starts executing. Now when an ext开发者_如何学Pythonernal interrupt say timer interrupt occurs, the guest will cause a vmexit. After Vmexit will the next instruction in kvm execute or will the host interrupt caller gets called. If the next instruction in kvm gets called then kvm can do whatever it wants to and then call the appropriate host interrupt handler.
Thanks,
On Intel VT-x, all interrupts cause a trap into the host operating system. The host will then determine if the interrupt is:
For itself (in which case it will handle it, possibly causing KVM to sit unscheduled for quite some time); or
For the guest, in which case it will inform KVM about the interrupt. KVM will then, in turn, inject the interrupt into the guest. (Note that this part of KVM runs in kernel mode; but I presume that you would still consider this to be KVM).
In either case, the host operating system takes control first.
Somewhat unrelated, but one extension to VT-x that would make us virtualisation guys happier is if certain interrupts could be sent directly to the guest, avoiding the trap into the host (and associated performance penalty) altogether. Alas, this doesn't seem to be on the cards just yet.
精彩评论