From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Sebastian Tanase <sebastian.tanase@openwide.fr>
Subject: [Qemu-devel] [PULL 05/11] icount: Fix virtual clock start value on ARM
Date: Wed, 6 Aug 2014 18:12:29 +0200 [thread overview]
Message-ID: <1407341555-13173-6-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1407341555-13173-1-git-send-email-pbonzini@redhat.com>
From: Sebastian Tanase <sebastian.tanase@openwide.fr>
When using the icount option on ARM, the virtual
clock starts counting at realtime clock but it
should start at 0.
The reason why the virtual clock starts at realtime clock
is because the first time we call qemu_clock_warp (which
calls icount_warp_rt) in tcg_exec_all, qemu_icount_bias
(which is part of the virtual time computation mechanism)
will increment by realtime - vm_clock_warp_start, with
vm_clock_warp_start being 0 (see icount_warp_rt in cpus.c).
By changing the value of vm_clock_warp_start from 0 to -1,
the first time we call qemu_clock_warp which calls
icount_warp_rt, we will return immediatly because
icount_warp_rt first checks if vm_clock_warp_start is -1
and if it's the case it returns. Therefore, qemu_icount_bias
will first be incremented by the value of a virtual timer
deadline when the virtual cpu goes from active to inactive.
The virtual time will start at 0 and increment based
on the instruction counter when the vcpu is active or
the qemu_icount_bias value when inactive.
Signed-off-by: Sebastian Tanase <sebastian.tanase@openwide.fr>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
cpus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 62636a6..bbb8d4e 100644
--- a/cpus.c
+++ b/cpus.c
@@ -102,7 +102,7 @@ static bool all_cpu_threads_idle(void)
/* Protected by TimersState seqlock */
-static int64_t vm_clock_warp_start;
+static int64_t vm_clock_warp_start = -1;
/* Conversion factor from emulated instructions to virtual clock ticks. */
static int icount_time_shift;
/* Arbitrarily pick 1MIPS as the minimum allowable speed. */
--
1.9.3
next prev parent reply other threads:[~2014-08-06 16:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-06 16:12 [Qemu-devel] [PULL 00/11] KVM, icount changes for 2014-08-06 Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 01/11] backends: Introduce chr-testdev Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 02/11] icount: put icount variables into TimerState Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 03/11] migration: migrate icount fields Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 04/11] timer: add cpu_icount_to_ns function Paolo Bonzini
2014-08-06 16:12 ` Paolo Bonzini [this message]
2014-08-06 16:12 ` [Qemu-devel] [PULL 06/11] icount: Add QemuOpts for icount Paolo Bonzini
2015-06-25 10:33 ` Peter Maydell
2014-08-06 16:12 ` [Qemu-devel] [PULL 07/11] icount: Add align option to icount Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 08/11] cpu-exec: Add sleeping algorithm Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 09/11] cpu-exec: Print to console if the guest is late Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 10/11] monitor: Add drift info to 'info jit' Paolo Bonzini
2014-08-06 16:12 ` [Qemu-devel] [PULL 11/11] target-mips: Ignore unassigned accesses with KVM Paolo Bonzini
2014-08-07 11:28 ` [Qemu-devel] [PULL 00/11] KVM, icount changes for 2014-08-06 Peter Maydell
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=1407341555-13173-6-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sebastian.tanase@openwide.fr \
/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).