From: Mark McLoughlin <markmc@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 1/1] KVM: IRQ ACK notifier should be used with in-kernel irqchip
Date: Fri, 28 Nov 2008 10:25:51 +0000 [thread overview]
Message-ID: <1227867951.3643.24.camel@blaa> (raw)
In-Reply-To: <1224490030-7984-1-git-send-email-sheng@linux.intel.com>
Hi,
I just got an oops (with 2.6.28-rc6) when running "qemu-kvm -S
-pcidevice ..." and immediately quitting rather than starting the guest.
The issue is that at this point ASSIGN_PCI_DEVICE has been called, but
not ASSIGN_IRQ, so kvm_unregister_irq_ack_notifier() oops when we try
and remove a notifier which hasn't already been added.
The fix is simple - use hlist_del_init() rather than hlist_del() - but I
also came across this patch in Avi's tree ...
On Mon, 2008-10-20 at 16:07 +0800, Sheng Yang wrote:
...
> diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
> index 55ad76e..9fbbdea 100644
> --- a/virt/kvm/irq_comm.c
> +++ b/virt/kvm/irq_comm.c
> @@ -58,12 +58,16 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi)
> void kvm_register_irq_ack_notifier(struct kvm *kvm,
> struct kvm_irq_ack_notifier *kian)
> {
> + /* Must be called with in-kernel IRQ chip, otherwise it's nonsense */
> + ASSERT(irqchip_in_kernel(kvm));
This is a seriously ugly assertion - there is no reason for the IRQ ACK
notifier abstraction to know anything about when it is called, and it's
easy to verify that kvm_register_irq_ack_notifier() is only called with
the in-kernel irqchip ... it's only called in one place:
if (irqchip_in_kernel(kvm)) {
/* Register ack nofitier */
match->ack_notifier.gsi = -1;
match->ack_notifier.irq_acked =
kvm_assigned_dev_ack_irq;
kvm_register_irq_ack_notifier(kvm,
&match->ack_notifier);
> + ASSERT(kian);
This is bogus; the ack notifier structure is embedded in assigned device
structure, so we can never pass NULL here - it's not like it's a
dynamically allocated structure.
> hlist_add_head(&kian->link, &kvm->arch.irq_ack_notifier_list);
> }
>
> -void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
> - struct kvm_irq_ack_notifier *kian)
> +void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian)
> {
> + if (!kian)
> + return;
> hlist_del(&kian->link);
This is where I think you were trying to fix the issue I saw ... but
again, it's bogus. We will never pass a NULL ack notifier struct, but we
may well pass one which hasn't been previously registered.
I'm going to follow up with a number of patches to clean some of this
up.
Cheers,
Mark.
next prev parent reply other threads:[~2008-11-28 10:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-20 8:07 [PATCH 1/1] KVM: IRQ ACK notifier should be used with in-kernel irqchip Sheng Yang
2008-10-22 10:26 ` Avi Kivity
2008-11-28 10:25 ` Mark McLoughlin [this message]
2008-11-28 10:26 ` [PATCH 1/4] KVM: remove the IRQ ACK notifier assertions Mark McLoughlin
2008-11-28 10:26 ` [PATCH 2/4] KVM: make kvm_unregister_irq_ack_notifier() safe Mark McLoughlin
2008-11-28 10:26 ` [PATCH 3/4] KVM: gracefully handle zero in kvm_free_irq_source_id() Mark McLoughlin
2008-11-28 10:26 ` [PATCH 4/4] KVM: split out kvm_free_assigned_irq() Mark McLoughlin
2008-11-30 10:28 ` [PATCH 3/4] KVM: gracefully handle zero in kvm_free_irq_source_id() Avi Kivity
2008-12-01 13:56 ` Mark McLoughlin
2008-12-01 13:57 ` [PATCH 1/5] KVM: remove the IRQ ACK notifier assertions Mark McLoughlin
2008-12-01 13:57 ` [PATCH 2/5] KVM: make kvm_unregister_irq_ack_notifier() safe Mark McLoughlin
2008-12-01 13:57 ` [PATCH 3/5] KVM: don't fee an unallocated irq source id Mark McLoughlin
2008-12-01 13:57 ` [PATCH 4/5] KVM: add KVM_USERSPACE_IRQ_SOURCE_ID assertions Mark McLoughlin
2008-12-01 13:57 ` [PATCH 5/5] KVM: split out kvm_free_assigned_irq() Mark McLoughlin
2008-12-02 12:41 ` [PATCH 4/5] KVM: add KVM_USERSPACE_IRQ_SOURCE_ID assertions Avi Kivity
2008-12-02 12:39 ` [PATCH 1/5] KVM: remove the IRQ ACK notifier assertions Avi Kivity
2008-12-01 2:31 ` [PATCH 1/1] KVM: IRQ ACK notifier should be used with in-kernel irqchip Sheng Yang
-- strict thread matches above, loose matches on Subject: below --
2008-10-09 8:16 Sheng Yang
2008-10-09 8:34 ` Avi Kivity
2008-10-09 8:43 ` Sheng Yang
2008-10-19 9:16 ` Avi Kivity
2008-10-08 9:04 [PATCH] KVM: Unregister IRQ ACK notifier " Sheng Yang
2008-10-08 9:28 ` [PATCH 1/1] KVM: IRQ ACK notifier should be used " Sheng Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1227867951.3643.24.camel@blaa \
--to=markmc@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=sheng@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.