[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/18] icount: improve counting for record/replay
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 11/18] icount: improve counting for record/replay |
Date: |
Wed, 4 Nov 2015 17:17:49 +0100 |
From: Pavel Dovgalyuk <address@hidden>
icount_warp_rt function is called by qemu_clock_warp and as
callback of icount_warp timer. This patch adds call to qemu_clock_warp
into main_loop_wait function, because icount warp may be missed
in record/replay mode, when CPU is sleeping.
This patch also disables of calling this function by timer, because
it is not needed after making modifications of main_loop_wait.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpus.c | 11 ++++++++---
main-loop.c | 3 +++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/cpus.c b/cpus.c
index 2385caa..1a7318f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -335,7 +335,7 @@ static int64_t qemu_icount_round(int64_t count)
return (count + (1 << icount_time_shift) - 1) >> icount_time_shift;
}
-static void icount_warp_rt(void *opaque)
+static void icount_warp_rt(void)
{
/* The icount_warp_timer is rescheduled soon after vm_clock_warp_start
* changes from -1 to another value, so the race here is okay.
@@ -370,6 +370,11 @@ static void icount_warp_rt(void *opaque)
}
}
+static void icount_dummy_timer(void *opaque)
+{
+ (void)opaque;
+}
+
void qtest_clock_warp(int64_t dest)
{
int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
@@ -414,7 +419,7 @@ void qemu_clock_warp(QEMUClockType type)
* the CPU starts running, in case the CPU is woken by an event other
* than the earliest QEMU_CLOCK_VIRTUAL timer.
*/
- icount_warp_rt(NULL);
+ icount_warp_rt();
timer_del(icount_warp_timer);
}
if (!all_cpu_threads_idle()) {
@@ -607,7 +612,7 @@ void configure_icount(QemuOpts *opts, Error **errp)
icount_sleep = qemu_opt_get_bool(opts, "sleep", true);
if (icount_sleep) {
icount_warp_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL_RT,
- icount_warp_rt, NULL);
+ icount_dummy_timer, NULL);
}
icount_align_option = qemu_opt_get_bool(opts, "align", false);
diff --git a/main-loop.c b/main-loop.c
index db600a3..df28670 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -506,6 +506,9 @@ int main_loop_wait(int nonblocking)
slirp_pollfds_poll(gpollfds, (ret < 0));
#endif
+ /* CPU thread can infinitely wait for event after
+ missing the warp */
+ qemu_clock_warp(QEMU_CLOCK_VIRTUAL);
qemu_clock_run_all_timers();
return ret;
--
1.8.3.1
- [Qemu-devel] [PULL 00/18] Record/replay core for QEMU 2.4-rc1, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 01/18] replay: global variables and function stubs, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 02/18] replay: internal functions for replay log, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 04/18] replay: introduce icount event, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 03/18] replay: introduce mutex to protect the replay log, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 06/18] cpu: replay instructions sequence, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 10/18] replay: shutdown event, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 11/18] icount: improve counting for record/replay,
Paolo Bonzini <=
- [Qemu-devel] [PULL 09/18] replay: recording and replaying clock ticks, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 05/18] cpu-exec: allow temporary disabling icount, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 07/18] replay: interrupts and exceptions, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 12/18] replay: checkpoints, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 08/18] replay: asynchronous events infrastructure, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 14/18] replay: ptimer, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 15/18] replay: initialization and deinitialization, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 13/18] bottom halves: introduce bh call function, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 16/18] replay: replay blockers for devices, Paolo Bonzini, 2015/11/04
- [Qemu-devel] [PULL 17/18] replay: command line options, Paolo Bonzini, 2015/11/04