Reputation: 346
I am running a guest OS on KVM with Intel VT-x. I am trying to understand how NMI is handled when it is running in non-root mode. Does Intel VT-x automatically cause an NMI at the guest or the Linux kernel's kvm subsystem sends the NMI to VCPU? Although I have registered an NMI handler in guest OS, I only get a host NMI trigger during non-root execution.
Upvotes: 2
Views: 458
Reputation: 12435
This is a partial answer to the question. I can describe what the processor does when an NMI occurs, but I don't know what KVM does.
If the NMI Exiting control is 0 and an NMI arrives while in VMX-non-root mode, the NMI is delivered to the guest via the guest's IDT.
If the NMI Exiting control is 1, an NMI causes a VM exit. [Intel SDM, volume 3, section 24.6.1, table 24-5]
Probably KVM sets this control to 1. In this case, the processor does not automatically process the NMI. It is up to KVM how to handle it when the VM exit occurs. It may deliver the NMI to the host through the host IDT or it may inject it into the guest.
Upvotes: 2