virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Amit Shah <amit.shah@redhat.com>,
	Virtualization List <virtualization@lists.linux-foundation.org>,
	miche@google.com, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [PATCH 2/2] virtio: console: Disable callbacks for virtqueues at start of S4 freeze
Date: Fri,  6 Jan 2012 16:19:08 +0530	[thread overview]
Message-ID: <a2f6a8acbe7f66f36f3fcede19ed72808673ff9c.1325845993.git.amit.shah@redhat.com> (raw)
In-Reply-To: <cover.1325845993.git.amit.shah@redhat.com>
In-Reply-To: <cover.1325845993.git.amit.shah@redhat.com>

To ensure we don't receive any more interrupts from the host after we
enter the freeze function, disable all vq interrupts.

There wasn't any problem seen due to this in tests, but applying this
patch makes the freeze case more robust.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 drivers/char/virtio_console.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index fc54a79..c1c45d8 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1860,10 +1860,18 @@ static int virtcons_freeze(struct virtio_device *vdev)
 
 	vdev->config->reset(vdev);
 
+	virtqueue_disable_cb(portdev->c_ivq);
 	cancel_work_sync(&portdev->control_work);
+	/*
+	 * Once more: if control_work_handler() was running, it would
+	 * enable the cb as the last step.
+	 */
+	virtqueue_disable_cb(portdev->c_ivq);
 	remove_controlq_data(portdev);
 
 	list_for_each_entry(port, &portdev->ports, list) {
+		virtqueue_disable_cb(port->in_vq);
+		virtqueue_disable_cb(port->out_vq);
 		/*
 		 * We'll ask the host later if the new invocation has
 		 * the port opened or closed.
-- 
1.7.7.4

  parent reply	other threads:[~2012-01-06 10:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06 10:49 [PATCH 0/2] virtio: console: control queue race fixes Amit Shah
2012-01-06 10:49 ` [PATCH 1/2] virtio: console: Serialise control work Amit Shah
2012-01-09  2:33   ` Rusty Russell
2012-01-09  3:53     ` Amit Shah
2012-01-06 10:49 ` Amit Shah [this message]
2012-01-09  2:31 ` [PATCH 0/2] virtio: console: control queue race fixes Rusty Russell

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=a2f6a8acbe7f66f36f3fcede19ed72808673ff9c.1325845993.git.amit.shah@redhat.com \
    --to=amit.shah@redhat.com \
    --cc=miche@google.com \
    --cc=mst@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --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;
as well as URLs for NNTP newsgroup(s).