virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Matthew Garrett <mjg@redhat.com>,
	Anthony Liguori <anthony@codemonkey.ws>,
	Virtualization List <virtualization@lists.linux-foundation.org>
Subject: Re: [RFC PATCH] virtio: (Partially) enable suspend/resume support
Date: Mon, 22 Nov 2010 16:54:54 +0200	[thread overview]
Message-ID: <20101122145454.GB30157@redhat.com> (raw)
In-Reply-To: <20101122134537.GB6979@amit-x200.redhat.com>

On Mon, Nov 22, 2010 at 07:15:37PM +0530, Amit Shah wrote:
> (Adding Matthew Garrett and Vadim Rosenfeld)
> 
> On (Fri) Nov 05 2010 [12:15:36], Michael S. Tsirkin wrote:
> > I still don't see it.  why don't we reset on resume?
> > If there's a reset host must either discard or
> > flush out operations in progress.
> 
> OK, let me list how virtio-serial works, then let's see how Windows and
> Linux differ in their suspend/resume implementations and then discuss
> solutions.
> 
> virtio-serial, in its probe routine, exchanges some information over a
> control vq and per-port vqs -- the number of ports, the number of open
> ports, the names assigned to the ports, etc.
> 
> When Linux starts up, it goes about doing the regular init, calling the
> probe routine.  Later, when it detects there is a suspended image
> available, it restores that image.
> 
> After the image is restored, the vring counts in qemu reflect the
> transfer that's taken place in the probe routine, whereas the vring
> counts in the guest kernel reflect the pre-suspend values.
> 
> The Linux kernel's suspend/resume notifiers currently offer the
> following notifications:
> - Preparing to go to suspended state (tasks will be frozen now)
> - Preparing to restore the image saved at hibernate-time
> - Restore succeeded (called after user-space threads are thawed)
> 
> 
> What the Windows driver does is destroy all the virtqueues before
> suspend and re-init all of them on restore.  This works well, but in the
> Linux case, we don't have a notifier that gets called after restore
> succeeds and before user-space tasks are thawed,

Let's add one?

> which means for an open
> virtio-serial port, a userspace app doing non-stop writes may find the
> communication channel broken because the underlying vq vanished.
> 
> Windows has one problem with the balloon driver too -- inflate a
> balloon, hibernate.  Start the machine, restore image.  Windows thinks
> balloon is inflated.  qemu thinks it's deflated.  This can be solved by
> Windows providing a balloon size update to qemu but will most perhaps
> need a change to qemu.
> 
> For network ports, I guess it'll be the same situation - getting the
> network up before userspace notices.
> 
> 		Amit

  reply	other threads:[~2010-11-22 14:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-29 12:12 [RFC PATCH] virtio: (Partially) enable suspend/resume support Amit Shah
2010-10-03 15:53 ` Michael S. Tsirkin
2010-10-05 13:45   ` Amit Shah
2010-10-05 15:23     ` Michael S. Tsirkin
2010-10-06 11:54       ` Amit Shah
2010-11-05 10:15         ` Michael S. Tsirkin
2010-11-22 13:45           ` Amit Shah
2010-11-22 14:54             ` Michael S. Tsirkin [this message]
2010-11-22 15:01               ` Matthew Garrett
2010-11-23  3:18               ` Amit Shah

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=20101122145454.GB30157@redhat.com \
    --to=mst@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=mjg@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;
as well as URLs for NNTP newsgroup(s).