[PATCH 06/10] Move irq routing to its own locking.
Signed-off-by: Gleb Natapov g...@redhat.com --- include/linux/kvm_host.h |1 + virt/kvm/irq_comm.c |4 ++-- virt/kvm/kvm_main.c |1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d573652..ce28cb7 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -175,6 +175,7 @@ struct kvm { struct mutex irq_lock; #ifdef CONFIG_HAVE_KVM_IRQCHIP struct kvm_irq_routing_table *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 6b09053..55eb6f6 100644 --- a/virt/kvm/irq_comm.c +++ b/virt/kvm/irq_comm.c @@ -368,10 +368,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(); new = old; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index fcc0c44..2f4a47e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -944,6 +944,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 -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/10] Move irq routing to its own locking.
On 08/09/2009 03:41 PM, Gleb Natapov wrote: Signed-off-by: Gleb Natapovg...@redhat.com --- include/linux/kvm_host.h |1 + virt/kvm/irq_comm.c |4 ++-- virt/kvm/kvm_main.c |1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d573652..ce28cb7 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -175,6 +175,7 @@ struct kvm { struct mutex irq_lock; #ifdef CONFIG_HAVE_KVM_IRQCHIP struct kvm_irq_routing_table *irq_routing; + spinlock_t irq_routing_lock; Why is this needed? The irq routing table adds very little contention since it is rcu locked. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/10] Move irq routing to its own locking.
Signed-off-by: Gleb Natapov g...@redhat.com --- 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 b53a5b8..8ca15a0 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -167,6 +167,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 ceaa478..1d70da3 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 -- 1.6.2.1 -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html