From patchwork Tue Oct 27 15:10:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 56109 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9RFEgRC015033 for ; Tue, 27 Oct 2009 15:14:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754521AbZJ0POf (ORCPT ); Tue, 27 Oct 2009 11:14:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754391AbZJ0POf (ORCPT ); Tue, 27 Oct 2009 11:14:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1027 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753757AbZJ0POf (ORCPT ); Tue, 27 Oct 2009 11:14:35 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9RFE3t7022714; Tue, 27 Oct 2009 11:14:03 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9RFE21m014592; Tue, 27 Oct 2009 11:14:02 -0400 Received: from amt.cnet (vpn-10-14.str.redhat.com [10.32.10.14]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n9RFE0Tb008909; Tue, 27 Oct 2009 11:14:01 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id D2C7B682A90; Tue, 27 Oct 2009 13:12:59 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n9RFCv0S009476; Tue, 27 Oct 2009 13:12:57 -0200 Message-Id: <20091027151125.405187270@redhat.com> User-Agent: quilt/0.47-1 Date: Tue, 27 Oct 2009 13:10:45 -0200 From: Marcelo Tosatti To: avi@redhat.com Cc: kvm , stable@kernel.org, Marcelo Tosatti Subject: [patch 3/3] KVM: only clear irq_source_id if irqchip is present References: <20091027151042.118902183@redhat.com> Content-Disposition: inline; filename=free-irqsource-id X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Index: kvm/virt/kvm/irq_comm.c =================================================================== --- kvm.orig/virt/kvm/irq_comm.c +++ kvm/virt/kvm/irq_comm.c @@ -243,6 +243,10 @@ void kvm_free_irq_source_id(struct kvm * printk(KERN_ERR "kvm: IRQ source ID out of range!\n"); goto unlock; } + clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap); + if (!irqchip_in_kernel(kvm)) + goto unlock; + for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++) { clear_bit(irq_source_id, &kvm->arch.vioapic->irq_states[i]); if (i >= 16) @@ -251,7 +255,6 @@ void kvm_free_irq_source_id(struct kvm * clear_bit(irq_source_id, &pic_irqchip(kvm)->irq_states[i]); #endif } - clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap); unlock: mutex_unlock(&kvm->irq_lock); }