[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 42/79] timer: introduce new virtual clock
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 42/79] timer: introduce new virtual clock |
Date: |
Sun, 30 Sep 2018 10:12:40 +0200 |
From: Pavel Dovgalyuk <address@hidden>
Slirp and VNC modules use virtual clock for processing some events that
are related to the guest execution speed.
But virtual clock-related events are consideres to be deterministic and
are recorded/replayed by icount mechanism. But slirp and VNC lie outside
the recorded guest core (which includes CPU and peripherals).
Therefore slirp and VNC are external for the guest, but should work at
guest speed.
This patch introduces new virtual clock which can be used for external
subsystems for running timers that are synchronized with the guest.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/qemu/timer.h | 9 +++++++++
util/qemu-timer.c | 2 ++
2 files changed, 11 insertions(+)
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 39ea907..a005ed2 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -42,6 +42,14 @@
* In icount mode, this clock counts nanoseconds while the virtual
* machine is running. It is used to increase @QEMU_CLOCK_VIRTUAL
* while the CPUs are sleeping and thus not executing instructions.
+ *
+ * @QEMU_CLOCK_VIRTUAL_EXT: virtual clock for external subsystems
+ *
+ * The virtual clock only runs during the emulation. It stops
+ * when the virtual machine is stopped. The timers for this clock
+ * do not recorded in rr mode, therefore this clock could be used
+ * for the subsystems that operate outside the guest core.
+ *
*/
typedef enum {
@@ -49,6 +57,7 @@ typedef enum {
QEMU_CLOCK_VIRTUAL = 1,
QEMU_CLOCK_HOST = 2,
QEMU_CLOCK_VIRTUAL_RT = 3,
+ QEMU_CLOCK_VIRTUAL_EXT = 4,
QEMU_CLOCK_MAX
} QEMUClockType;
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index 86bfe84..eb60d8f 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -496,6 +496,7 @@ bool timerlist_run_timers(QEMUTimerList *timer_list)
switch (timer_list->clock->type) {
case QEMU_CLOCK_REALTIME:
+ case QEMU_CLOCK_VIRTUAL_EXT:
break;
default:
case QEMU_CLOCK_VIRTUAL:
@@ -597,6 +598,7 @@ int64_t qemu_clock_get_ns(QEMUClockType type)
return get_clock();
default:
case QEMU_CLOCK_VIRTUAL:
+ case QEMU_CLOCK_VIRTUAL_EXT:
if (use_icount) {
return cpu_get_icount();
} else {
--
1.8.3.1
- [Qemu-devel] [PULL 28/79] target/i386: move cpu_T1 to DisasContext, (continued)
- [Qemu-devel] [PULL 28/79] target/i386: move cpu_T1 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 34/79] target/i386: move cpu_tmp3_i32 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 26/79] target/i386: move cpu_A0 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 31/79] target/i386: move cpu_ptr0 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 30/79] target/i386: move cpu_tmp4 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 29/79] target/i386: move cpu_tmp0 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 32/79] target/i386: move cpu_ptr1 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 35/79] target/i386: move cpu_tmp1_i64 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 33/79] target/i386: move cpu_tmp2_i32 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 38/79] replay: wake up vCPU when replaying, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 42/79] timer: introduce new virtual clock,
Paolo Bonzini <=
- [Qemu-devel] [PULL 37/79] configure: enable mttcg for i386 and x86_64, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 39/79] replay: flush events when exiting, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 40/79] translator: fix breakpoint processing, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 27/79] target/i386: move cpu_T0 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 41/79] replay: allow loading any snapshots before recording, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 43/79] slirp: fix ipv6 timers, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 36/79] target/i386: move x86_64_hregs to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 45/79] fw_cfg_mem: add read memory region callback, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 44/79] ui: fix virtual timers, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 46/79] hw: debugexit: add read callback, Paolo Bonzini, 2018/09/30