From: Paolo Bonzini Subject: Re: non-root mode and preemption Date: Mon, 13 Jun 2016 15:45:38 +0200 Message-ID: References: <575E85AC.4080604@softlab.cs.tsukuba.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Oscar Fernando Garcia , kvm@vger.kernel.org Return-path: Received: from mail-wm0-f46.google.com ([74.125.82.46]:36119 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422967AbcFMNpm (ORCPT ); Mon, 13 Jun 2016 09:45:42 -0400 Received: by mail-wm0-f46.google.com with SMTP id n184so79423026wmn.1 for ; Mon, 13 Jun 2016 06:45:41 -0700 (PDT) In-Reply-To: <575E85AC.4080604@softlab.cs.tsukuba.ac.jp> Sender: kvm-owner@vger.kernel.org List-ID: On 13/06/2016 12:06, Oscar Fernando Garcia wrote: > 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