Michael S. Tsirkin
maintainerPavel Machek <[email protected]>,
"Rafael J. Wysocki" <[email protected]>,
Len Brown <[email protected]>,
[email protected]
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>
Quoted 4 lines · Amit Shah
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.
...
Quoted 13 lines
--- drivers/virtio/virtio_balloon.c | 79 ++++++++++++++++++++++++++++++++++++++- 1 files changed, 78 insertions(+), 1 deletions(-)drivers/virtio/virtio_balloon.c +0
-1@@ -258,7 +258,13 @@ static int balloon(void *_vballoon)while (!kthread_should_stop ()) {s64 diff; -try_to_freeze ();
drivers/virtio/virtio_balloon.c static int balloon(void *_vballoon) · line 270
Quoted 10 lines
drivers/virtio/virtio_balloon.c +7
-0+/* +* 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.
Signature · 1 line
MST