From patchwork Mon Jul 13 09:12:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 35345 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 n6D9CgC1020814 for ; Mon, 13 Jul 2009 09:12:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754767AbZGMJMk (ORCPT ); Mon, 13 Jul 2009 05:12:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754715AbZGMJMk (ORCPT ); Mon, 13 Jul 2009 05:12:40 -0400 Received: from mx2.redhat.com ([66.187.237.31]:35130 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753246AbZGMJMj (ORCPT ); Mon, 13 Jul 2009 05:12:39 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6D9Cd2C031633 for ; Mon, 13 Jul 2009 05:12:39 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6D9Cc2s022386; Mon, 13 Jul 2009 05:12:38 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6D9CaTb022202; Mon, 13 Jul 2009 05:12:37 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id D970718D47B; Mon, 13 Jul 2009 12:12:35 +0300 (IDT) From: Gleb Natapov To: kvm@vger.kernel.org Cc: avi@redhat.com, mtosatti@redhat.com Subject: [PATCH 2/5] Move irq routing to its own locking. Date: Mon, 13 Jul 2009 12:12:32 +0300 Message-Id: <1247476355-27284-3-git-send-email-gleb@redhat.com> In-Reply-To: <1247476355-27284-1-git-send-email-gleb@redhat.com> References: <1247476355-27284-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Gleb Natapov --- include/linux/kvm_host.h | 1 + virt/kvm/irq_comm.c | 5 ++--- virt/kvm/kvm_main.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index f795f25..3f2a4fc 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -162,6 +162,7 @@ struct kvm { struct mutex irq_lock; #ifdef CONFIG_HAVE_KVM_IRQCHIP struct kvm_kernel_irq_routing_entry *irq_routing; + spinlock_t irq_routing_lock; struct hlist_head mask_notifier_list; struct hlist_head irq_ack_notifier_list; #endif diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c index ce8fcd3..3dbba41 100644 --- a/virt/kvm/irq_comm.c +++ b/virt/kvm/irq_comm.c @@ -350,11 +350,10 @@ int kvm_set_irq_routing(struct kvm *kvm, ++ue; } - mutex_lock(&kvm->irq_lock); + spin_lock(&kvm->irq_routing_lock); old = kvm->irq_routing; rcu_assign_pointer(kvm->irq_routing, new); - mutex_unlock(&kvm->irq_lock); - + spin_unlock(&kvm->irq_routing_lock); synchronize_rcu(); r = 0; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 53d9b70..4e31634 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -945,6 +945,7 @@ static struct kvm *kvm_create_vm(void) if (IS_ERR(kvm)) goto out; #ifdef CONFIG_HAVE_KVM_IRQCHIP + spin_lock_init(&kvm->irq_routing_lock); INIT_HLIST_HEAD(&kvm->mask_notifier_list); INIT_HLIST_HEAD(&kvm->irq_ack_notifier_list); #endif