1. A method, comprising: receiving, by a processing device executing a hypervisor of a host computer system, a request to deliver an interrupt to a virtual central processing unit (vCPU) of a virtual machine; virtualizing the interrupt to generate a virtualized interrupt directed to the vCPU; refraining from delivering the virtualized interrupt to the vCPU while the vCPU is executing a virtual machine (VM) function; monitoring the vCPU for completion of the VM function, wherein the VM function represents a privileged operation invoked by the virtual machine without performing a VM exit; in view of the monitoring of the vCPU for completion of the VM function, modifying a code of the VM function to cause the VM function to exit; and responsive to detecting that execution of the VM function is complete, delivering the virtualized interrupt to the vCPU.