diff options
author | Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> | 2016-03-14 10:45:10 +0300 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-03-30 12:15:57 +0200 |
commit | 63785678f3941c84be01d3ab7867e2742ea9fe3e (patch) | |
tree | 789d6d22b463e23ea5737ce9036c8160eccfab1a /replay/replay-events.c | |
parent | 95b4aed5fd0bec00e2c3f754c86fec5ba7a83a20 (diff) | |
download | qemu-63785678f3941c84be01d3ab7867e2742ea9fe3e.tar.gz qemu-63785678f3941c84be01d3ab7867e2742ea9fe3e.tar.bz2 qemu-63785678f3941c84be01d3ab7867e2742ea9fe3e.zip |
replay: introduce block devices record/replay
This patch introduces block driver that implement recording
and replaying of block devices' operations.
All block completion operations are added to the queue.
Queue is flushed at checkpoints and information about processed requests
is recorded to the log. In replay phase the queue is matched with
events read from the log. Therefore block devices requests are processed
deterministically.
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
[ kwolf: Rebased onto modified and already applied part of the series ]
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'replay/replay-events.c')
-rw-r--r-- | replay/replay-events.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/replay/replay-events.c b/replay/replay-events.c index 873e435804..3807245ae7 100644 --- a/replay/replay-events.c +++ b/replay/replay-events.c @@ -51,6 +51,9 @@ static void replay_run_event(Event *event) case REPLAY_ASYNC_EVENT_CHAR_READ: replay_event_char_read_run(event->opaque); break; + case REPLAY_ASYNC_EVENT_BLOCK: + aio_bh_call(event->opaque); + break; default: error_report("Replay: invalid async event ID (%d) in the queue", event->event_kind); @@ -153,6 +156,15 @@ void replay_add_input_sync_event(void) replay_add_event(REPLAY_ASYNC_EVENT_INPUT_SYNC, NULL, NULL, 0); } +void replay_block_event(QEMUBH *bh, uint64_t id) +{ + if (replay_mode != REPLAY_MODE_NONE && events_enabled) { + replay_add_event(REPLAY_ASYNC_EVENT_BLOCK, bh, NULL, id); + } else { + qemu_bh_schedule(bh); + } +} + static void replay_save_event(Event *event, int checkpoint) { if (replay_mode != REPLAY_MODE_PLAY) { @@ -174,6 +186,9 @@ static void replay_save_event(Event *event, int checkpoint) case REPLAY_ASYNC_EVENT_CHAR_READ: replay_event_char_read_save(event->opaque); break; + case REPLAY_ASYNC_EVENT_BLOCK: + replay_put_qword(event->id); + break; default: error_report("Unknown ID %" PRId64 " of replay event", event->id); exit(1); @@ -232,6 +247,11 @@ static Event *replay_read_event(int checkpoint) event->event_kind = read_event_kind; event->opaque = replay_event_char_read_load(); return event; + case REPLAY_ASYNC_EVENT_BLOCK: + if (read_id == -1) { + read_id = replay_get_qword(); + } + break; default: error_report("Unknown ID %d of replay event", read_event_kind); exit(1); |