From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO3FV-0007lq-1C for qemu-devel@nongnu.org; Wed, 18 Feb 2015 06:57:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YO3FR-00039t-0N for qemu-devel@nongnu.org; Wed, 18 Feb 2015 06:57:00 -0500 Received: from mail.ispras.ru ([83.149.199.45]:38260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO3FQ-00039a-Pk for qemu-devel@nongnu.org; Wed, 18 Feb 2015 06:56:56 -0500 From: Pavel Dovgalyuk Date: Wed, 18 Feb 2015 14:56:58 +0300 Message-ID: <20150218115658.4176.90472.stgit@PASHA-ISP> In-Reply-To: <20150218115534.4176.12578.stgit@PASHA-ISP> References: <20150218115534.4176.12578.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v9 13/23] 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, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com This patch records and replays simulator shutdown event. Reviewed-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- replay/replay-internal.h | 2 ++ replay/replay.c | 12 ++++++++++++ replay/replay.h | 5 +++++ vl.c | 1 + 4 files changed, 20 insertions(+), 0 deletions(-) diff --git a/replay/replay-internal.h b/replay/replay-internal.h index 1a88fda..27a3b0a 100755 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -23,6 +23,8 @@ enum ReplayEvents { EVENT_EXCEPTION, /* for async events */ EVENT_ASYNC, + /* for shutdown request */ + EVENT_SHUTDOWN, /* for clock read/writes */ /* some of grteater codes are reserved for clocks */ EVENT_CLOCK, diff --git a/replay/replay.c b/replay/replay.c index 54a4fb8..3330432 100755 --- a/replay/replay.c +++ b/replay/replay.c @@ -13,6 +13,7 @@ #include "replay.h" #include "replay-internal.h" #include "qemu/timer.h" +#include "sysemu/sysemu.h" ReplayMode replay_mode = REPLAY_MODE_NONE; @@ -34,6 +35,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(); + break; case EVENT_INSTRUCTION: replay_state.instructions_count = replay_get_dword(); return res; @@ -149,3 +154,10 @@ bool replay_has_interrupt(void) } return res; } + +void replay_shutdown_request(void) +{ + if (replay_mode == REPLAY_MODE_RECORD) { + replay_put_event(EVENT_SHUTDOWN); + } +} diff --git a/replay/replay.h b/replay/replay.h index 2398509..fcc93d1 100755 --- a/replay/replay.h +++ b/replay/replay.h @@ -66,6 +66,11 @@ int64_t replay_read_clock(ReplayClockKind kind); ? replay_save_clock((clock), (value)) \ : (value)) +/* 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 00161f4..58b9dd5 100644 --- a/vl.c +++ b/vl.c @@ -1710,6 +1710,7 @@ void qemu_system_killed(int signal, pid_t pid) void qemu_system_shutdown_request(void) { trace_qemu_system_shutdown_request(); + replay_shutdown_request(); shutdown_requested = 1; qemu_notify_event(); }