From: "Michael S. Tsirkin" <mst@redhat.com>
To: amit.shah@redhat.com, quintela@redhat.com, kraxel@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH] qemu-kvm: fix crash on reboot with vhost-net
Date: Mon, 26 Apr 2010 16:37:43 +0300 [thread overview]
Message-ID: <20100426133743.GA16573@redhat.com> (raw)
When vhost-net is disabled on reboot, we set msix mask notifier
to NULL to disable further mask/unmask notifications.
Code currently tries to pass this NULL to notifier,
leading to a crash. The right thing to do is:
- if vector is masked, we don't need to notify backend,
just disable future notifications
- if vector is unmasked, invoke callback to unassign backend,
then disable future notifications
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Note: this patch is for qemu-kvm, the code in question
is not in qemu.git.
hw/msix.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index 3ec8805..43361b5 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -613,9 +613,18 @@ int msix_set_mask_notifier(PCIDevice *dev, unsigned vector, void *opaque)
if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector])
return 0;
- if (dev->msix_mask_notifier)
- r = dev->msix_mask_notifier(dev, vector, opaque,
- msix_is_masked(dev, vector));
+ if (dev->msix_mask_notifier && !msix_is_masked(dev, vector)) {
+ /* Switching notifiers while vector is unmasked:
+ * mask the old one, unmask the new one. */
+ if (dev->msix_mask_notifier_opaque[vector]) {
+ r = dev->msix_mask_notifier(dev, vector,
+ dev->msix_mask_notifier_opaque[vector],
+ 1);
+ }
+ if (r >= 0 && opaque) {
+ r = dev->msix_mask_notifier(dev, vector, opaque, 0);
+ }
+ }
if (r >= 0)
dev->msix_mask_notifier_opaque[vector] = opaque;
return r;
--
1.7.1.rc1.22.g3163
next reply other threads:[~2010-04-26 13:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-26 13:37 Michael S. Tsirkin [this message]
2010-04-27 11:17 ` [PATCH] qemu-kvm: fix crash on reboot with vhost-net Juan Quintela
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=20100426133743.GA16573@redhat.com \
--to=mst@redhat.com \
--cc=amit.shah@redhat.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=quintela@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox