summaryrefslogtreecommitdiff
path: root/replay/replay-snapshot.c
diff options
context:
space:
mode:
authorPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>2018-02-27 12:52:26 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2018-03-12 16:12:50 +0100
commit4b930d264cea0d72e775a7a57a8fce79158e8c10 (patch)
tree72ff9353ece1c71d1673895c21ec79820305b061 /replay/replay-snapshot.c
parentbb040e006f0245ca376b45dc5ea247f6e1f02648 (diff)
replay: save prior value of the host clock
This patch adds saving/restoring of the host clock field 'last'. It is used in host clock calculation and therefore clock may become incorrect when using restored vmstate. Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20180227095226.1060.50975.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Diffstat (limited to 'replay/replay-snapshot.c')
-rw-r--r--replay/replay-snapshot.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
index 7075986ab5..e0b2204765 100644
--- a/replay/replay-snapshot.c
+++ b/replay/replay-snapshot.c
@@ -25,6 +25,7 @@ static int replay_pre_save(void *opaque)
{
ReplayState *state = opaque;
state->file_offset = ftell(replay_file);
+ state->host_clock_last = qemu_clock_get_last(QEMU_CLOCK_HOST);
return 0;
}
@@ -33,6 +34,7 @@ static int replay_post_load(void *opaque, int version_id)
{
ReplayState *state = opaque;
fseek(replay_file, state->file_offset, SEEK_SET);
+ qemu_clock_set_last(QEMU_CLOCK_HOST, state->host_clock_last);
/* If this was a vmstate, saved in recording mode,
we need to initialize replay data fields. */
replay_fetch_data_kind();
@@ -54,6 +56,7 @@ static const VMStateDescription vmstate_replay = {
VMSTATE_UINT32(has_unread_data, ReplayState),
VMSTATE_UINT64(file_offset, ReplayState),
VMSTATE_UINT64(block_request_id, ReplayState),
+ VMSTATE_UINT64(host_clock_last, ReplayState),
VMSTATE_END_OF_LIST()
},
};