From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: linux-kernel@vger.kernel.org, levinsasha928@gmail.com,
Virtualization List <virtualization@lists.linux-foundation.org>
Subject: (unknown)
Date: Wed, 7 Dec 2011 12:25:08 +0200 [thread overview]
Message-ID: <20111207102507.GB8326@redhat.com> (raw)
Pavel Machek <pavel@ucw.cz>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Len Brown <len.brown@intel.com>,
linux-pm@vger.kernel.org
Bcc:
Subject: Re: [PATCH v4 12/12] virtio: balloon: Add freeze, restore handlers
to support S4
Reply-To:
In-Reply-To: <5deccc36afa59032f0e3b10a653773bad511f303.1323199985.git.amit.shah@redhat.com>
On Wed, Dec 07, 2011 at 01:18:50AM +0530, Amit Shah wrote:
> Now to not race with a host issuing ballooning requests while we are in
> the process of freezing, we just exit from the vballoon kthread when the
> processes are asked to freeze. Upon thaw and restore, we re-start the
> thread.
...
> ---
> drivers/virtio/virtio_balloon.c | 79 ++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 78 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 8bf99be..10ec638 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -258,7 +258,13 @@ static int balloon(void *_vballoon)
> while (!kthread_should_stop()) {
> s64 diff;
>
> - try_to_freeze();
> + /*
> + * On suspend, we want to exit this thread. We will
> + * start a new thread on resume.
> + */
> + if (freezing(current))
> + break;
> +
> wait_event_interruptible(vb->config_change,
> (diff = towards_target(vb)) != 0
> || vb->need_stats_update
...
Note: this relies on kthreads being frozen before devices.
Looking at kernel/power/hibernate.c this is the case,
but I think we should add a comment to note this.
Also Cc linux-pm crowd in case I got it wrong.
--
MST
next reply other threads:[~2011-12-07 10:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 10:25 Michael S. Tsirkin [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-03-07 7:48 (unknown), Solen win
2018-02-17 8:41 (unknown), Solen win
2018-02-13 11:58 (unknown), Solen win
[not found] <CALfDnQ8aCTywvhqOBkFv3qQOoME9wvTrKbQq8i8PCPOx2iBp=A@mail.gmail.com>
[not found] ` <CALfDnQ-NihbhS=8C+ZfiKepj5x+Zd5uS2zH82-VrwV40A55s0w@mail.gmail.com>
2018-02-07 10:50 ` (unknown), Solen win
2017-12-24 9:07 (unknown), Solen win
2017-12-17 17:28 (unknown), Solen win
2017-12-14 16:26 (unknown), Solen win
2017-12-12 16:06 (unknown), Solen win
2017-11-05 3:40 (unknown), Solen win
2017-10-29 9:46 (unknown), Solen win
2017-10-15 12:17 (unknown), Solen win2
2017-10-02 18:00 (unknown), Solen win2
2017-08-20 2:58 (unknown), Solen win2
2017-07-26 10:32 (unknown), Solen win2
2016-07-04 12:04 (unknown), basavaraj Khodanpur
2014-09-02 20:13 (unknown), Andy King
2013-01-06 6:36 [PATCH] tcm_vhost: Use llist for cmd completion list Asias He
2013-01-08 6:52 ` (unknown) Michael S. Tsirkin
2011-07-27 8:39 (unknown), Grant McWilliams
2007-04-10 16:48 (unknown) H. Peter Anvin
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=20111207102507.GB8326@redhat.com \
--to=mst@redhat.com \
--cc=amit.shah@redhat.com \
--cc=levinsasha928@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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).