update submodule and patches to QEMU 8.0.0
Many changes were necessary this time around:
* QAPI was changed to avoid redundant has_* variables, see commit
44ea9d9be3 ("qapi: Start to elide redundant has_FOO in generated C")
for details. This affected many QMP commands added by Proxmox too.
* Pending querying for migration got split into two functions, one to
estimate, one for exact value, see commit c8df4a7aef ("migration:
Split save_live_pending() into state_pending_*") for details. Relevant
for savevm-async and PBS dirty bitmap.
* Some block (driver) functions got converted to coroutines, so the
Proxmox block drivers needed to be adapted.
* Alloc track auto-detaching during PBS live restore got broken by
AioContext-related changes resulting in a deadlock. The current, hacky
method was replaced by a simpler one. Stefan apparently ran into a
problem with that when he wrote the driver, but there were
improvements in the stream job code since then and I didn't manage to
reproduce the issue. It's a separate patch "alloc-track: fix deadlock
during drop" for now, you can find the details there.
* Async snapshot-related changes:
- The pending querying got adapted to the above-mentioned split and
a patch is added to optimize it/make it more similar to what
upstream code does.
- Added initialization of the compression counters (for
future-proofing).
- It's necessary the hold the BQL (big QEMU lock = iothread mutex)
during the setup phase, because block layer functions are used there
and not doing so leads to racy, hard-to-debug crashes or hangs. It's
necessary to change some upstream code too for this, a version of
the patch "migration: for snapshots, hold the BQL during setup
callbacks" is intended to be upstreamed.
- Need to take the bdrv graph read lock before flushing.
* hmp_info_balloon was moved to a different file.
* Needed to include a new headers from time to time to still get the
correct functions.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
fb818ea5b9
commit
bf251437e9
+52
-49
@@ -25,7 +25,8 @@ Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
||||
[FE: further improve aborting
|
||||
adapt to removal of QEMUFileOps
|
||||
improve condition for entering final stage]
|
||||
improve condition for entering final stage
|
||||
adapt to QAPI and other changes for 8.0]
|
||||
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||
---
|
||||
hmp-commands-info.hx | 13 +
|
||||
@@ -33,17 +34,17 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||
include/migration/snapshot.h | 2 +
|
||||
include/monitor/hmp.h | 5 +
|
||||
migration/meson.build | 1 +
|
||||
migration/savevm-async.c | 538 +++++++++++++++++++++++++++++++++++
|
||||
monitor/hmp-cmds.c | 57 ++++
|
||||
migration/savevm-async.c | 535 +++++++++++++++++++++++++++++++++++
|
||||
monitor/hmp-cmds.c | 58 ++++
|
||||
qapi/migration.json | 34 +++
|
||||
qapi/misc.json | 32 +++
|
||||
qemu-options.hx | 12 +
|
||||
softmmu/vl.c | 10 +
|
||||
11 files changed, 737 insertions(+)
|
||||
11 files changed, 735 insertions(+)
|
||||
create mode 100644 migration/savevm-async.c
|
||||
|
||||
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
|
||||
index 754b1e8408..489c524e9e 100644
|
||||
index 47d63d26db..a166bff3d5 100644
|
||||
--- a/hmp-commands-info.hx
|
||||
+++ b/hmp-commands-info.hx
|
||||
@@ -540,6 +540,19 @@ SRST
|
||||
@@ -67,11 +68,11 @@ index 754b1e8408..489c524e9e 100644
|
||||
.name = "balloon",
|
||||
.args_type = "",
|
||||
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
||||
index 673e39a697..039be0033d 100644
|
||||
index bb85ee1d26..b66d7fc4ab 100644
|
||||
--- a/hmp-commands.hx
|
||||
+++ b/hmp-commands.hx
|
||||
@@ -1815,3 +1815,36 @@ SRST
|
||||
Dump the FDT in dtb format to *filename*.
|
||||
@@ -1846,3 +1846,36 @@ SRST
|
||||
List event channels in the guest
|
||||
ERST
|
||||
#endif
|
||||
+
|
||||
@@ -119,10 +120,10 @@ index e72083b117..c846d37806 100644
|
||||
+
|
||||
#endif
|
||||
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
|
||||
index dfbc0c9a2f..440f86aba8 100644
|
||||
index fdb69b7f9c..c012bad741 100644
|
||||
--- a/include/monitor/hmp.h
|
||||
+++ b/include/monitor/hmp.h
|
||||
@@ -27,6 +27,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
|
||||
@@ -28,6 +28,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_uuid(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_chardev(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_mice(Monitor *mon, const QDict *qdict);
|
||||
@@ -130,10 +131,10 @@ index dfbc0c9a2f..440f86aba8 100644
|
||||
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
|
||||
@@ -81,6 +82,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict);
|
||||
void hmp_netdev_del(Monitor *mon, const QDict *qdict);
|
||||
void hmp_getfd(Monitor *mon, const QDict *qdict);
|
||||
void hmp_closefd(Monitor *mon, const QDict *qdict);
|
||||
@@ -94,6 +95,10 @@ void hmp_closefd(Monitor *mon, const QDict *qdict);
|
||||
void hmp_mouse_move(Monitor *mon, const QDict *qdict);
|
||||
void hmp_mouse_button(Monitor *mon, const QDict *qdict);
|
||||
void hmp_mouse_set(Monitor *mon, const QDict *qdict);
|
||||
+void hmp_savevm_start(Monitor *mon, const QDict *qdict);
|
||||
+void hmp_snapshot_drive(Monitor *mon, const QDict *qdict);
|
||||
+void hmp_delete_drive_snapshot(Monitor *mon, const QDict *qdict);
|
||||
@@ -142,23 +143,23 @@ index dfbc0c9a2f..440f86aba8 100644
|
||||
void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict);
|
||||
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
|
||||
diff --git a/migration/meson.build b/migration/meson.build
|
||||
index 8cac83c06c..0842d00cd2 100644
|
||||
index 8a142fc7a9..a7824b5266 100644
|
||||
--- a/migration/meson.build
|
||||
+++ b/migration/meson.build
|
||||
@@ -24,6 +24,7 @@ softmmu_ss.add(files(
|
||||
@@ -25,6 +25,7 @@ softmmu_ss.add(files(
|
||||
'multifd-zlib.c',
|
||||
'postcopy-ram.c',
|
||||
'savevm.c',
|
||||
+ 'savevm-async.c',
|
||||
'socket.c',
|
||||
'tls.c',
|
||||
), gnutls)
|
||||
'threadinfo.c',
|
||||
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
|
||||
new file mode 100644
|
||||
index 0000000000..dc30558713
|
||||
index 0000000000..24660af014
|
||||
--- /dev/null
|
||||
+++ b/migration/savevm-async.c
|
||||
@@ -0,0 +1,538 @@
|
||||
@@ -0,0 +1,535 @@
|
||||
+#include "qemu/osdep.h"
|
||||
+#include "migration/channel-savevm-async.h"
|
||||
+#include "migration/migration.h"
|
||||
@@ -231,24 +232,20 @@ index 0000000000..dc30558713
|
||||
+ info->bytes = s->bs_pos;
|
||||
+ switch (s->state) {
|
||||
+ case SAVE_STATE_ERROR:
|
||||
+ info->has_status = true;
|
||||
+ info->status = g_strdup("failed");
|
||||
+ info->has_total_time = true;
|
||||
+ info->total_time = s->total_time;
|
||||
+ if (s->error) {
|
||||
+ info->has_error = true;
|
||||
+ info->error = g_strdup(error_get_pretty(s->error));
|
||||
+ }
|
||||
+ break;
|
||||
+ case SAVE_STATE_ACTIVE:
|
||||
+ info->has_status = true;
|
||||
+ info->status = g_strdup("active");
|
||||
+ info->has_total_time = true;
|
||||
+ info->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME)
|
||||
+ - s->total_time;
|
||||
+ break;
|
||||
+ case SAVE_STATE_COMPLETED:
|
||||
+ info->has_status = true;
|
||||
+ info->status = g_strdup("completed");
|
||||
+ info->has_total_time = true;
|
||||
+ info->total_time = s->total_time;
|
||||
@@ -405,14 +402,14 @@ index 0000000000..dc30558713
|
||||
+ }
|
||||
+
|
||||
+ while (snap_state.state == SAVE_STATE_ACTIVE) {
|
||||
+ uint64_t pending_size, pend_precopy, pend_compatible, pend_postcopy;
|
||||
+ uint64_t pending_size, pend_precopy, pend_postcopy;
|
||||
+
|
||||
+ /* pending is expected to be called without iothread lock */
|
||||
+ qemu_mutex_unlock_iothread();
|
||||
+ qemu_savevm_state_pending(snap_state.file, 0, &pend_precopy, &pend_compatible, &pend_postcopy);
|
||||
+ qemu_savevm_state_pending_exact(&pend_precopy, &pend_postcopy);
|
||||
+ qemu_mutex_lock_iothread();
|
||||
+
|
||||
+ pending_size = pend_precopy + pend_compatible + pend_postcopy;
|
||||
+ pending_size = pend_precopy + pend_postcopy;
|
||||
+
|
||||
+ /*
|
||||
+ * A guest reaching this cutoff is dirtying lots of RAM. It should be
|
||||
@@ -465,7 +462,9 @@ index 0000000000..dc30558713
|
||||
+ if (bs_ctx != qemu_get_aio_context()) {
|
||||
+ DPRINTF("savevm: async flushing drive %s\n", bs->filename);
|
||||
+ aio_co_reschedule_self(bs_ctx);
|
||||
+ bdrv_graph_co_rdlock();
|
||||
+ bdrv_flush(bs);
|
||||
+ bdrv_graph_co_rdunlock();
|
||||
+ aio_co_reschedule_self(qemu_get_aio_context());
|
||||
+ }
|
||||
+ }
|
||||
@@ -476,7 +475,7 @@ index 0000000000..dc30558713
|
||||
+ qemu_bh_schedule(snap_state.finalize_bh);
|
||||
+}
|
||||
+
|
||||
+void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
|
||||
+void qmp_savevm_start(const char *statefile, Error **errp)
|
||||
+{
|
||||
+ Error *local_err = NULL;
|
||||
+ MigrationState *ms = migrate_get_current();
|
||||
@@ -513,7 +512,7 @@ index 0000000000..dc30558713
|
||||
+ snap_state.error = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (!has_statefile) {
|
||||
+ if (!statefile) {
|
||||
+ vm_stop(RUN_STATE_SAVE_VM);
|
||||
+ snap_state.state = SAVE_STATE_COMPLETED;
|
||||
+ return;
|
||||
@@ -643,8 +642,7 @@ index 0000000000..dc30558713
|
||||
+ Error **errp)
|
||||
+{
|
||||
+ // Compatibility to older qemu-server.
|
||||
+ (void)qmp_blockdev_snapshot_delete_internal_sync(device, false, NULL,
|
||||
+ true, name, errp);
|
||||
+ (void)qmp_blockdev_snapshot_delete_internal_sync(device, NULL, name, errp);
|
||||
+}
|
||||
+
|
||||
+int load_snapshot_from_blockdev(const char *filename, Error **errp)
|
||||
@@ -698,19 +696,28 @@ index 0000000000..dc30558713
|
||||
+ return ret;
|
||||
+}
|
||||
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
||||
index 480b798963..cfebfd1db5 100644
|
||||
index 6c559b48c8..435f9334f9 100644
|
||||
--- a/monitor/hmp-cmds.c
|
||||
+++ b/monitor/hmp-cmds.c
|
||||
@@ -1906,6 +1906,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
|
||||
hmp_handle_error(mon, err);
|
||||
}
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "monitor/monitor-internal.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-control.h"
|
||||
+#include "qapi/qapi-commands-migration.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
@@ -443,3 +444,60 @@ void hmp_info_mtree(Monitor *mon, const QDict *qdict)
|
||||
|
||||
mtree_info(flatview, dispatch_tree, owner, disabled);
|
||||
}
|
||||
+
|
||||
+void hmp_savevm_start(Monitor *mon, const QDict *qdict)
|
||||
+{
|
||||
+ Error *errp = NULL;
|
||||
+ const char *statefile = qdict_get_try_str(qdict, "statefile");
|
||||
+
|
||||
+ qmp_savevm_start(statefile != NULL, statefile, &errp);
|
||||
+ qmp_savevm_start(statefile, &errp);
|
||||
+ hmp_handle_error(mon, errp);
|
||||
+}
|
||||
+
|
||||
@@ -747,7 +754,7 @@ index 480b798963..cfebfd1db5 100644
|
||||
+ SaveVMInfo *info;
|
||||
+ info = qmp_query_savevm(NULL);
|
||||
+
|
||||
+ if (info->has_status) {
|
||||
+ if (info->status) {
|
||||
+ monitor_printf(mon, "savevm status: %s\n", info->status);
|
||||
+ monitor_printf(mon, "total time: %" PRIu64 " milliseconds\n",
|
||||
+ info->total_time);
|
||||
@@ -757,16 +764,12 @@ index 480b798963..cfebfd1db5 100644
|
||||
+ if (info->has_bytes) {
|
||||
+ monitor_printf(mon, "Bytes saved: %"PRIu64"\n", info->bytes);
|
||||
+ }
|
||||
+ if (info->has_error) {
|
||||
+ if (info->error) {
|
||||
+ monitor_printf(mon, "Error: %s\n", info->error);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void hmp_info_iothreads(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
IOThreadInfoList *info_list = qmp_query_iothreads(NULL);
|
||||
diff --git a/qapi/migration.json b/qapi/migration.json
|
||||
index 88ecf86ac8..4435866379 100644
|
||||
index c84fa10e86..1702b92553 100644
|
||||
--- a/qapi/migration.json
|
||||
+++ b/qapi/migration.json
|
||||
@@ -261,6 +261,40 @@
|
||||
@@ -811,10 +814,10 @@ index 88ecf86ac8..4435866379 100644
|
||||
# @query-migrate:
|
||||
#
|
||||
diff --git a/qapi/misc.json b/qapi/misc.json
|
||||
index 27ef5a2b20..b3ce75dcae 100644
|
||||
index 6ddd16ea28..098c9bbe93 100644
|
||||
--- a/qapi/misc.json
|
||||
+++ b/qapi/misc.json
|
||||
@@ -435,6 +435,38 @@
|
||||
@@ -469,6 +469,38 @@
|
||||
##
|
||||
{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
|
||||
|
||||
@@ -854,10 +857,10 @@ index 27ef5a2b20..b3ce75dcae 100644
|
||||
# @CommandLineParameterType:
|
||||
#
|
||||
diff --git a/qemu-options.hx b/qemu-options.hx
|
||||
index 7f99d15b23..54efb127c4 100644
|
||||
index 59bdf67a2c..fc6cb23dd9 100644
|
||||
--- a/qemu-options.hx
|
||||
+++ b/qemu-options.hx
|
||||
@@ -4391,6 +4391,18 @@ SRST
|
||||
@@ -4378,6 +4378,18 @@ SRST
|
||||
Start right away with a saved state (``loadvm`` in monitor)
|
||||
ERST
|
||||
|
||||
@@ -877,7 +880,7 @@ index 7f99d15b23..54efb127c4 100644
|
||||
DEF("daemonize", 0, QEMU_OPTION_daemonize, \
|
||||
"-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
|
||||
diff --git a/softmmu/vl.c b/softmmu/vl.c
|
||||
index 5f7f6ca981..21f067d115 100644
|
||||
index ea20b23e4c..0eabc71b68 100644
|
||||
--- a/softmmu/vl.c
|
||||
+++ b/softmmu/vl.c
|
||||
@@ -164,6 +164,7 @@ static const char *accelerators;
|
||||
@@ -888,7 +891,7 @@ index 5f7f6ca981..21f067d115 100644
|
||||
static QTAILQ_HEAD(, ObjectOption) object_opts = QTAILQ_HEAD_INITIALIZER(object_opts);
|
||||
static QTAILQ_HEAD(, DeviceOption) device_opts = QTAILQ_HEAD_INITIALIZER(device_opts);
|
||||
static int display_remote;
|
||||
@@ -2607,6 +2608,12 @@ void qmp_x_exit_preconfig(Error **errp)
|
||||
@@ -2612,6 +2613,12 @@ void qmp_x_exit_preconfig(Error **errp)
|
||||
|
||||
if (loadvm) {
|
||||
load_snapshot(loadvm, NULL, false, NULL, &error_fatal);
|
||||
@@ -901,7 +904,7 @@ index 5f7f6ca981..21f067d115 100644
|
||||
}
|
||||
if (replay_mode != REPLAY_MODE_NONE) {
|
||||
replay_vmstate_init();
|
||||
@@ -3151,6 +3158,9 @@ void qemu_init(int argc, char **argv)
|
||||
@@ -3159,6 +3166,9 @@ void qemu_init(int argc, char **argv)
|
||||
case QEMU_OPTION_loadvm:
|
||||
loadvm = optarg;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user