I am working on optimizing KVM for IO virtual machines. I read KVM codes, usually all physical interrupts call VMexit and go into KVM. The host IDT then processes the corresponding physical interrupt. My question is how does KVM decide whether to introduce a virtual interrupt in the guest or not? and in what situation will he introduce a virtual interrupt to the guest?
thank
The kvm documentation is what says when virtual interupt can be inserted. Heres the link http://os1a.cs.columbia.edu/lxr/source/Documentation/kvm/api.txtsee line number 905.The struct kvm_run structure, which I think gives the application control over how it makes virtual machine behave. Use cscope and find the string request_interrupt_window in the source code. You will understand how kvm sees when you need to enter a guest for interupt injection. Also go to the api.txt file, it is very useful.
Greetings
EDITEDHere is one example of an interruption of a host injection into a guest.Suppose a page error occurred in GUEST GUEST
interupt . , / .VMCS, VMEXIT , MONITOR TRAP FLAG.
, ( virt-IO, ). irq request_threaded_irq kvm_assigned_dev_thread . , kvm_set_irq , , , , . x86 rflags.if, mov-SS, - TPR, - . KVM , .