@@ -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
@@ -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;
@@ -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
Signed-off-by: Gleb Natapov <gleb@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(-)