replay: add BH oneshot event for block layer

Replay is capable of recording normal BH events, but sometimes
there are single use callbacks scheduled with aio_bh_schedule_oneshot
function. This patch enables recording and replaying such callbacks.
Block layer uses these events for calling the completion function.
Replaying these calls makes the execution deterministic.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Pavel Dovgalyuk 2019-09-17 14:58:19 +03:00 committed by Kevin Wolf
parent ae25dccb7d
commit e4ec5ad464
13 changed files with 59 additions and 16 deletions

View file

@ -17,6 +17,7 @@
#include "qemu/module.h"
#include "qemu/option.h"
#include "block/block_int.h"
#include "sysemu/replay.h"
#define NULL_OPT_LATENCY "latency-ns"
#define NULL_OPT_ZEROES "read-zeroes"
@ -179,7 +180,8 @@ static inline BlockAIOCB *null_aio_common(BlockDriverState *bs,
timer_mod_ns(&acb->timer,
qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + s->latency_ns);
} else {
aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), null_bh_cb, acb);
replay_bh_schedule_oneshot_event(bdrv_get_aio_context(bs),
null_bh_cb, acb);
}
return &acb->common;
}