[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/17] icount: use cpu_get_icount() directly
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 12/17] icount: use cpu_get_icount() directly |
Date: |
Thu, 17 Oct 2013 17:48:50 +0200 |
This will help later when we will have to place these calls in
a critical section, and thus call a version of cpu_get_icount()
that does not take the lock.
Reviewed-by: Alex Bligh <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpus.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/cpus.c b/cpus.c
index f075335..a2d09f3 100644
--- a/cpus.c
+++ b/cpus.c
@@ -236,12 +236,15 @@ static void icount_adjust(void)
int64_t cur_icount;
int64_t delta;
static int64_t last_delta;
+
/* If the VM is not running, then do nothing. */
if (!runstate_is_running()) {
return;
}
+
cur_time = cpu_get_clock();
- cur_icount = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+ cur_icount = cpu_get_icount();
+
delta = cur_icount - cur_time;
/* FIXME: This is a very crude algorithm, somewhat prone to oscillation.
*/
if (delta > 0
@@ -297,7 +300,7 @@ static void icount_warp_rt(void *opaque)
* far ahead of real time.
*/
int64_t cur_time = cpu_get_clock();
- int64_t cur_icount = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+ int64_t cur_icount = cpu_get_icount();
int64_t delta = cur_time - cur_icount;
qemu_icount_bias += MIN(warp_delta, delta);
}
--
1.8.3.1
- [Qemu-devel] [PULL 01/17] memory: fix 128 arithmetic in info mtree, (continued)
- [Qemu-devel] [PULL 01/17] memory: fix 128 arithmetic in info mtree, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 02/17] compatfd: switch to QemuThread, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 04/17] cirrus: Mark vga io region as coalesced MMIO flushing, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 05/17] vga: Mark relevant portio lists regions as coalesced MMIO flushing, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 03/17] portio: Allow to mark portio lists as coalesced MMIO flushing, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 10/17] timer: extract timer_mod_ns_locked and timerlist_rearm, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 11/17] timer: add timer_mod_anticipate and timer_mod_anticipate_ns, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 07/17] timer: protect timers_state's clock with seqlock, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 06/17] seqlock: introduce read-write seqlock, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 08/17] qemu-thread: add QemuEvent, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 12/17] icount: use cpu_get_icount() directly,
Paolo Bonzini <=
- [Qemu-devel] [PULL 09/17] timer: make qemu_clock_enable sync between disable and timer's cb, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 15/17] icount: document (future) locking rules for icount, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 13/17] icount: reorganize icount_warp_rt, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 14/17] icount: prepare the code for future races in calling qemu_clock_warp, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 16/17] icount: make it thread-safe, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 17/17] exec: remove qemu_safe_ram_ptr, Paolo Bonzini, 2013/10/17