*/
#include "qemu/osdep.h"
-#include "qemu-common.h"
#include "qemu/cutils.h"
#include "migration/vmstate.h"
#include "qapi/error.h"
warp_delta = clock - timers_state.vm_clock_warp_start;
if (icount_enabled() == 2) {
/*
- * In adaptive mode, do not let QEMU_CLOCK_VIRTUAL run too
- * far ahead of real time.
+ * In adaptive mode, do not let QEMU_CLOCK_VIRTUAL run too far
+ * ahead of real time (it might already be ahead so careful not
+ * to go backwards).
*/
int64_t cur_icount = icount_get_locked();
int64_t delta = clock - cur_icount;
+
+ if (delta < 0) {
+ delta = 0;
+ }
warp_delta = MIN(warp_delta, delta);
}
qatomic_set_i64(&timers_state.qemu_icount_bias,
* to vCPU was processed in advance and vCPU went to sleep.
* Therefore we have to wake it up for doing someting.
*/
- if (replay_has_checkpoint()) {
+ if (replay_has_event()) {
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
}
return;
return;
}
+ replay_async_events();
+
/* warp clock deterministically in record/replay mode */
if (!replay_checkpoint(CHECKPOINT_CLOCK_WARP_ACCOUNT)) {
return;
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
NANOSECONDS_PER_SECOND / 10);
}
+
+void icount_notify_exit(void)
+{
+ if (icount_enabled() && current_cpu) {
+ qemu_cpu_kick(current_cpu);
+ qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
+ }
+}