From patchwork Fri Mar 7 16:46:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 3793421 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22CF8BF540 for ; Fri, 7 Mar 2014 16:47:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 506142026F for ; Fri, 7 Mar 2014 16:47:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 231D8202F0 for ; Fri, 7 Mar 2014 16:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753993AbaCGQrF (ORCPT ); Fri, 7 Mar 2014 11:47:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4834 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753973AbaCGQrD (ORCPT ); Fri, 7 Mar 2014 11:47:03 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s27Gkw4X001738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Mar 2014 11:46:59 -0500 Received: from yakj.usersys.redhat.com (ovpn-112-53.ams2.redhat.com [10.36.112.53]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s27GktIp024409; Fri, 7 Mar 2014 11:46:56 -0500 Message-ID: <5319F7FE.50106@redhat.com> Date: Fri, 07 Mar 2014 17:46:54 +0100 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Jan Kiszka , Gleb Natapov , Marcelo Tosatti CC: kvm Subject: Re: [PATCH v3 1/3] KVM: nVMX: Rework interception of IRQs and NMIs References: <5319E975.1030400@redhat.com> <5319F3E2.3020205@siemens.com> In-Reply-To: <5319F3E2.3020205@siemens.com> X-Enigmail-Version: 1.6 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Il 07/03/2014 17:29, Jan Kiszka ha scritto: > On 2014-03-07 16:44, Paolo Bonzini wrote: >> 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. > > I don't see right now why this should have changed. We still cannot > interrupt vmlaunch/vmresume. But then shouldn't the ame be true for enable_nmi_window? It doesn't check is_guest_mode(vcpu) && nested_exit_on_nmi(vcpu). Since check_nested_events has already returned -EBUSY, perhaps the following: --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index fda1028..df320e9 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -4522,15 +4522,6 @@ static int enable_irq_window(struct kvm_vcpu *vcpu) { u32 cpu_based_vm_exec_control; - 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; - cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING; vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index a03d611..83c2df5 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5970,13 +5970,13 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) inject_pending_event(vcpu); - if (is_guest_mode(vcpu) && kvm_x86_ops->check_nested_events) - req_immediate_exit |= - kvm_x86_ops->check_nested_events(vcpu, - req_int_win) != 0; + if (is_guest_mode(vcpu) && + kvm_x86_ops->check_nested_events && + kvm_x86_ops->check_nested_events(vcpu, req_int_win) != 0) + req_immediate_exit = true; /* enable NMI/IRQ window open exits if needed */ - if (vcpu->arch.nmi_pending) + else if (vcpu->arch.nmi_pending) req_immediate_exit |= kvm_x86_ops->enable_nmi_window(vcpu) != 0; else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win)