From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Pavel Dovgalyuk" <Pavel.Dovgaluk@gmail.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Pavel Dovgalyuk" <Pavel.Dovgaluk@ispras.ru>
Subject: [PULL 07/31] replay: synchronize on every virtual timer callback
Date: Wed, 24 Jun 2020 06:50:24 -0400 [thread overview]
Message-ID: <20200624105048.375353-7-pbonzini@redhat.com> (raw)
In-Reply-To: <20200624104917.375143-1-pbonzini@redhat.com>
From: Pavel Dovgalyuk <Pavel.Dovgaluk@gmail.com>
Sometimes virtual timer callbacks depend on order
of virtual timer processing and warping of virtual clock.
Therefore every callback should be logged to make replay deterministic.
This patch creates a checkpoint before every virtual timer callback.
With these checkpoints virtual timers processing and clock warping
events order is completely deterministic.
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
--
v2:
- remove mutex lock/unlock for virtual clock checkpoint since it is
not process any asynchronous events (commit ca9759c2a92f528f256fef0e3922416f7bb47bf9)
- bump record/replay log file version
Message-Id: <159012932716.27256.8854065545365559921.stgit@pasha-ThinkPad-X280>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
replay/replay.c | 2 +-
util/qemu-timer.c | 32 +++++++++-----------------------
2 files changed, 10 insertions(+), 24 deletions(-)
diff --git a/replay/replay.c b/replay/replay.c
index 7d93746c73..83ed9e0e24 100644
--- a/replay/replay.c
+++ b/replay/replay.c
@@ -22,7 +22,7 @@
/* Current version of the replay mechanism.
Increase it when file format changes. */
-#define REPLAY_VERSION 0xe02009
+#define REPLAY_VERSION 0xe0200a
/* Size of replay log header */
#define HEADER_SIZE (sizeof(uint32_t) + sizeof(uint64_t))
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index b6575a2cd5..f62b4feecd 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -501,7 +501,6 @@ bool timerlist_run_timers(QEMUTimerList *timer_list)
bool progress = false;
QEMUTimerCB *cb;
void *opaque;
- bool need_replay_checkpoint = false;
if (!atomic_read(&timer_list->active_timers)) {
return false;
@@ -517,16 +516,6 @@ bool timerlist_run_timers(QEMUTimerList *timer_list)
break;
default:
case QEMU_CLOCK_VIRTUAL:
- if (replay_mode != REPLAY_MODE_NONE) {
- /* Checkpoint for virtual clock is redundant in cases where
- * it's being triggered with only non-EXTERNAL timers, because
- * these timers don't change guest state directly.
- * Since it has conditional dependence on specific timers, it is
- * subject to race conditions and requires special handling.
- * See below.
- */
- need_replay_checkpoint = true;
- }
break;
case QEMU_CLOCK_HOST:
if (!replay_checkpoint(CHECKPOINT_CLOCK_HOST)) {
@@ -559,19 +548,16 @@ bool timerlist_run_timers(QEMUTimerList *timer_list)
*/
break;
}
- if (need_replay_checkpoint
- && !(ts->attributes & QEMU_TIMER_ATTR_EXTERNAL)) {
- /* once we got here, checkpoint clock only once */
- need_replay_checkpoint = false;
+ /* Checkpoint for virtual clock is redundant in cases where
+ * it's being triggered with only non-EXTERNAL timers, because
+ * these timers don't change guest state directly.
+ */
+ if (replay_mode != REPLAY_MODE_NONE
+ && timer_list->clock->type == QEMU_CLOCK_VIRTUAL
+ && !(ts->attributes & QEMU_TIMER_ATTR_EXTERNAL)
+ && !replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL)) {
qemu_mutex_unlock(&timer_list->active_timers_lock);
- if (!replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL)) {
- goto out;
- }
- qemu_mutex_lock(&timer_list->active_timers_lock);
- /* The lock was released; start over again in case the list was
- * modified.
- */
- continue;
+ goto out;
}
/* remove timer from the list before calling the callback */
--
2.26.2
next prev parent reply other threads:[~2020-06-24 11:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 10:48 [PULL 00/31] Misc patches for 2020-06-24 Paolo Bonzini
2020-06-24 10:50 ` [PULL 01/31] kvm: support to get/set dirty log initial-all-set capability Paolo Bonzini
2020-06-24 10:50 ` [PULL 02/31] util/getauxval: Porting to FreeBSD getauxval feature Paolo Bonzini
2020-06-24 10:50 ` [PULL 03/31] libqos: usb-hcd-ehci: use 32-bit write for config register Paolo Bonzini
2020-06-24 10:50 ` [PULL 04/31] libqos: pci-pc: use 32-bit write for EJ register Paolo Bonzini
2020-06-24 10:50 ` [PULL 05/31] memory: Revert "memory: accept mismatching sizes in memory_region_access_valid" Paolo Bonzini
2020-06-24 10:50 ` [PULL 06/31] replay: notify the main loop when there are no instructions Paolo Bonzini
2020-06-24 10:50 ` Paolo Bonzini [this message]
2020-06-24 10:50 ` [PULL 08/31] configure: add libdaxctl support Paolo Bonzini
2020-06-24 10:50 ` [PULL 09/31] exec: fetch the alignment of Linux devdax pmem character device nodes Paolo Bonzini
2020-06-24 10:50 ` [PULL 10/31] docs/nvdimm: add description of alignment requirement of device dax Paolo Bonzini
2020-06-24 10:50 ` [PULL 11/31] hw/scsi/megasas: Fix possible out-of-bounds array access in tracepoints Paolo Bonzini
2020-06-24 10:50 ` [PULL 12/31] Makefile: Install qemu-[qmp/ga]-ref.* into the directory "interop" Paolo Bonzini
2020-06-24 10:50 ` [PULL 13/31] xen: Actually fix build without passthrough Paolo Bonzini
2020-06-24 10:50 ` [PULL 14/31] target/i386: reimplement f2xm1 using floatx80 operations Paolo Bonzini
2020-07-14 14:09 ` Laszlo Ersek
2020-06-24 10:50 ` [PULL 15/31] softfloat: merge floatx80_mod and floatx80_rem Paolo Bonzini
2020-06-24 10:50 ` [PULL 16/31] softfloat: fix floatx80 remainder pseudo-denormal check for zero Paolo Bonzini
2020-06-24 10:50 ` [PULL 17/31] softfloat: do not return pseudo-denormal from floatx80 remainder Paolo Bonzini
2020-06-24 10:50 ` [PULL 18/31] softfloat: do not set denominator high bit for " Paolo Bonzini
2020-06-24 10:50 ` [PULL 19/31] softfloat: return low bits of quotient from floatx80_modrem Paolo Bonzini
2020-06-24 10:50 ` [PULL 20/31] target/i386: reimplement fprem, fprem1 using floatx80 operations Paolo Bonzini
2020-06-24 10:50 ` [PULL 21/31] target/i386: reimplement fyl2xp1 " Paolo Bonzini
2020-06-24 10:50 ` [PULL 22/31] target/i386: reimplement fyl2x " Paolo Bonzini
2020-06-24 10:50 ` [PULL 23/31] target/i386: reimplement fpatan " Paolo Bonzini
2020-06-24 10:50 ` [PULL 24/31] target/i386: Add notes for versioned CPU models Paolo Bonzini
2020-06-24 10:50 ` [PULL 25/31] osdep: Make MIN/MAX evaluate arguments only once Paolo Bonzini
2020-06-24 12:13 ` Eric Blake
2020-06-24 12:21 ` Daniel P. Berrangé
2020-06-24 13:19 ` Philippe Mathieu-Daudé
2020-06-24 10:50 ` [PULL 26/31] numa: forbid '-numa node, mem' for 5.1 and newer machine types Paolo Bonzini
2020-06-24 10:50 ` [PULL 27/31] kvm: i386: allow TSC to differ by NTP correction bounds without TSC scaling Paolo Bonzini
2020-06-24 10:50 ` [PULL 28/31] hyperv: vmbus: Remove the 2nd IRQ Paolo Bonzini
2020-06-24 10:50 ` [PULL 29/31] vmport: move compat properties to hw_compat_5_0 Paolo Bonzini
2020-06-24 10:50 ` [PULL 30/31] ibex_uart: fix XOR-as-pow Paolo Bonzini
2020-06-24 10:50 ` [PULL 31/31] i386: Mask SVM features if nested SVM is disabled Paolo Bonzini
2020-06-24 11:29 ` [PULL 00/31] Misc patches for 2020-06-24 no-reply
2020-06-25 15:50 ` Peter Maydell
2020-06-25 16:33 ` Eric Blake
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=20200624105048.375353-7-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=Pavel.Dovgaluk@gmail.com \
--cc=Pavel.Dovgaluk@ispras.ru \
--cc=alex.bennee@linaro.org \
--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).