From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v3 1/3] KVM: nVMX: Rework interception of IRQs and NMIs Date: Fri, 07 Mar 2014 16:44:53 +0100 Message-ID: <5319E975.1030400@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm To: Jan Kiszka , Gleb Natapov , Marcelo Tosatti Return-path: Received: from mail-ea0-f172.google.com ([209.85.215.172]:55995 "EHLO mail-ea0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753800AbaCGPo7 (ORCPT ); Fri, 7 Mar 2014 10:44:59 -0500 Received: by mail-ea0-f172.google.com with SMTP id l9so2405710eaj.17 for ; Fri, 07 Mar 2014 07:44:58 -0800 (PST) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Il 06/03/2014 18:33, Jan Kiszka ha scritto: > Move the check for leaving L2 on pending and intercepted IRQs or NMIs > from the *_allowed handler into a dedicated callback. Invoke this > callback at the relevant points before KVM checks if IRQs/NMIs can be > injected. The callback has the task to switch from L2 to L1 if needed > and inject the proper vmexit events. > > The rework fixes L2 wakeups from HLT and provides the foundation for > preemption timer emulation. > > Signed-off-by: Jan Kiszka > --- > arch/x86/include/asm/kvm_host.h | 2 ++ > arch/x86/kvm/vmx.c | 67 +++++++++++++++++++++++------------------ > arch/x86/kvm/x86.c | 15 +++++++-- > 3 files changed, 53 insertions(+), 31 deletions(-) With this patch do we still need if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) /* * We get here if vmx_interrupt_allowed() said we can't * inject to L1 now because L2 must run. The caller will have * to make L2 exit right after entry, so we can inject to L1 * more promptly. */ return -EBUSY; in enable_irq_window? If not, enable_nmi_window and enable_irq_window can both return void. And perhaps, vmx_check_nested_events could use the preemption timer trick from Jailhouse instead of smp_send_reschedule. Paolo