qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V3] Guest stop notification
@ 2011-12-02 19:19 Eric B Munson
  2011-12-02 20:20 ` Jan Kiszka
  0 siblings, 1 reply; 11+ messages in thread
From: Eric B Munson @ 2011-12-02 19:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: ryanh, aliguori, kvm, Jan Kiszka, Marcelo Tosatti, Eric B Munson,
	Avi Kivity

Often when a guest is stopped from the qemu console, it will report spurious
soft lockup warnings on resume.  There are kernel patches being discussed that
will give the host the ability to tell the guest that it is being stopped and
should ignore the soft lockup warning that generates.

Signed-off-by: Eric B Munson <emunson@mgebm.net>
Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: ryanh@linux.vnet.ibm.com
Cc: aliguori@us.ibm.com
Cc: kvm@vger.kernel.org

---
Changes from V2:
 Move ioctl into hw/kvmclock.c so as other arches can use it as it is
implemented

Changes from V1:
 Remove unnecessary encapsulating function

 hw/kvmclock.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/hw/kvmclock.c b/hw/kvmclock.c
index 5388bc4..756839f 100644
--- a/hw/kvmclock.c
+++ b/hw/kvmclock.c
@@ -16,6 +16,7 @@
 #include "sysbus.h"
 #include "kvm.h"
 #include "kvmclock.h"
+#include "cpu-all.h"
 
 #include <linux/kvm.h>
 #include <linux/kvm_para.h>
@@ -69,11 +70,34 @@ static void kvmclock_vm_state_change(void *opaque, int running,
     }
 }
 
+static void kvmclock_vm_state_change_vcpu(void *opaque, int running,
+                                          RunState state)
+{
+    int ret;
+    CPUState *penv = first_cpu;
+
+    if (running) {
+	while (penv) {
+            ret = kvm_vcpu_ioctl(penv, KVM_GUEST_PAUSED, 0);
+            if (ret) {
+                if (ret != ENOSYS) {
+                    fprintf(stderr,
+                            "kvmclock_vm_state_change_vcpu: %s\n",
+                            strerror(-ret));
+                }
+                return;
+            }
+            penv = (CPUState *)penv->next_cpu;
+        }
+    }
+}
+
 static int kvmclock_init(SysBusDevice *dev)
 {
     KVMClockState *s = FROM_SYSBUS(KVMClockState, dev);
 
     qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
+    qemu_add_vm_change_state_handler(kvmclock_vm_state_change_vcpu, NULL);
     return 0;
 }
 
-- 
1.7.5.4

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

end of thread, other threads:[~2011-12-05 13:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-02 19:19 [Qemu-devel] [PATCH V3] Guest stop notification Eric B Munson
2011-12-02 20:20 ` Jan Kiszka
2011-12-02 21:27   ` Eric B Munson
2011-12-03  9:06     ` Jan Kiszka
2011-12-03 11:19       ` Marcelo Tosatti
2011-12-03 11:25         ` Jan Kiszka
2011-12-03 11:42           ` Marcelo Tosatti
2011-12-03 11:45             ` Jan Kiszka
2011-12-05 13:35               ` Marcelo Tosatti
2011-12-05 13:46                 ` Jan Kiszka
2011-12-05 12:58       ` Eric B Munson

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