[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/7] icount: make icount extra computed on icount cl
From: |
fred . konrad |
Subject: |
[Qemu-devel] [PATCH 6/7] icount: make icount extra computed on icount clock as well. |
Date: |
Fri, 1 Aug 2014 01:37:14 +0200 |
From: KONRAD Frederic <address@hidden>
This takes icount clock in account for icount extra computation so icount
clock's timers will be triggered at the exact time.
Signed-off-by: KONRAD Frederic <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
---
cpus.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/cpus.c b/cpus.c
index 8bd3423..f63872b 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1323,6 +1323,7 @@ static int tcg_cpu_exec(CPUArchState *env)
if (use_icount) {
int64_t count;
int64_t deadline;
+ int64_t icount_deadline;
int decr;
timers_state.qemu_icount -= (cpu->icount_decr.u16.low
+ cpu->icount_extra);
@@ -1339,6 +1340,15 @@ static int tcg_cpu_exec(CPUArchState *env)
deadline = INT32_MAX;
}
+ /*
+ * Take icount clock deadline in account too, and keep the nearest
+ * deadline.
+ */
+ icount_deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_ICOUNT);
+ if ((icount_deadline >= 0) && (icount_deadline < deadline)) {
+ deadline = icount_deadline;
+ }
+
count = qemu_icount_round(deadline);
timers_state.qemu_icount += count;
decr = (count > 0xffff) ? 0xffff : count;
--
1.9.0
- [Qemu-devel] [PATCH 0/7] icount migration and clock., fred . konrad, 2014/07/31
- [Qemu-devel] [PATCH 2/7] migration: migrate icount fields., fred . konrad, 2014/07/31
- [Qemu-devel] [PATCH 6/7] icount: make icount extra computed on icount clock as well.,
fred . konrad <=
- [Qemu-devel] [PATCH 3/7] migration: make qemu_savevm_state public., fred . konrad, 2014/07/31
- [Qemu-devel] [PATCH 1/7] icount: put icount variables into TimerState., fred . konrad, 2014/07/31
- [Qemu-devel] [PATCH 5/7] icount: check for icount clock deadline when cpu loop exits., fred . konrad, 2014/07/31
- [Qemu-devel] [PATCH 4/7] icount: introduce icount timer., fred . konrad, 2014/07/31
- [Qemu-devel] [PATCH 7/7] timer: add cpu_icount_to_ns function., fred . konrad, 2014/07/31