Skip to contentSkip to conversation

Move irq routing data structure to rcu locking

PATCH In review Gleb Natapov 2 participants 4 messages Jul 9, 2009 – Jul 12, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Move irq routing data structure to rcu locking

Change it from list to array to make RCU handling simpler.

include/linux/kvm_host.h +2 -1
index f54a0d3..12d8d2b 100644
@@ -161,7 +161,8 @@ struct kvm {
 
 	struct mutex irq_lock;
 #ifdef CONFIG_HAVE_KVM_IRQCHIP
-	struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
+	struct kvm_kernel_irq_routing_entry *irq_routing;
+	spinlock_t irq_routing_lock;
 	struct hlist_head mask_notifier_list;
 #endif
 
virt/kvm/irq_comm.c +26 -32

113 lines not on this page · raw message

virt/kvm/kvm_main.c +1 -1
index cf20dc1..8e3fd3f 100644
@@ -945,7 +945,7 @@ static struct kvm *kvm_create_vm(void)
 	if (IS_ERR(kvm))
 		goto out;
 #ifdef CONFIG_HAVE_KVM_IRQCHIP
-	INIT_LIST_HEAD(&kvm->irq_routing);
+	spin_lock_init(&kvm->irq_routing_lock);
 	INIT_HLIST_HEAD(&kvm->mask_notifier_list);
 #endif
 

--
Gleb.

#1 lore raw
Quoted 8 lines · Gleb Natapov

Change it from list to array to make RCU handling simpler.

include/linux/kvm_host.h +0 -0
index f54a0d3..12d8d2b 100644

include/linux/kvm_host.h struct kvm { · line 168

Quoted 9 lines
include/linux/kvm_host.h +2 -1
@@ -161,7 +161,8 @@ struct kvm {
 
  	struct mutex irq_lock;
  #ifdef CONFIG_HAVE_KVM_IRQCHIP
-	struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
+	struct kvm_kernel_irq_routing_entry *irq_routing;
+	spinlock_t irq_routing_lock;
  	struct hlist_head mask_notifier_list;
  #endif
 

Why the new lock?

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 10 lines · Avi Kivity
Quoted 9 lines · Gleb Natapov

Change it from list to array to make RCU handling simpler.

include/linux/kvm_host.h +0 -0
index f54a0d3..12d8d2b 100644
@@ -161,7 +161,8 @@ struct kvm {
 
Quoted 11 lines

include/linux/kvm_host.h struct kvm { · line 168

Quoted 8 lines
include/linux/kvm_host.h +2 -1
  	struct mutex irq_lock;
  #ifdef CONFIG_HAVE_KVM_IRQCHIP
-	struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
+	struct kvm_kernel_irq_routing_entry *irq_routing;
+	spinlock_t irq_routing_lock;
  	struct hlist_head mask_notifier_list;
  #endif
 

Why the new lock?

Currently routing table is protected by irq_lock mutex, but irq_lock is overused. It protects too much of unrelated things and it is not clear what its real purpose in life. I want to rid of it completely.

--
Gleb.

#3 lore raw
Quoted 25 lines · Gleb Natapov
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Gleb Natapov

Change it from list to array to make RCU handling simpler.

include/linux/kvm_host.h +0 -0
index f54a0d3..12d8d2b 100644
@@ -161,7 +161,8 @@ struct kvm {
 
Quoted 12 lines

include/linux/kvm_host.h struct kvm { · line 168

Quoted 9 lines
include/linux/kvm_host.h +2 -1
   	struct mutex irq_lock;
   #ifdef CONFIG_HAVE_KVM_IRQCHIP
-	struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
+	struct kvm_kernel_irq_routing_entry *irq_routing;
+	spinlock_t irq_routing_lock;
   	struct hlist_head mask_notifier_list;
   #endif
 

Why the new lock?

Quoted 4 lines

Currently routing table is protected by irq_lock mutex, but irq_lock is overused. It protects too much of unrelated things and it is not clear what its real purpose in life. I want to rid of it completely.

Separate discussion/patch.

Signature · 1 line
error compiling committee.c: too many arguments to function