[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 23/25] timer: introduce new virtual clock
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [PATCH v6 23/25] timer: introduce new virtual clock |
Date: |
Wed, 12 Sep 2018 11:20:02 +0300 |
User-agent: |
StGit/0.17.1-dirty |
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>
---
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 {
- Re: [Qemu-devel] [PATCH v6 21/25] replay: replay BH for IDE trim operation, (continued)
- Re: [Qemu-devel] [PATCH v6 21/25] replay: replay BH for IDE trim operation, John Snow, 2018/09/14
- Re: [Qemu-devel] [PATCH v6 21/25] replay: replay BH for IDE trim operation, Paolo Bonzini, 2018/09/14
- Re: [Qemu-devel] [PATCH v6 21/25] replay: replay BH for IDE trim operation, Peter Maydell, 2018/09/14
- Re: [Qemu-devel] [PATCH v6 21/25] replay: replay BH for IDE trim operation, Pavel Dovgalyuk, 2018/09/17
- Re: [Qemu-devel] [PATCH v6 21/25] replay: replay BH for IDE trim operation, Paolo Bonzini, 2018/09/17
[Qemu-devel] [PATCH v6 22/25] replay: add BH oneshot event for block layer, Pavel Dovgalyuk, 2018/09/12
[Qemu-devel] [PATCH v6 23/25] timer: introduce new virtual clock,
Pavel Dovgalyuk <=
[Qemu-devel] [PATCH v6 24/25] slirp: fix ipv6 timers, Pavel Dovgalyuk, 2018/09/12
[Qemu-devel] [PATCH v6 25/25] ui: fix virtual timers, Pavel Dovgalyuk, 2018/09/12
Re: [Qemu-devel] [PATCH v6 00/25] Fixing record/replay and adding reverse debugging, Paolo Bonzini, 2018/09/13
[Qemu-devel] [PATCH v6 00/25] Fixing record/replay and adding reverse debugging, Artem Pisarenko, 2018/09/30