提交 b60c48a7 编写于 作者: P Pavel Dovgalyuk 提交者: Paolo Bonzini

replay: shutdown event

This patch records and replays simulator shutdown event.
Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162433.8676.32262.stgit@PASHA-ISP.def.inno>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
上级 8eda206e
...@@ -66,6 +66,11 @@ int64_t replay_read_clock(ReplayClockKind kind); ...@@ -66,6 +66,11 @@ int64_t replay_read_clock(ReplayClockKind kind);
? replay_save_clock((clock), (value)) \ ? replay_save_clock((clock), (value)) \
: (value)) : (value))
/* Events */
/*! Called when qemu shutdown is requested. */
void replay_shutdown_request(void);
/* Asynchronous events queue */ /* Asynchronous events queue */
/*! Disables storing events in the queue */ /*! Disables storing events in the queue */
......
...@@ -23,6 +23,8 @@ enum ReplayEvents { ...@@ -23,6 +23,8 @@ enum ReplayEvents {
EVENT_EXCEPTION, EVENT_EXCEPTION,
/* for async events */ /* for async events */
EVENT_ASYNC, EVENT_ASYNC,
/* for shutdown request */
EVENT_SHUTDOWN,
/* for clock read/writes */ /* for clock read/writes */
/* some of greater codes are reserved for clocks */ /* some of greater codes are reserved for clocks */
EVENT_CLOCK, EVENT_CLOCK,
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "replay-internal.h" #include "replay-internal.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "sysemu/sysemu.h"
ReplayMode replay_mode = REPLAY_MODE_NONE; ReplayMode replay_mode = REPLAY_MODE_NONE;
...@@ -34,6 +35,10 @@ bool replay_next_event_is(int event) ...@@ -34,6 +35,10 @@ bool replay_next_event_is(int event)
res = true; res = true;
} }
switch (replay_data_kind) { switch (replay_data_kind) {
case EVENT_SHUTDOWN:
replay_finish_event();
qemu_system_shutdown_request();
break;
default: default:
/* clock, time_t, checkpoint and other events */ /* clock, time_t, checkpoint and other events */
return res; return res;
...@@ -146,3 +151,12 @@ bool replay_has_interrupt(void) ...@@ -146,3 +151,12 @@ bool replay_has_interrupt(void)
} }
return res; return res;
} }
void replay_shutdown_request(void)
{
if (replay_mode == REPLAY_MODE_RECORD) {
replay_mutex_lock();
replay_put_event(EVENT_SHUTDOWN);
replay_mutex_unlock();
}
}
...@@ -122,6 +122,7 @@ int main(int argc, char **argv) ...@@ -122,6 +122,7 @@ int main(int argc, char **argv)
#include "qapi-event.h" #include "qapi-event.h"
#include "exec/semihost.h" #include "exec/semihost.h"
#include "crypto/init.h" #include "crypto/init.h"
#include "sysemu/replay.h"
#define MAX_VIRTIO_CONSOLES 1 #define MAX_VIRTIO_CONSOLES 1
#define MAX_SCLP_CONSOLES 1 #define MAX_SCLP_CONSOLES 1
...@@ -1803,6 +1804,7 @@ void qemu_system_killed(int signal, pid_t pid) ...@@ -1803,6 +1804,7 @@ void qemu_system_killed(int signal, pid_t pid)
void qemu_system_shutdown_request(void) void qemu_system_shutdown_request(void)
{ {
trace_qemu_system_shutdown_request(); trace_qemu_system_shutdown_request();
replay_shutdown_request();
shutdown_requested = 1; shutdown_requested = 1;
qemu_notify_event(); qemu_notify_event();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册