qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] kvmclock: fix guest stop notification
@ 2012-09-20  8:25 Amit Shah
  2012-09-20 12:46 ` Marcelo Tosatti
  2012-09-20 12:47 ` Marcelo Tosatti
  0 siblings, 2 replies; 8+ messages in thread
From: Amit Shah @ 2012-09-20  8:25 UTC (permalink / raw)
  To: qemu list, kvm list
  Cc: Raghavendra K T, Marcelo Tosatti, Eric B Munson, Amit Shah,
	Paolo Bonzini, Laszlo Ersek, Andreas Färber

Commit f349c12c0434e29c79ecde89029320c4002f7253 added the guest stop
notification, but it did it in a way that the stop notification would
never reach the kernel.  The kvm_vm_state_changed() function gets a
value of 0 for the 'running' parameter when the VM is stopped, making
all the code added previously dead code.

This patch reworks the code so that it's called when 'running' is 0,
which indicates the VM was stopped.

CC: Eric B Munson <emunson@mgebm.net>
CC: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
CC: Andreas Färber <afaerber@suse.de>
CC: Marcelo Tosatti <mtosatti@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/kvm/clock.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c
index 824b978..f3427eb 100644
--- a/hw/kvm/clock.c
+++ b/hw/kvm/clock.c
@@ -71,18 +71,19 @@ static void kvmclock_vm_state_change(void *opaque, int running,
 
     if (running) {
         s->clock_valid = false;
+        return;
+    }
 
-        if (!cap_clock_ctrl) {
-            return;
-        }
-        for (penv = first_cpu; penv != NULL; penv = penv->next_cpu) {
-            ret = kvm_vcpu_ioctl(penv, KVM_KVMCLOCK_CTRL, 0);
-            if (ret) {
-                if (ret != -EINVAL) {
-                    fprintf(stderr, "%s: %s\n", __func__, strerror(-ret));
-                }
-                return;
+    if (!cap_clock_ctrl) {
+        return;
+    }
+    for (penv = first_cpu; penv != NULL; penv = penv->next_cpu) {
+        ret = kvm_vcpu_ioctl(penv, KVM_KVMCLOCK_CTRL, 0);
+        if (ret) {
+            if (ret != -EINVAL) {
+                fprintf(stderr, "%s: %s\n", __func__, strerror(-ret));
             }
+            return;
         }
     }
 }
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-10-08 10:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-20  8:25 [Qemu-devel] [PATCH 1/1] kvmclock: fix guest stop notification Amit Shah
2012-09-20 12:46 ` Marcelo Tosatti
2012-09-30 23:05   ` Marcelo Tosatti
2012-10-01  1:50     ` Amos Kong
2012-10-03 13:28       ` Marcelo Tosatti
2012-10-08 10:43       ` Amit Shah
2012-10-08 10:40     ` Amit Shah
2012-09-20 12:47 ` Marcelo Tosatti

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).