[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v18 13/21] icount: improve counting for record/repla
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [PATCH v18 13/21] icount: improve counting for record/replay |
Date: |
Thu, 17 Sep 2015 19:24:39 +0300 |
User-agent: |
StGit/0.16 |
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>
---
cpus.c | 11 ++++++++---
main-loop.c | 3 +++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/cpus.c b/cpus.c
index 95b8469..46d6717 100644
--- a/cpus.c
+++ b/cpus.c
@@ -327,7 +327,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.
@@ -362,6 +362,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);
@@ -406,7 +411,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()) {
@@ -529,7 +534,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;
- [Qemu-devel] [PATCH v18 05/21] replay: introduce icount event, (continued)
- [Qemu-devel] [PATCH v18 05/21] replay: introduce icount event, Pavel Dovgalyuk, 2015/09/17
- [Qemu-devel] [PATCH v18 06/21] cpu-exec: allow temporary disabling icount, Pavel Dovgalyuk, 2015/09/17
- [Qemu-devel] [PATCH v18 07/21] cpu: replay instructions sequence, Pavel Dovgalyuk, 2015/09/17
- [Qemu-devel] [PATCH v18 08/21] i386: interrupt poll processing, Pavel Dovgalyuk, 2015/09/17
- [Qemu-devel] [PATCH v18 09/21] replay: interrupts and exceptions, Pavel Dovgalyuk, 2015/09/17
- [Qemu-devel] [PATCH v18 10/21] replay: asynchronous events infrastructure, Pavel Dovgalyuk, 2015/09/17
- [Qemu-devel] [PATCH v18 11/21] replay: recording and replaying clock ticks, Pavel Dovgalyuk, 2015/09/17
- [Qemu-devel] [PATCH v18 12/21] replay: shutdown event, Pavel Dovgalyuk, 2015/09/17
- [Qemu-devel] [PATCH v18 13/21] icount: improve counting for record/replay,
Pavel Dovgalyuk <=
[Qemu-devel] [PATCH v18 14/21] replay: checkpoints, Pavel Dovgalyuk, 2015/09/17
[Qemu-devel] [PATCH v18 15/21] bottom halves: introduce bh call function, Pavel Dovgalyuk, 2015/09/17
[Qemu-devel] [PATCH v18 16/21] replay: ptimer, Pavel Dovgalyuk, 2015/09/17
[Qemu-devel] [PATCH v18 17/21] typedef: add typedef for QemuOpts, Pavel Dovgalyuk, 2015/09/17
[Qemu-devel] [PATCH v18 18/21] replay: initialization and deinitialization, Pavel Dovgalyuk, 2015/09/17
[Qemu-devel] [PATCH v18 20/21] replay: command line options, Pavel Dovgalyuk, 2015/09/17