Blame SOURCES/kvm-trace-add-qemu_system_powerdown_request-and-qemu_sys.patch

05bba0
From 5e18df4d60ba22586ec4f4d80804ee8d4e41372e Mon Sep 17 00:00:00 2001
05bba0
From: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
Date: Thu, 23 Oct 2014 10:03:09 +0200
05bba0
Subject: [PATCH 01/16] trace: add qemu_system_powerdown_request and
05bba0
 qemu_system_shutdown_request trace events
05bba0
05bba0
Message-id: <1414058589-12881-1-git-send-email-stefanha@redhat.com>
05bba0
Patchwork-id: 61833
05bba0
O-Subject: [RHEL7.2 qemu-kvm PATCH] trace: add qemu_system_powerdown_request and qemu_system_shutdown_request trace events
05bba0
Bugzilla: 1155671
05bba0
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
05bba0
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
05bba0
RH-Acked-by: Amos Kong <akong@redhat.com>
05bba0
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
05bba0
05bba0
From: Yang Zhiyong <yangzy.fnst@cn.fujitsu.com>
05bba0
05bba0
Bugzilla: 1155671
05bba0
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=8153235
05bba0
Upstream: merged
05bba0
05bba0
We have the experience that the guest doesn't stop successfully
05bba0
though it was instructed to shut down.
05bba0
05bba0
The root cause may be not in QEMU mostly.  However, QEMU is often
05bba0
suspected at the beginning just because the issue occurred in
05bba0
virtualization environment.
05bba0
05bba0
Therefore, we need to affirm that QEMU received the shutdown
05bba0
request and raised ACPI irq from "virsh shutdown" command,
05bba0
virt-manger or stopping QEMU process to the VM .
05bba0
So that we can affirm the problems was belonged to the Guset OS
05bba0
rather than the QEMU itself.
05bba0
05bba0
When we stop guests by "virsh shutdown" command or virt-manger,
05bba0
or stopping QEMU process, qemu_system_powerdown_request() or
05bba0
qemu_system_shutdown_request() is called. Then the below functions
05bba0
in main_loop_should_exit() of Vl.c are called roughly in the
05bba0
following order.
05bba0
05bba0
	if (qemu_powerdown_requested())
05bba0
		qemu_system_powerdown()
05bba0
			monitor_protocol_event(QEVENT_POWERDOWN, NULL)
05bba0
05bba0
	OR
05bba0
05bba0
	if(qemu_shutdown_requested()}
05bba0
		monitor_protocol_event(QEVENT_SHUTDOWN, NULL);
05bba0
05bba0
The tracepoint of monitor_protocol_event() already exists, but no
05bba0
tracepoints are defined for qemu_system_powerdown_request() and
05bba0
qemu_system_shutdown_request(). So this patch adds two tracepoints for
05bba0
the two functions. We believe that it will become much easier to
05bba0
isolate the problem mentioned above by these tracepoints.
05bba0
05bba0
Signed-off-by: Yang Zhiyong <yangzy.fnst@cn.fujitsu.com>
05bba0
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
(cherry picked from commit bc78cff9757782501db15d39828e6af4186fe331)
05bba0
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
05bba0
05bba0
Conflicts:
05bba0
	trace-events
05bba0
05bba0
Context conflict, easy to resolve.
05bba0
---
05bba0
 trace-events | 2 ++
05bba0
 vl.c         | 2 ++
05bba0
 2 files changed, 4 insertions(+)
05bba0
---
05bba0
 trace-events | 2 ++
05bba0
 vl.c         | 2 ++
05bba0
 2 files changed, 4 insertions(+)
05bba0
05bba0
diff --git a/trace-events b/trace-events
05bba0
index e7bb7e0..b43132c 100644
05bba0
--- a/trace-events
05bba0
+++ b/trace-events
05bba0
@@ -477,6 +477,8 @@ runstate_set(int new_state) "new state %d"
05bba0
 g_malloc(size_t size, void *ptr) "size %zu ptr %p"
05bba0
 g_realloc(void *ptr, size_t size, void *newptr) "ptr %p size %zu newptr %p"
05bba0
 g_free(void *ptr) "ptr %p"
05bba0
+qemu_system_shutdown_request(void) ""
05bba0
+qemu_system_powerdown_request(void) ""
05bba0
 
05bba0
 # block/qcow2.c
05bba0
 qcow2_writev_start_req(void *co, int64_t sector, int nb_sectors) "co %p sector %" PRIx64 " nb_sectors %d"
05bba0
diff --git a/vl.c b/vl.c
05bba0
index 2932d7c..2b3dc88 100644
05bba0
--- a/vl.c
05bba0
+++ b/vl.c
05bba0
@@ -1894,6 +1894,7 @@ void qemu_system_killed(int signal, pid_t pid)
05bba0
 
05bba0
 void qemu_system_shutdown_request(void)
05bba0
 {
05bba0
+    trace_qemu_system_shutdown_request();
05bba0
     shutdown_requested = 1;
05bba0
     qemu_notify_event();
05bba0
 }
05bba0
@@ -1906,6 +1907,7 @@ static void qemu_system_powerdown(void)
05bba0
 
05bba0
 void qemu_system_powerdown_request(void)
05bba0
 {
05bba0
+    trace_qemu_system_powerdown_request();
05bba0
     powerdown_requested = 1;
05bba0
     qemu_notify_event();
05bba0
 }
05bba0
-- 
05bba0
1.8.3.1
05bba0