mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
replay: checkpoints
This patch introduces checkpoints that synchronize cpu thread and iothread. When checkpoint is met in the code all asynchronous events from the queue are executed. Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru> Message-Id: <20150917162444.8676.52916.stgit@PASHA-ISP.def.inno> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
This commit is contained in:
parent
efab87cf79
commit
8bd7f71d79
7 changed files with 134 additions and 12 deletions
|
|
@ -29,6 +29,10 @@ enum ReplayEvents {
|
|||
/* some of greater codes are reserved for clocks */
|
||||
EVENT_CLOCK,
|
||||
EVENT_CLOCK_LAST = EVENT_CLOCK + REPLAY_CLOCK_COUNT - 1,
|
||||
/* for checkpoint event */
|
||||
/* some of greater codes are reserved for checkpoints */
|
||||
EVENT_CHECKPOINT,
|
||||
EVENT_CHECKPOINT_LAST = EVENT_CHECKPOINT + CHECKPOINT_COUNT - 1,
|
||||
EVENT_COUNT
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -160,3 +160,37 @@ void replay_shutdown_request(void)
|
|||
replay_mutex_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool replay_checkpoint(ReplayCheckpoint checkpoint)
|
||||
{
|
||||
bool res = false;
|
||||
assert(EVENT_CHECKPOINT + checkpoint <= EVENT_CHECKPOINT_LAST);
|
||||
replay_save_instructions();
|
||||
|
||||
if (!replay_file) {
|
||||
return true;
|
||||
}
|
||||
|
||||
replay_mutex_lock();
|
||||
|
||||
if (replay_mode == REPLAY_MODE_PLAY) {
|
||||
if (replay_next_event_is(EVENT_CHECKPOINT + checkpoint)) {
|
||||
replay_finish_event();
|
||||
} else if (replay_data_kind != EVENT_ASYNC) {
|
||||
res = false;
|
||||
goto out;
|
||||
}
|
||||
replay_read_events(checkpoint);
|
||||
/* replay_read_events may leave some unread events.
|
||||
Return false if not all of the events associated with
|
||||
checkpoint were processed */
|
||||
res = replay_data_kind != EVENT_ASYNC;
|
||||
} else if (replay_mode == REPLAY_MODE_RECORD) {
|
||||
replay_put_event(EVENT_CHECKPOINT + checkpoint);
|
||||
replay_save_events(checkpoint);
|
||||
res = true;
|
||||
}
|
||||
out:
|
||||
replay_mutex_unlock();
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue