From dcf0d08da352932faba1ae4b5da837eac59c231d Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <23a13cde0d81a8776ab4defcd30f9edef53b045f.1346843178.git.minovotn@redhat.com> References: <23a13cde0d81a8776ab4defcd30f9edef53b045f.1346843178.git.minovotn@redhat.com> From: Luiz Capitulino Date: Wed, 22 Aug 2012 19:05:43 +0200 Subject: [PATCH 4/5] qmp: emit the WAKEUP event when the guest is put to run RH-Author: Luiz Capitulino Message-id: <1345662343-11200-4-git-send-email-lcapitulino@redhat.com> Patchwork-id: 41145 O-Subject: [RHEL6.4 qemu-kvm PATCH 3/3] qmp: emit the WAKEUP event when the guest is put to run Bugzilla: 850927 RH-Acked-by: Gerd Hoffmann RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf From: Luiz Capitulino NOTE: This is a manual backport of upstream commit 17c8660b0b2be17d389e2ffd5681d535cc0d8912. Manually backporting this was easier than resolving conflicts, besides this requires RHEL6-only changes. Today, the WAKEUP event is emitted when a wakeup _request_ is made. This could be the system_wakeup command, for example. A better semantic would be to emit the event when the guest is already running, as that's what matters in the end. This commit does that change. In theory, this could break compatibility. In practice, it shouldn't happen though, as clients shouldn't rely on timing characteristics of the events. That is, a client relying that the guest is not running when the event arrives may break if the event arrives after the guest is already running. This commit also adds the missing documentation for the WAKEUP event. Signed-off-by: Luiz Capitulino --- QMP/qmp-events.txt | 11 +++++++++++ qemu-kvm.c | 1 + vl.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) Signed-off-by: Michal Novotny --- QMP/qmp-events.txt | 11 +++++++++++ qemu-kvm.c | 1 + vl.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt index 75f4708..8e2026e 100644 --- a/QMP/qmp-events.txt +++ b/QMP/qmp-events.txt @@ -278,6 +278,17 @@ Example: "channel-id": 0, "tls": true} }} +WAKEUP +------ + +Emitted when the guest has woken up from S3 and is running. + +Data: None. + +Example: + +{ "event": "WATCHDOG", + "timestamp": { "seconds": 1344522075, "microseconds": 745528 } } WATCHDOG -------- diff --git a/qemu-kvm.c b/qemu-kvm.c index 876d06a..3a84b10 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -2262,6 +2262,7 @@ int kvm_main_loop(void) } } else if (qemu_wakeup_requested()) { qemu_kvm_system_reset(VMRESET_SILENT); + monitor_protocol_event(QEVENT_WAKEUP, NULL); } else if (kvm_debug_cpu_requested) { gdb_set_stop_cpu(kvm_debug_cpu_requested); vm_stop(RUN_STATE_DEBUG); diff --git a/vl.c b/vl.c index 9fbed43..f366eb3 100644 --- a/vl.c +++ b/vl.c @@ -3408,7 +3408,6 @@ void qemu_system_wakeup_request(WakeupReason reason) if (!(wakeup_reason_mask & (1 << reason))) { return; } - monitor_protocol_event(QEVENT_WAKEUP, NULL); notifier_list_notify(&wakeup_notifiers, &reason); wakeup_requested = 1; qemu_notify_event(); @@ -4262,6 +4261,7 @@ static void main_loop(void) pause_all_vcpus(); qemu_system_reset(VMRESET_SILENT); resume_all_vcpus(); + monitor_protocol_event(QEVENT_WAKEUP, NULL); } if (qemu_powerdown_requested()) { monitor_protocol_event(QEVENT_POWERDOWN, NULL); -- 1.7.11.4