From patchwork Thu Oct 29 15:44:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 56482 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 n9TFmIHv015784 for ; Thu, 29 Oct 2009 15:48:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755430AbZJ2PsK (ORCPT ); Thu, 29 Oct 2009 11:48:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755399AbZJ2PsJ (ORCPT ); Thu, 29 Oct 2009 11:48:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65060 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755381AbZJ2PsF (ORCPT ); Thu, 29 Oct 2009 11:48:05 -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 n9TFmBAm008710 for ; Thu, 29 Oct 2009 11:48:11 -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 n9TFmATb011630; Thu, 29 Oct 2009 11:48:10 -0400 Received: from amt.cnet (vpn-10-38.str.redhat.com [10.32.10.38]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n9TFm8cn003284; Thu, 29 Oct 2009 11:48:09 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id AA29767419C; Thu, 29 Oct 2009 13:46:49 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n9TFkmTQ008794; Thu, 29 Oct 2009 13:46:48 -0200 Message-Id: <20091029154554.054437735@amt.cnet> User-Agent: quilt/0.47-1 Date: Thu, 29 Oct 2009 13:44:17 -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: <20091029154414.686484229@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); }