what happens when an external interrupt is received by the host in a virtual setting

49 Views Asked by At

I'm trying to understand what happens in a virtualization setting when the host receives an external interrupt. For example if CPU-1 is being utilized by vCPU-0 of a VM and there is an external interrupt, can that host ISR run on CPU-1 or does it prevent all host interrupts from running on CPU's assigned to the VM ? If it can, then does it result in a VMExit and if so how does one go from host ISR running to VMExit ? This question addresses part of it but does not discuss the path I'm mention above, it assumes a VMExit happens but I'm looking for the sequence of steps that lead to it.

1

There are 1 best solutions below

1
prl On

The CPU that the interrupt is delivered to is controlled by the interrupt remapping table in the IOMMU and/or the MSI programmed in the device.

When the interrupt is delivered to the CPU core, it generally causes a VM exit. The VM exit is caused by the interrupt itself, before any interrupt handler is called.

It is up to the VM exit handler to decide how to handle the interrupt and whether a host ISR should be called.

The VT-d feature called posted interrupts allows an interrupt to be delivered directly to the currently running VCPU without a VM exit, as described in the answer to the question you linked.