From patchwork Wed Oct 28 20:42:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 56354 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 n9SKkXfh006708 for ; Wed, 28 Oct 2009 20:46:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755587AbZJ1UqZ (ORCPT ); Wed, 28 Oct 2009 16:46:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755570AbZJ1UqZ (ORCPT ); Wed, 28 Oct 2009 16:46:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41486 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755546AbZJ1UqY (ORCPT ); Wed, 28 Oct 2009 16:46:24 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9SKkTT1002819 for ; Wed, 28 Oct 2009 16:46:29 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9SKkTib026454; Wed, 28 Oct 2009 16:46:29 -0400 Received: from amt.cnet (vpn-10-90.str.redhat.com [10.32.10.90]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n9SKkRKG021103; Wed, 28 Oct 2009 16:46:28 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 2B13358815E; Wed, 28 Oct 2009 18:45:18 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n9SKjGFw017741; Wed, 28 Oct 2009 18:45:16 -0200 Message-Id: <20091028204400.108423110@amt.cnet> User-Agent: quilt/0.47-1 Date: Wed, 28 Oct 2009 18:42:40 -0200 From: Marcelo Tosatti To: avi@redhat.com Cc: kvm@vger.kernel.org, mst@redhat.com, gleb@redhat.com, Marcelo Tosatti Subject: [patch 3/3] KVM: only clear irq_source_id if irqchip is present References: <20091028204237.663479892@amt.cnet> Content-Disposition: inline; filename=free-irqsource-id X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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); }