From patchwork Sun Aug 9 12:41:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 40249 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 n79CfSYJ000979 for ; Sun, 9 Aug 2009 12:41:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753667AbZHIMlW (ORCPT ); Sun, 9 Aug 2009 08:41:22 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753631AbZHIMlS (ORCPT ); Sun, 9 Aug 2009 08:41:18 -0400 Received: from mx2.redhat.com ([66.187.237.31]:45496 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753545AbZHIMlO (ORCPT ); Sun, 9 Aug 2009 08:41:14 -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 n79CfFhY026486 for ; Sun, 9 Aug 2009 08:41:15 -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 n79CfEau019685; Sun, 9 Aug 2009 08:41:14 -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 n79CfDHO027132; Sun, 9 Aug 2009 08:41:13 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id D0A5D18D46E; Sun, 9 Aug 2009 15:41:11 +0300 (IDT) From: Gleb Natapov To: avi@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH 07/10] Move irq notifiers lists to its own locking. Date: Sun, 9 Aug 2009 15:41:08 +0300 Message-Id: <1249821671-32356-8-git-send-email-gleb@redhat.com> In-Reply-To: <1249821671-32356-1-git-send-email-gleb@redhat.com> References: <1249821671-32356-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 | 16 ++++++++-------- virt/kvm/kvm_main.c | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index ce28cb7..8791ce8 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -178,6 +178,7 @@ struct kvm { spinlock_t irq_routing_lock; struct hlist_head mask_notifier_list; struct hlist_head irq_ack_notifier_list; + spinlock_t irq_notifier_list_lock; #endif #ifdef KVM_ARCH_WANT_MMU_NOTIFIER diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c index 55eb6f6..65f66f1 100644 --- a/virt/kvm/irq_comm.c +++ b/virt/kvm/irq_comm.c @@ -188,17 +188,17 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin) void kvm_register_irq_ack_notifier(struct kvm *kvm, struct kvm_irq_ack_notifier *kian) { - mutex_lock(&kvm->irq_lock); + spin_lock(&kvm->irq_notifier_list_lock); hlist_add_head_rcu(&kian->link, &kvm->irq_ack_notifier_list); - mutex_unlock(&kvm->irq_lock); + spin_unlock(&kvm->irq_notifier_list_lock); } void kvm_unregister_irq_ack_notifier(struct kvm *kvm, struct kvm_irq_ack_notifier *kian) { - mutex_lock(&kvm->irq_lock); + spin_lock(&kvm->irq_notifier_list_lock); hlist_del_init_rcu(&kian->link); - mutex_unlock(&kvm->irq_lock); + spin_unlock(&kvm->irq_notifier_list_lock); synchronize_rcu(); } @@ -244,18 +244,18 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id) void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq, struct kvm_irq_mask_notifier *kimn) { - mutex_lock(&kvm->irq_lock); + spin_lock(&kvm->irq_notifier_list_lock); kimn->irq = irq; hlist_add_head_rcu(&kimn->link, &kvm->mask_notifier_list); - mutex_unlock(&kvm->irq_lock); + spin_unlock(&kvm->irq_notifier_list_lock); } void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, struct kvm_irq_mask_notifier *kimn) { - mutex_lock(&kvm->irq_lock); + spin_lock(&kvm->irq_notifier_list_lock); hlist_del_rcu(&kimn->link); - mutex_unlock(&kvm->irq_lock); + spin_unlock(&kvm->irq_notifier_list_lock); synchronize_rcu(); } diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 2f4a47e..c108edc 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -947,6 +947,7 @@ static struct kvm *kvm_create_vm(void) spin_lock_init(&kvm->irq_routing_lock); INIT_HLIST_HEAD(&kvm->mask_notifier_list); INIT_HLIST_HEAD(&kvm->irq_ack_notifier_list); + spin_lock_init(&kvm->irq_notifier_list_lock); #endif #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET