Skip to contentSkip to conversation

non-root mode and preemption

DISCUSSION Oscar Fernando Garcia 2 participants 2 messages Jun 13, 2016 KVM

lore
Share & tools
lore
#0 lore raw

Good Morning,

I have a simple question. In KVM code: /arch/x86/kvm/x86.c when the function vcpu_enter_guest is called, the run function ( kvm_x86_ops->run(vcpu)) is called with preemption and irqs disabled. My question is, running in non-root mode with preemption and irqs disabled affects the latency of other processes or VPCUs running in the same CPU?

Thank you

Oscar

maintainer
#1 lore raw
Quoted 8 lines · Oscar Fernando Garcia

Good Morning,

I have a simple question. In KVM code: /arch/x86/kvm/x86.c when the function vcpu_enter_guest is called, the run function ( kvm_x86_ops->run(vcpu)) is called with preemption and irqs disabled. My question is, running in non-root mode with preemption and irqs disabled affects the latency of other processes or VPCUs running in the same CPU?

Even though kvm_x86_ops->run itself is called with interrupts disabled, interrupts are enabled while the guest runs. Instead of being serviced immediately by the processor, however, they cause a vmexit. The interrupt routine is then called during kvm_x86_ops->handle_external_intr, and preemption is enabled again soon after that in vcpu_enter_guest.

The extra latency introduced by KVM is very low, around 1000 clock cycles or less than a microsecond.

Paolo