From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7jkT-0000WK-2B for qemu-devel@nongnu.org; Thu, 17 Jul 2014 07:21:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7jkM-0002NW-B0 for qemu-devel@nongnu.org; Thu, 17 Jul 2014 07:21:16 -0400 Received: from mail.ispras.ru ([83.149.199.45]:47544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7jUY-00059x-7Z for qemu-devel@nongnu.org; Thu, 17 Jul 2014 07:04:50 -0400 From: Pavel Dovgalyuk Date: Thu, 17 Jul 2014 15:04:53 +0400 Message-ID: <20140717110452.8352.79528.stgit@PASHA-ISP> In-Reply-To: <20140717110153.8352.80175.stgit@PASHA-ISP> References: <20140717110153.8352.80175.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v2 31/49] replay: shutdown event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, fred.konrad@greensocs.com This patch records and replays simulator shutdown event. Signed-off-by: Pavel Dovgalyuk --- include/sysemu/sysemu.h | 1 + replay/replay-internal.h | 13 ++++++------- replay/replay.c | 11 +++++++++++ replay/replay.h | 5 +++++ vl.c | 8 +++++++- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 1ebfef9..9000feb 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -57,6 +57,7 @@ void qemu_register_suspend_notifier(Notifier *notifier); void qemu_system_wakeup_request(WakeupReason reason); void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); void qemu_register_wakeup_notifier(Notifier *notifier); +void qemu_system_shutdown_request_impl(void); void qemu_system_shutdown_request(void); void qemu_system_powerdown_request(void); void qemu_register_powerdown_notifier(Notifier *notifier); diff --git a/replay/replay-internal.h b/replay/replay-internal.h index 79e23ee..033dbdc 100755 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -15,17 +15,16 @@ #include #include "sysemu/sysemu.h" -<<<<<<< current -/* for software interrupt */ -#define EVENT_INTERRUPT 15 -/* for emulated exceptions */ -#define EVENT_EXCEPTION 23 -======= /* for time_t event */ #define EVENT_TIME_T 1 /* for tm event */ #define EVENT_TM 2 ->>>>>>> patched +/* for software interrupt */ +#define EVENT_INTERRUPT 15 +/* for shutdown request */ +#define EVENT_SHUTDOWN 20 +/* for emulated exceptions */ +#define EVENT_EXCEPTION 23 /* for async events */ #define EVENT_ASYNC 24 #define EVENT_ASYNC_OPT 25 diff --git a/replay/replay.c b/replay/replay.c index 41a27a9..2067d6b 100755 --- a/replay/replay.c +++ b/replay/replay.c @@ -43,6 +43,10 @@ bool skip_async_events(int stop_event) res = true; } switch (replay_data_kind) { + case EVENT_SHUTDOWN: + replay_has_unread_data = 0; + qemu_system_shutdown_request_impl(); + break; case EVENT_INSTRUCTION: first_cpu->instructions_count = replay_get_dword(); return res; @@ -201,3 +205,10 @@ bool replay_has_interrupt(void) } return false; } + +void replay_shutdown_request(void) +{ + if (replay_mode == REPLAY_SAVE) { + replay_put_event(EVENT_SHUTDOWN); + } +} diff --git a/replay/replay.h b/replay/replay.h index 16e368c..a84c57c 100755 --- a/replay/replay.h +++ b/replay/replay.h @@ -83,6 +83,11 @@ void replay_save_tm(struct tm *tm); /*! Reads struct tm value from the log. Stops execution in case of error */ void replay_read_tm(struct tm *tm); +/* Events */ + +/*! Called when qemu shutdown is requested. */ +void replay_shutdown_request(void); + /* Asynchronous events queue */ /*! Disables storing events in the queue */ diff --git a/vl.c b/vl.c index 86aba43..1a837e6 100644 --- a/vl.c +++ b/vl.c @@ -1929,13 +1929,19 @@ void qemu_system_killed(int signal, pid_t pid) qemu_system_shutdown_request(); } -void qemu_system_shutdown_request(void) +void qemu_system_shutdown_request_impl(void) { trace_qemu_system_shutdown_request(); shutdown_requested = 1; qemu_notify_event(); } +void qemu_system_shutdown_request(void) +{ + replay_shutdown_request(); + qemu_system_shutdown_request_impl(); +} + static void qemu_system_powerdown(void) { qapi_event_send_powerdown(&error_abort);