From: Fam Zheng <famz@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Rusty Russell <rusty@rustcorp.com.au>,
"Michael S. Tsirkin" <mst@redhat.com>,
virtualization@lists.linux-foundation.org,
Paolo Bonzini <pbonzini@redhat.com>,
Ulrich Obergfell <uobergfe@redhat.com>,
Jason Wang <jasowang@redhat.com>
Subject: [PATCH] virtio-pci: Reset device on shutdown
Date: Sun, 9 Nov 2014 17:39:05 +0800 [thread overview]
Message-ID: <1415525945-7324-1-git-send-email-famz@redhat.com> (raw)
This fixes a hanging issue during guest shutdown.
The device is left enabled even though we removed it and disabled msix
during shutdown. If the virtio device happens to get a new event right
at this point, seeing msix is disabled, it may try to notify us with an
IRQ, which is totally unexpected thus will not be handled. In this
case the guest hangs.
Let's reset the device so that it will not generate any interrupts.
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1128424
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
drivers/virtio/virtio_pci.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index d34ebfa..cd7be6f 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -743,6 +743,14 @@ out:
return err;
}
+static void virtio_pci_shutdown(struct pci_dev *pci_dev)
+{
+ struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
+
+ vp_reset(&vp_dev->vdev);
+}
+
+
static void virtio_pci_remove(struct pci_dev *pci_dev)
{
struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
@@ -794,6 +802,7 @@ static struct pci_driver virtio_pci_driver = {
.id_table = virtio_pci_id_table,
.probe = virtio_pci_probe,
.remove = virtio_pci_remove,
+ .shutdown = virtio_pci_shutdown,
#ifdef CONFIG_PM_SLEEP
.driver.pm = &virtio_pci_pm_ops,
#endif
--
1.9.3
next reply other threads:[~2014-11-09 9:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-09 9:39 Fam Zheng [this message]
2014-11-09 11:52 ` Michael S. Tsirkin
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=1415525945-7324-1-git-send-email-famz@redhat.com \
--to=famz@redhat.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=uobergfe@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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
all inboxes | Powered by JetHome®