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