diff options
author | Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> | 2016-03-10 14:56:09 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-03-15 18:23:45 +0100 |
commit | e76d1798faa6d29f54c0930a034b67f3ecdb947d (patch) | |
tree | fbfade6e7fcfafd8f8059923a4e82f849d8ea40a /include | |
parent | 281b2201e4e18d5b9a26e1e8d81b62b5581a13be (diff) |
icount: decouple warp calls
qemu_clock_warp function is called to update virtual clock when CPU
is sleeping. This function includes replay checkpoint to make execution
deterministic in icount mode.
Record/replay module flushes async event queue at checkpoints.
Some of the events (e.g., block devices operations) include interaction
with hardware. E.g., APIC polled by block devices sets one of IRQ flags.
Flag to be set depends on currently executed thread (CPU or iothread).
Therefore in replay mode we have to process the checkpoints in the same thread
as they were recorded.
qemu_clock_warp function (and its checkpoint) may be called from different
thread. This patch decouples two different execution cases of this function:
call when CPU is sleeping from iothread and call from cpu thread to update
virtual clock.
First task is performed by qemu_start_warp_timer function. It sets warp
timer event to the moment of nearest pending virtual timer.
Second function (qemu_account_warp_timer) is called from cpu thread
before execution of the code. It advances virtual clock by adding the length
of period while CPU was sleeping.
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20160310115609.4812.44986.stgit@PASHA-ISP>
[Update docs. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/timer.h | 7 | ||||
-rw-r--r-- | include/sysemu/replay.h | 3 |
2 files changed, 5 insertions, 5 deletions
diff --git a/include/qemu/timer.h b/include/qemu/timer.h index d0946cb953..7197d0859a 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -210,12 +210,11 @@ void qemu_clock_notify(QEMUClockType type); void qemu_clock_enable(QEMUClockType type, bool enabled); /** - * qemu_clock_warp: - * @type: the clock type + * qemu_start_warp_timer: * - * Warp a clock to a new value + * Starts a timer for virtual clock update */ -void qemu_clock_warp(QEMUClockType type); +void qemu_start_warp_timer(void); /** * qemu_clock_register_reset_notifier: diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index d24d50238e..e7989199fc 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -27,7 +27,8 @@ typedef enum ReplayClockKind ReplayClockKind; /* IDs of the checkpoints */ enum ReplayCheckpoint { - CHECKPOINT_CLOCK_WARP, + CHECKPOINT_CLOCK_WARP_START, + CHECKPOINT_CLOCK_WARP_ACCOUNT, CHECKPOINT_RESET_REQUESTED, CHECKPOINT_SUSPEND_REQUESTED, CHECKPOINT_CLOCK_VIRTUAL, |