From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Arcangeli Subject: [PATCH] fix -no-kvm-irqchip regression Date: Thu, 14 Aug 2008 01:40:45 +0200 Message-ID: <20080813234045.GK26466@duo.random> References: <4881A93E.5050402@web.de> <488396BE.9090909@web.de> <4885B8AA.50105@qumranet.com> <48A295B2.3060501@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm-devel To: Jan Kiszka Return-path: Received: from host36-195-149-62.serverdedicati.aruba.it ([62.149.195.36]:34875 "EHLO mx.cpushare.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752316AbYHMXkr (ORCPT ); Wed, 13 Aug 2008 19:40:47 -0400 Content-Disposition: inline In-Reply-To: <48A295B2.3060501@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Aug 13, 2008 at 10:05:06AM +0200, Jan Kiszka wrote: > Should this issue have been fixed meanwhile? I just gave latest git a > try and - as far as I recall my tests before holiday correctly - things > look the same. At least some Linux 2.6.23 kernel still hangs here during > early boot with -no-kvm-irqchip. The trouble was that clearing the idt_vectoring_info before handling the exit_reason would lead to the handle_exception to fail setting the irq_pending bit because is_external_interrupt was run on zero instead of the vmcs IDT_VECTORING_INFO_FIELD, so it didn't notice it was an external interrupt generating the exit. This makes the userland irqchip code work again for me, there seem to be no good reason to clear this value before returning in guest mode and only setting it to zero didn't look an effective debugging aid, so it's a microoptimization for the kernel irqchip too. Signed-off-by: Andrea Arcangeli diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 337670b..3c82593 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2890,13 +2890,10 @@ static void vmx_complete_interrupts(struct vcpu_vmx *vmx) kvm_queue_exception_e(&vmx->vcpu, vector, error); } else kvm_queue_exception(&vmx->vcpu, vector); - vmx->idt_vectoring_info = 0; } kvm_clear_interrupt_queue(&vmx->vcpu); - if (idtv_info_valid && type == INTR_TYPE_EXT_INTR) { + if (idtv_info_valid && type == INTR_TYPE_EXT_INTR) kvm_queue_interrupt(&vmx->vcpu, vector); - vmx->idt_vectoring_info = 0; - } } static void vmx_intr_assist(struct kvm_vcpu *vcpu)