From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>,
Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Subject: [Qemu-devel] [PULL 57/69] replay: save prior value of the host clock
Date: Tue, 13 Mar 2018 23:47:07 +0100 [thread overview]
Message-ID: <20180313224719.4954-58-pbonzini@redhat.com> (raw)
In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com>
From: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
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>
---
include/qemu/timer.h | 14 ++++++++++++++
replay/replay-internal.h | 2 ++
replay/replay-snapshot.c | 3 +++
util/qemu-timer.c | 12 ++++++++++++
4 files changed, 31 insertions(+)
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 3b5a54b014..39ea907e65 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -251,6 +251,20 @@ bool qemu_clock_run_timers(QEMUClockType type);
*/
bool qemu_clock_run_all_timers(void);
+/**
+ * qemu_clock_get_last:
+ *
+ * Returns last clock query time.
+ */
+uint64_t qemu_clock_get_last(QEMUClockType type);
+/**
+ * qemu_clock_set_last:
+ *
+ * Sets last clock query time.
+ */
+void qemu_clock_set_last(QEMUClockType type, uint64_t last);
+
+
/*
* QEMUTimerList
*/
diff --git a/replay/replay-internal.h b/replay/replay-internal.h
index 3ebb19912a..be96d7e879 100644
--- a/replay/replay-internal.h
+++ b/replay/replay-internal.h
@@ -78,6 +78,8 @@ typedef struct ReplayState {
This counter is global, because requests from different
block devices should not get overlapping ids. */
uint64_t block_request_id;
+ /*! Prior value of the host clock */
+ uint64_t host_clock_last;
} ReplayState;
extern ReplayState replay_state;
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()
},
};
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index 82d56507a2..2ed1bf2778 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -622,6 +622,18 @@ int64_t qemu_clock_get_ns(QEMUClockType type)
}
}
+uint64_t qemu_clock_get_last(QEMUClockType type)
+{
+ QEMUClock *clock = qemu_clock_ptr(type);
+ return clock->last;
+}
+
+void qemu_clock_set_last(QEMUClockType type, uint64_t last)
+{
+ QEMUClock *clock = qemu_clock_ptr(type);
+ clock->last = last;
+}
+
void qemu_clock_register_reset_notifier(QEMUClockType type,
Notifier *notifier)
{
--
2.14.3
next prev parent reply other threads:[~2018-03-13 22:48 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 22:46 [Qemu-devel] [PULL 00/69] Misc patches for QEMU soft freeze Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 01/69] qom: introduce object_class_get_list_sorted Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 02/69] net: allow using any PCI NICs in -net or -nic Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 03/69] q35: change default NIC to e1000e Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 04/69] scsi-disk.c: consider bl->max_transfer in INQUIRY emulation Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 05/69] qemu-doc: update deprecation section to use -nic and -netdev hubport Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 06/69] qemu-doc: Add the paragraph about the -no-frame deprecation again Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 07/69] build-sys: make help could have 'modules' target Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 08/69] hw: Do not include "sysemu/block-backend.h" if it is not necessary Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 09/69] checkpatch: Exempt long URLs Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 10/69] vl: export machine_init_done Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 11/69] chardev: fix handling of EAGAIN for TCP chardev Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 12/69] chardev: update net listener gcontext Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 13/69] chardev: allow telnet gsource to switch gcontext Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 14/69] chardev: introduce chr_machine_done hook Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 15/69] chardev: use chardev's gcontext for async connect Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 16/69] chardev: tcp: postpone async connection setup Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 17/69] chardev: tcp: let TLS run on chardev context Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 18/69] scsi: support NDOB (no data-out buffer) for WRITE SAME commands Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 19/69] hw/i386: make IOMMUs configurable via default-configs/ Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 20/69] Polish the version strings containing the package version Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 21/69] hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 22/69] rcutorture: remove synchronize_rcu from readers Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 23/69] docs: document atomic_load_acquire and atomic_store_release Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 24/69] rcu: make memory barriers more explicit Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 25/69] membarrier: introduce qemu/sys_membarrier.h Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 26/69] membarrier: add --enable-membarrier Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 27/69] hw/isa: Move parallel_hds_isa_init() to hw/char/parallel-isa.c Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 28/69] hw/dma/i8257: Rename DMA_init() to i8257_dma_init() Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 29/69] hw/input/i8042: Extract declarations from i386/pc.h into input/i8042.h Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 30/69] MAINTAINERS: Fix the PC87312 include path Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 31/69] hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 32/69] hw/isa/pc87312: Use uint16_t for the ISA I/O base address Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 33/69] hw/isa/pc87312: Use 'unsigned int' for the irq value Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 34/69] hw/isa/superio: Add a Super I/O template based on the PC87312 device Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 35/69] hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 36/69] hw/isa/superio: Factor out the parallel code from pc87312.c Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 37/69] hw/isa/superio: Factor out the serial " Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 38/69] hw/isa/superio: Factor out the floppy disc controller " Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 39/69] hw/isa/superio: Add a keyboard/mouse controller (8042) Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 40/69] hw/isa/superio: Factor out the IDE code from pc87312.c Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 41/69] hw/mips/malta: Code movement Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 42/69] hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 43/69] hw/mips/mips_fulong2e: Factor out vt82c686b_southbridge_init() Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 44/69] hw/isa/vt82c686: Rename vt82c686b_init() -> vt82c686b_isa_init() Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 45/69] hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 46/69] MAINTAINERS: Add entries for the VT82C686B Super I/O Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 47/69] MAINTAINERS: Split the Alpha TCG/machine section Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 48/69] hw/isa/superio: Add the SMC FDC37C669 Super I/O Paolo Bonzini
2018-03-13 22:46 ` [Qemu-devel] [PULL 49/69] hw/alpha/dp264: Add the ISA DMA controller Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 50/69] hw/alpha/dp264: Use the TYPE_SMC37C669_SUPERIO Paolo Bonzini
2018-06-01 18:51 ` Emilio G. Cota
2018-06-01 19:49 ` Richard Henderson
2018-06-13 16:21 ` Paolo Bonzini
2018-06-13 16:35 ` Philippe Mathieu-Daudé
2018-06-13 17:17 ` Philippe Mathieu-Daudé
2018-06-14 12:21 ` Philippe Mathieu-Daudé
2018-03-13 22:47 ` [Qemu-devel] [PULL 51/69] hw/i386/pc: Factor out the superio code Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 52/69] cpu-exec: fix exception_index handling Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 53/69] replay: fix processing async events Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 54/69] replay: fixed replay_enable_events Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 55/69] replay: fix save/load vm for non-empty queue Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 56/69] replay: added replay log format description Paolo Bonzini
2018-03-13 22:47 ` Paolo Bonzini [this message]
2018-03-13 22:47 ` [Qemu-devel] [PULL 58/69] replay/replay.c: bump REPLAY_VERSION again Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 59/69] replay/replay-internal.c: track holding of replay_lock Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 60/69] replay: make locking visible outside replay code Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 61/69] replay: don't destroy mutex at exit Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 62/69] replay: push replay_mutex_lock up the call tree Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 63/69] replay: check return values of fwrite Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 64/69] replay: avoid recursive call of checkpoints Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 65/69] scripts/replay-dump.py: replay log dumper Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 66/69] replay: don't process async events when warping the clock Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 67/69] replay: save vmstate of the asynchronous events Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 68/69] replay: update documentation Paolo Bonzini
2018-03-13 22:47 ` [Qemu-devel] [PULL 69/69] tcg: fix cpu_io_recompile Paolo Bonzini
2018-03-14 0:15 ` [Qemu-devel] [PULL 00/69] Misc patches for QEMU soft freeze no-reply
2018-03-14 3:35 ` Peter Xu
2018-03-14 10:12 ` Paolo Bonzini
2018-03-14 11:30 ` Eric Blake
2018-03-14 11:36 ` Peter Xu
2018-03-14 11:53 ` Paolo Bonzini
2018-03-16 12:58 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180313224719.4954-58-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=Pavel.Dovgaluk@ispras.ru \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).