* [PATCH] kvm: fix ack not being delivered when msi present
@ 2009-07-26 14:10 Michael S. Tsirkin
2009-07-26 14:17 ` Gleb Natapov
2009-08-05 11:08 ` Avi Kivity
0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2009-07-26 14:10 UTC (permalink / raw)
To: avi, gleb, kvm
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.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
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(-)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index f244f11..f814512 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -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 {
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 100c267..001663f 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -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;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm: fix ack not being delivered when msi present
2009-07-26 14:10 [PATCH] kvm: fix ack not being delivered when msi present Michael S. Tsirkin
@ 2009-07-26 14:17 ` Gleb Natapov
2009-08-05 11:08 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Gleb Natapov @ 2009-07-26 14:17 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: avi, kvm
On Sun, Jul 26, 2009 at 05:10:01PM +0300, Michael S. Tsirkin wrote:
> 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.
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
> ---
>
> 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(-)
>
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index f244f11..f814512 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -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 {
> diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
> index 100c267..001663f 100644
> --- a/virt/kvm/irq_comm.c
> +++ b/virt/kvm/irq_comm.c
> @@ -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;
> --
> 1.6.2.5
--
Gleb.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm: fix ack not being delivered when msi present
2009-07-26 14:10 [PATCH] kvm: fix ack not being delivered when msi present Michael S. Tsirkin
2009-07-26 14:17 ` Gleb Natapov
@ 2009-08-05 11:08 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2009-08-05 11:08 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: gleb, kvm
On 07/26/2009 05:10 PM, Michael S. Tsirkin wrote:
> 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.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-05 11:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-26 14:10 [PATCH] kvm: fix ack not being delivered when msi present Michael S. Tsirkin
2009-07-26 14:17 ` Gleb Natapov
2009-08-05 11:08 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).