From: Eric B Munson Date: Sat, 7 Apr 2012 00:47:47 +0000 (+0530) Subject: kvmclock: guest stop notification X-Git-Tag: v1.1-rc0~116^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f349c12c0434e29c79ecde89029320c4002f7253;p=thirdparty%2Fqemu.git kvmclock: guest stop notification 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. This patch uses the qemu Notifier system to tell the guest it is about to be stopped. Signed-off-by: Eric B Munson Signed-off-by: Raghavendra K T Reviewed-by: Andreas Färber Signed-off-by: Marcelo Tosatti --- diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c index 446bd621767..824b9783972 100644 --- a/hw/kvm/clock.c +++ b/hw/kvm/clock.c @@ -65,9 +65,25 @@ static void kvmclock_vm_state_change(void *opaque, int running, RunState state) { KVMClockState *s = opaque; + CPUArchState *penv = first_cpu; + int cap_clock_ctrl = kvm_check_extension(kvm_state, KVM_CAP_KVMCLOCK_CTRL); + int ret; if (running) { s->clock_valid = false; + + 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; + } + } } }