[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 06/26] replay: fix save/load vm for non-empty qu
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [RFC PATCH 06/26] replay: fix save/load vm for non-empty queue |
Date: |
Tue, 31 Oct 2017 14:25:31 +0300 |
User-agent: |
StGit/0.17.1-dirty |
This patch does not allows saving/loading vmstate when
replay events queue is not empty. There is no reliable
way to save events queue, because it describes internal
coroutine state. Therefore saving and loading operations
should be deferred to another record/replay step.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
include/sysemu/replay.h | 3 +++
migration/savevm.c | 13 +++++++++++++
replay/replay-snapshot.c | 6 ++++++
3 files changed, 22 insertions(+)
diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
index fa14d0e..b86d6bb 100644
--- a/include/sysemu/replay.h
+++ b/include/sysemu/replay.h
@@ -165,5 +165,8 @@ void replay_audio_in(int *recorded, void *samples, int
*wpos, int size);
/*! Called at the start of execution.
Loads or saves initial vmstate depending on execution mode. */
void replay_vmstate_init(void);
+/*! Called to ensure that replay state is consistent and VM snapshot
+ can be created */
+bool replay_can_snapshot(void);
#endif
diff --git a/migration/savevm.c b/migration/savevm.c
index 4a88228..20cebe1 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -52,6 +52,7 @@
#include "qemu/cutils.h"
#include "io/channel-buffer.h"
#include "io/channel-file.h"
+#include "sysemu/replay.h"
#ifndef ETH_P_RARP
#define ETH_P_RARP 0x8035
@@ -2141,6 +2142,12 @@ int save_snapshot(const char *name, Error **errp)
struct tm tm;
AioContext *aio_context;
+ if (!replay_can_snapshot()) {
+ monitor_printf(mon, "Record/replay does not allow making snapshot "
+ "right now. Try once more later.\n");
+ return ret;
+ }
+
if (!bdrv_all_can_snapshot(&bs)) {
error_setg(errp, "Device '%s' is writable but does not support "
"snapshots", bdrv_get_device_name(bs));
@@ -2310,6 +2317,12 @@ int load_snapshot(const char *name, Error **errp)
AioContext *aio_context;
MigrationIncomingState *mis = migration_incoming_get_current();
+ if (!replay_can_snapshot()) {
+ error_report("Record/replay does not allow loading snapshot "
+ "right now. Try once more later.\n");
+ return -EINVAL;
+ }
+
if (!bdrv_all_can_snapshot(&bs)) {
error_setg(errp,
"Device '%s' is writable but does not support snapshots",
diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
index b2e1076..7075986 100644
--- a/replay/replay-snapshot.c
+++ b/replay/replay-snapshot.c
@@ -83,3 +83,9 @@ void replay_vmstate_init(void)
}
}
}
+
+bool replay_can_snapshot(void)
+{
+ return replay_mode == REPLAY_MODE_NONE
+ || !replay_has_events();
+}
- [Qemu-devel] [RFC PATCH 23/26] util/qemu-thread-*: add qemu_lock, locked and unlock trace events, (continued)
- [Qemu-devel] [RFC PATCH 23/26] util/qemu-thread-*: add qemu_lock, locked and unlock trace events, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 24/26] scripts/analyse-locks-simpletrace.py: script to analyse lock times, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 26/26] scripts/qemu-gdb/timers.py: new helper to dump timer state, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 25/26] scripts/replay-dump.py: replay log dumper, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 00/26] replay additions, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 01/26] block: implement bdrv_snapshot_goto for blkreplay, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 02/26] blkreplay: create temporary overlay for underlaying devices, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 03/26] replay: disable default snapshot for record/replay, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 04/26] replay: fix processing async events, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 05/26] replay: fixed replay_enable_events, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 06/26] replay: fix save/load vm for non-empty queue,
Pavel Dovgalyuk <=
- [Qemu-devel] [RFC PATCH 07/26] replay: added replay log format description, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 08/26] replay: make safe vmstop at record/replay, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 09/26] replay: save prior value of the host clock, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 10/26] icount: fixed saving/restoring of icount warp timers, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 11/26] target/arm/arm-powertctl: drop BQL assertions, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 12/26] cpus: push BQL lock to qemu_*_wait_io_event, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 13/26] cpus: only take BQL for sleeping threads, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 14/26] replay/replay.c: bump REPLAY_VERSION again, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 15/26] replay/replay-internal.c: track holding of replay_lock, Pavel Dovgalyuk, 2017/10/31
- [Qemu-devel] [RFC PATCH 16/26] replay: make locking visible outside replay code, Pavel Dovgalyuk, 2017/10/31