From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] fix -no-kvm-irqchip regression Date: Thu, 14 Aug 2008 11:19:37 +0300 Message-ID: <48A3EA99.1000107@qumranet.com> References: <4881A93E.5050402@web.de> <488396BE.9090909@web.de> <4885B8AA.50105@qumranet.com> <48A295B2.3060501@web.de> <20080813234045.GK26466@duo.random> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060404030104090509000202" Cc: Jan Kiszka , kvm-devel To: Andrea Arcangeli Return-path: Received: from il.qumranet.com ([212.179.150.194]:41801 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753041AbYHNITg (ORCPT ); Thu, 14 Aug 2008 04:19:36 -0400 In-Reply-To: <20080813234045.GK26466@duo.random> Sender: kvm-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --------------060404030104090509000202 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Andrea Arcangeli wrote: > 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. > I don't like the usage of idt_vectoring_info; so I've switched the !irqchip_in_kernel path to use the interrupt queue. Attached patch boots Windows XP ACPI here. Will push it out once it passes regression testing. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. --------------060404030104090509000202 Content-Type: text/plain; name="0001-KVM-VMX-Use-interrupt-queue-for-irqchip_in_kernel.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-KVM-VMX-Use-interrupt-queue-for-irqchip_in_kernel.patch" >>From 37304c6f9ced347cf013bcd4bf808d6fd4fb6ce1 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Thu, 14 Aug 2008 11:13:16 +0300 Subject: [PATCH] KVM: VMX: Use interrupt queue for !irqchip_in_kernel Signed-off-by: Avi Kivity --- arch/x86/kvm/vmx.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 337670b..8693fb5 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2173,7 +2173,7 @@ static void kvm_do_inject_irq(struct kvm_vcpu *vcpu) clear_bit(bit_index, &vcpu->arch.irq_pending[word_index]); if (!vcpu->arch.irq_pending[word_index]) clear_bit(word_index, &vcpu->arch.irq_summary); - vmx_inject_irq(vcpu, irq); + kvm_queue_interrupt(vcpu, irq); } @@ -2187,13 +2187,12 @@ static void do_interrupt_requests(struct kvm_vcpu *vcpu, (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & 3) == 0); if (vcpu->arch.interrupt_window_open && - vcpu->arch.irq_summary && - !(vmcs_read32(VM_ENTRY_INTR_INFO_FIELD) & INTR_INFO_VALID_MASK)) - /* - * If interrupts enabled, and not blocked by sti or mov ss. Good. - */ + vcpu->arch.irq_summary && !vcpu->arch.interrupt.pending) kvm_do_inject_irq(vcpu); + if (vcpu->arch.interrupt_window_open && vcpu->arch.interrupt.pending) + vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); + cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); if (!vcpu->arch.interrupt_window_open && (vcpu->arch.irq_summary || kvm_run->request_interrupt_window)) -- 1.5.6.3 --------------060404030104090509000202--