From: fred.konrad@greensocs.com
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, mark.burton@greensocs.com,
fred.konrad@greensocs.com
Subject: [Qemu-devel] [RFC 2/3] icount: sync vm_clock on the next event.
Date: Thu, 18 Jul 2013 17:02:36 +0200 [thread overview]
Message-ID: <1374159757-16383-3-git-send-email-fred.konrad@greensocs.com> (raw)
In-Reply-To: <1374159757-16383-1-git-send-email-fred.konrad@greensocs.com>
From: KONRAD Frederic <fred.konrad@greensocs.com>
We don't want vm_clock to be synchronized with rt_clock as it is
not deterministic for replay.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
---
cpus.c | 11 +++++++++--
main-loop.c | 5 +++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/cpus.c b/cpus.c
index 46504d0..fb83153 100644
--- a/cpus.c
+++ b/cpus.c
@@ -64,6 +64,8 @@
static CPUArchState *next_cpu;
+void icount_warp_rt(void *opaque);
+
static bool cpu_thread_is_idle(CPUState *cpu)
{
if (cpu->stop || cpu->queued_work_first) {
@@ -277,7 +279,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)
+void icount_warp_rt(void *opaque)
{
if (vm_clock_warp_start == -1) {
return;
@@ -286,8 +288,13 @@ static void icount_warp_rt(void *opaque)
if (runstate_is_running()) {
int64_t clock = qemu_get_clock_ns(rt_clock);
int64_t warp_delta = clock - vm_clock_warp_start;
+ int64_t next_vm_deadline = qemu_clock_deadline(vm_clock);
if (use_icount == 1) {
- qemu_icount_bias += warp_delta;
+ if (next_vm_deadline > 0) {
+ qemu_icount_bias += next_vm_deadline;
+ } else {
+ qemu_notify_event();
+ }
} else {
/*
* In adaptive mode, do not let the vm_clock run too
diff --git a/main-loop.c b/main-loop.c
index a44fff6..16c9b85 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -33,6 +33,8 @@
#include "qemu/compatfd.h"
+void icount_warp_rt(void *opaque);
+
/* If we have signalfd, we mask out the signals we want to handle and then
* use signalfd to listen for them. We rely on whatever the current signal
* handler is to dispatch the signals when we receive them.
@@ -470,6 +472,9 @@ int main_loop_wait(int nonblocking)
qemu_run_all_timers();
+ if (use_icount == 1) {
+ icount_warp_rt(NULL);
+ }
return ret;
}
--
1.8.1.4
next prev parent reply other threads:[~2013-07-18 15:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-18 15:02 [Qemu-devel] [RFC 0/3] Determinitic behaviour with icount fred.konrad
2013-07-18 15:02 ` [Qemu-devel] [RFC 1/3] icount: base rt_clock on icount fred.konrad
2013-07-18 15:36 ` Paolo Bonzini
2013-07-18 16:23 ` Frederic Konrad
2013-07-18 16:26 ` Paolo Bonzini
2013-07-18 15:02 ` fred.konrad [this message]
2013-07-18 15:02 ` [Qemu-devel] [RFC 3/3] icount: create a new icount based timer fred.konrad
2013-07-18 15:08 ` Peter Maydell
2013-07-18 15:06 ` [Qemu-devel] [RFC 0/3] Determinitic behaviour with icount Peter Maydell
2013-07-18 15:09 ` Frederic Konrad
2013-07-18 15:12 ` Peter Maydell
2013-07-18 15:35 ` Paolo Bonzini
2013-07-18 16:31 ` Frederic Konrad
2013-07-18 16:35 ` Paolo Bonzini
2013-07-19 15:26 ` Frederic Konrad
2013-07-29 15:27 ` Frederic Konrad
2013-07-29 16:42 ` Paolo Bonzini
2013-07-30 7:06 ` Frederic Konrad
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=1374159757-16383-3-git-send-email-fred.konrad@greensocs.com \
--to=fred.konrad@greensocs.com \
--cc=mark.burton@greensocs.com \
--cc=pbonzini@redhat.com \
--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).