Skip to contentSkip to conversation

kvm: fix ack not being delivered when msi present

PATCH Applied Michael S. Tsirkin 3 participants 3 messages Jul 26, 2009 – Aug 5, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: fix ack not being delivered when msi present

kvm_notify_acked_irq does not check irq type, so that it sometimes interprets msi vector as irq. As a result, ack notifiers are not called, which typially hangs the guest. The fix is to track and check irq type.

---

Avi, since this bug was introduced in 2.6.30 already, I think we need the fix in 2.6.30.x as well as 2.6.31.

 include/linux/kvm_host.h |    1 +
 virt/kvm/irq_comm.c      |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)
include/linux/kvm_host.h +1 -0
index f244f11..f814512 100644
@@ -119,6 +119,7 @@ struct kvm_memory_slot {
 
 struct kvm_kernel_irq_routing_entry {
 	u32 gsi;
+	u32 type;
 	int (*set)(struct kvm_kernel_irq_routing_entry *e,
 		    struct kvm *kvm, int level);
 	union {
virt/kvm/irq_comm.c +3 -1
index 100c267..001663f 100644
@@ -171,7 +171,8 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
 	trace_kvm_ack_irq(irqchip, pin);
 
 	list_for_each_entry(e, &kvm->irq_routing, link)
-		if (e->irqchip.irqchip == irqchip &&
+		if (e->type == KVM_IRQ_ROUTING_IRQCHIP &&
+		    e->irqchip.irqchip == irqchip &&
 		    e->irqchip.pin == pin) {
 			gsi = e->gsi;
 			break;
@@ -288,6 +289,7 @@ static int setup_routing_entry(struct kvm_kernel_irq_routing_entry *e,
 	int delta;
 
 	e->gsi = ue->gsi;
+	e->type = ue->type;
 	switch (ue->type) {
 	case KVM_IRQ_ROUTING_IRQCHIP:
 		delta = 0;
Signature · 1 line
1.6.2.5
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Michael S. Tsirkin

kvm_notify_acked_irq does not check irq type, so that it sometimes interprets msi vector as irq. As a result, ack notifiers are not called, which typially hangs the guest. The fix is to track and check irq type.

Looks good to me.

Quoted 1 line
Quoted 45 lines

---

Avi, since this bug was introduced in 2.6.30 already, I think we need the fix in 2.6.30.x as well as 2.6.31.

 include/linux/kvm_host.h |    1 +
 virt/kvm/irq_comm.c      |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)
include/linux/kvm_host.h +1 -0
index f244f11..f814512 100644
@@ -119,6 +119,7 @@ struct kvm_memory_slot {
 
 struct kvm_kernel_irq_routing_entry {
 	u32 gsi;
+	u32 type;
 	int (*set)(struct kvm_kernel_irq_routing_entry *e,
 		    struct kvm *kvm, int level);
 	union {
virt/kvm/irq_comm.c +3 -1
index 100c267..001663f 100644
@@ -171,7 +171,8 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
 	trace_kvm_ack_irq(irqchip, pin);
 
 	list_for_each_entry(e, &kvm->irq_routing, link)
-		if (e->irqchip.irqchip == irqchip &&
+		if (e->type == KVM_IRQ_ROUTING_IRQCHIP &&
+		    e->irqchip.irqchip == irqchip &&
 		    e->irqchip.pin == pin) {
 			gsi = e->gsi;
 			break;
@@ -288,6 +289,7 @@ static int setup_routing_entry(struct kvm_kernel_irq_routing_entry *e,
 	int delta;
 
 	e->gsi = ue->gsi;
+	e->type = ue->type;
 	switch (ue->type) {
 	case KVM_IRQ_ROUTING_IRQCHIP:
 		delta = 0;
Signature · 1 line
1.6.2.5

--
Gleb.

Applied
#2 lore raw
In reply to Michael S. Tsirkin
Quoted 5 lines · Michael S. Tsirkin

kvm_notify_acked_irq does not check irq type, so that it sometimes interprets msi vector as irq. As a result, ack notifiers are not called, which typially hangs the guest. The fix is to track and check irq type.

Applied, thanks.

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