* [PULL 1/9] migration/colo: Minor fix for colo error message
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
@ 2024-05-22 22:20 ` Fabiano Rosas
2024-05-22 22:20 ` [PULL 2/9] migration/colo: make colo_incoming_co() return void Fabiano Rosas
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-22 22:20 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Richard Henderson, Li Zhijian, Zhang Chen,
Michael Tokarev
From: Li Zhijian <lizhijian@fujitsu.com>
- Explicitly show the missing module name: replication
- Fix capability name to x-colo
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Suggested-by: Michael Tokarev <mjt@tls.msk.ru>
[fixed mangled author email address]
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/migration.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index e88b24f1e6..995f0ca923 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -513,13 +513,13 @@ void migration_incoming_disable_colo(void)
int migration_incoming_enable_colo(void)
{
#ifndef CONFIG_REPLICATION
- error_report("ENABLE_COLO command come in migration stream, but COLO "
- "module is not built in");
+ error_report("ENABLE_COLO command come in migration stream, but the "
+ "replication module is not built in");
return -ENOTSUP;
#endif
if (!migrate_colo()) {
- error_report("ENABLE_COLO command come in migration stream, but c-colo "
+ error_report("ENABLE_COLO command come in migration stream, but x-colo "
"capability is not set");
return -EINVAL;
}
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 2/9] migration/colo: make colo_incoming_co() return void
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
2024-05-22 22:20 ` [PULL 1/9] migration/colo: Minor fix for colo error message Fabiano Rosas
@ 2024-05-22 22:20 ` Fabiano Rosas
2024-05-22 22:20 ` [PULL 3/9] migration/colo: Tidy up bql_unlock() around bdrv_activate_all() Fabiano Rosas
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-22 22:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Xu, Richard Henderson, Li Zhijian, Zhang Chen
From: Li Zhijian <lizhijian@fujitsu.com>
Currently, it always returns 0, no need to check the return value at all.
In addition, enter colo coroutine only if migration_incoming_colo_enabled()
is true.
Once the destination side enters the COLO* state, the COLO process will
take over the remaining processes until COLO exits.
Cc: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
[fixed mangled author email address]
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
include/migration/colo.h | 2 +-
migration/colo-stubs.c | 3 +--
migration/colo.c | 9 ++-------
migration/migration.c | 6 +++---
4 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/include/migration/colo.h b/include/migration/colo.h
index eaac07f26d..43222ef5ae 100644
--- a/include/migration/colo.h
+++ b/include/migration/colo.h
@@ -49,7 +49,7 @@ void colo_checkpoint_delay_set(void);
*
* Called with BQL locked, may temporary release BQL.
*/
-int coroutine_fn colo_incoming_co(void);
+void coroutine_fn colo_incoming_co(void);
void colo_shutdown(void);
#endif
diff --git a/migration/colo-stubs.c b/migration/colo-stubs.c
index f8c069b739..e22ce65234 100644
--- a/migration/colo-stubs.c
+++ b/migration/colo-stubs.c
@@ -9,9 +9,8 @@ void colo_shutdown(void)
{
}
-int coroutine_fn colo_incoming_co(void)
+void coroutine_fn colo_incoming_co(void)
{
- return 0;
}
void colo_checkpoint_delay_set(void)
diff --git a/migration/colo.c b/migration/colo.c
index e2b450c132..ca37b932ac 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -928,16 +928,13 @@ out:
return NULL;
}
-int coroutine_fn colo_incoming_co(void)
+void coroutine_fn colo_incoming_co(void)
{
MigrationIncomingState *mis = migration_incoming_get_current();
QemuThread th;
assert(bql_locked());
-
- if (!migration_incoming_colo_enabled()) {
- return 0;
- }
+ assert(migration_incoming_colo_enabled());
qemu_thread_create(&th, "COLO incoming", colo_process_incoming_thread,
mis, QEMU_THREAD_JOINABLE);
@@ -953,6 +950,4 @@ int coroutine_fn colo_incoming_co(void)
/* We hold the global BQL, so it is safe here */
colo_release_ram_cache();
-
- return 0;
}
diff --git a/migration/migration.c b/migration/migration.c
index 995f0ca923..c004637d29 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -776,9 +776,9 @@ process_incoming_migration_co(void *opaque)
goto fail;
}
- if (colo_incoming_co() < 0) {
- error_setg(&local_err, "colo incoming failed");
- goto fail;
+ if (migration_incoming_colo_enabled()) {
+ /* yield until COLO exit */
+ colo_incoming_co();
}
migration_bh_schedule(process_incoming_migration_bh, mis);
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 3/9] migration/colo: Tidy up bql_unlock() around bdrv_activate_all()
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
2024-05-22 22:20 ` [PULL 1/9] migration/colo: Minor fix for colo error message Fabiano Rosas
2024-05-22 22:20 ` [PULL 2/9] migration/colo: make colo_incoming_co() return void Fabiano Rosas
@ 2024-05-22 22:20 ` Fabiano Rosas
2024-05-22 22:20 ` [PULL 4/9] migration: add "exists" info to load-state-field trace Fabiano Rosas
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-22 22:20 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Richard Henderson, Li Zhijian, Michael Tokarev,
Zhang Chen
From: Li Zhijian <lizhijian@fujitsu.com>
Make the code more tight.
Suggested-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
[fixed mangled author email address]
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/colo.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/migration/colo.c b/migration/colo.c
index ca37b932ac..f96c2ee069 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -837,12 +837,11 @@ static void *colo_process_incoming_thread(void *opaque)
/* Make sure all file formats throw away their mutable metadata */
bql_lock();
bdrv_activate_all(&local_err);
+ bql_unlock();
if (local_err) {
- bql_unlock();
error_report_err(local_err);
return NULL;
}
- bql_unlock();
failover_init_state();
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 4/9] migration: add "exists" info to load-state-field trace
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
` (2 preceding siblings ...)
2024-05-22 22:20 ` [PULL 3/9] migration/colo: Tidy up bql_unlock() around bdrv_activate_all() Fabiano Rosas
@ 2024-05-22 22:20 ` Fabiano Rosas
2024-05-22 22:20 ` [PULL 5/9] migration: fix a typo Fabiano Rosas
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-22 22:20 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Richard Henderson, Marc-André Lureau, Fiona Ebner
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/trace-events | 2 +-
migration/vmstate.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/migration/trace-events b/migration/trace-events
index d0c44c3853..0b7c3324fb 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -58,7 +58,7 @@ postcopy_page_req_sync(void *host_addr) "sync page req %p"
vmstate_load_field_error(const char *field, int ret) "field \"%s\" load failed, ret = %d"
vmstate_load_state(const char *name, int version_id) "%s v%d"
vmstate_load_state_end(const char *name, const char *reason, int val) "%s %s/%d"
-vmstate_load_state_field(const char *name, const char *field) "%s:%s"
+vmstate_load_state_field(const char *name, const char *field, bool exists) "%s:%s exists=%d"
vmstate_n_elems(const char *name, int n_elems) "%s: %d"
vmstate_subsection_load(const char *parent) "%s"
vmstate_subsection_load_bad(const char *parent, const char *sub, const char *sub2) "%s: %s/%s"
diff --git a/migration/vmstate.c b/migration/vmstate.c
index ef26f26ccd..b51212a75b 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -128,8 +128,9 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
}
}
while (field->name) {
- trace_vmstate_load_state_field(vmsd->name, field->name);
- if (vmstate_field_exists(vmsd, field, opaque, version_id)) {
+ bool exists = vmstate_field_exists(vmsd, field, opaque, version_id);
+ trace_vmstate_load_state_field(vmsd->name, field->name, exists);
+ if (exists) {
void *first_elem = opaque + field->offset;
int i, n_elems = vmstate_n_elems(opaque, field);
int size = vmstate_size(opaque, field);
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 5/9] migration: fix a typo
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
` (3 preceding siblings ...)
2024-05-22 22:20 ` [PULL 4/9] migration: add "exists" info to load-state-field trace Fabiano Rosas
@ 2024-05-22 22:20 ` Fabiano Rosas
2024-05-22 22:20 ` [PULL 6/9] virtio-gpu: fix v2 migration Fabiano Rosas
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-22 22:20 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Richard Henderson, Marc-André Lureau, Fiona Ebner
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/vmstate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/vmstate.c b/migration/vmstate.c
index b51212a75b..ff5d589a6d 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -479,7 +479,7 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
len = qemu_peek_byte(f, 1);
if (len < strlen(vmsd->name) + 1) {
- /* subsection name has be be "section_name/a" */
+ /* subsection name has to be "section_name/a" */
trace_vmstate_subsection_load_bad(vmsd->name, "(short)", "");
return 0;
}
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 6/9] virtio-gpu: fix v2 migration
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
` (4 preceding siblings ...)
2024-05-22 22:20 ` [PULL 5/9] migration: fix a typo Fabiano Rosas
@ 2024-05-22 22:20 ` Fabiano Rosas
2024-05-29 10:50 ` Fiona Ebner
2024-05-22 22:20 ` [PULL 7/9] hw/core/machine: move compatibility flags for VirtIO-net USO to machine 8.1 Fabiano Rosas
` (3 subsequent siblings)
9 siblings, 1 reply; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-22 22:20 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Xu, Richard Henderson, Marc-André Lureau, Fiona Ebner
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Commit dfcf74fa ("virtio-gpu: fix scanout migration post-load") broke
forward/backward version migration. Versioning of nested VMSD structures
is not straightforward, as the wire format doesn't have nested
structures versions. Introduce x-scanout-vmstate-version and a field
test to save/load appropriately according to the machine version.
Fixes: dfcf74fa ("virtio-gpu: fix scanout migration post-load")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
[fixed long lines]
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
hw/core/machine.c | 1 +
hw/display/virtio-gpu.c | 30 ++++++++++++++++++++++--------
include/hw/virtio/virtio-gpu.h | 1 +
3 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index c7ceb11501..8d6dc69f0e 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -42,6 +42,7 @@ GlobalProperty hw_compat_8_2[] = {
{ "migration", "zero-page-detection", "legacy"},
{ TYPE_VIRTIO_IOMMU_PCI, "granule", "4k" },
{ TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "64" },
+ { "virtio-gpu-device", "x-scanout-vmstate-version", "1" },
};
const size_t hw_compat_8_2_len = G_N_ELEMENTS(hw_compat_8_2);
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index ae831b6b3e..d60b1b2973 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1166,10 +1166,17 @@ static void virtio_gpu_cursor_bh(void *opaque)
virtio_gpu_handle_cursor(&g->parent_obj.parent_obj, g->cursor_vq);
}
+static bool scanout_vmstate_after_v2(void *opaque, int version)
+{
+ struct VirtIOGPUBase *base = container_of(opaque, VirtIOGPUBase, scanout);
+ struct VirtIOGPU *gpu = container_of(base, VirtIOGPU, parent_obj);
+
+ return gpu->scanout_vmstate_version >= 2;
+}
+
static const VMStateDescription vmstate_virtio_gpu_scanout = {
.name = "virtio-gpu-one-scanout",
- .version_id = 2,
- .minimum_version_id = 1,
+ .version_id = 1,
.fields = (const VMStateField[]) {
VMSTATE_UINT32(resource_id, struct virtio_gpu_scanout),
VMSTATE_UINT32(width, struct virtio_gpu_scanout),
@@ -1181,12 +1188,18 @@ static const VMStateDescription vmstate_virtio_gpu_scanout = {
VMSTATE_UINT32(cursor.hot_y, struct virtio_gpu_scanout),
VMSTATE_UINT32(cursor.pos.x, struct virtio_gpu_scanout),
VMSTATE_UINT32(cursor.pos.y, struct virtio_gpu_scanout),
- VMSTATE_UINT32_V(fb.format, struct virtio_gpu_scanout, 2),
- VMSTATE_UINT32_V(fb.bytes_pp, struct virtio_gpu_scanout, 2),
- VMSTATE_UINT32_V(fb.width, struct virtio_gpu_scanout, 2),
- VMSTATE_UINT32_V(fb.height, struct virtio_gpu_scanout, 2),
- VMSTATE_UINT32_V(fb.stride, struct virtio_gpu_scanout, 2),
- VMSTATE_UINT32_V(fb.offset, struct virtio_gpu_scanout, 2),
+ VMSTATE_UINT32_TEST(fb.format, struct virtio_gpu_scanout,
+ scanout_vmstate_after_v2),
+ VMSTATE_UINT32_TEST(fb.bytes_pp, struct virtio_gpu_scanout,
+ scanout_vmstate_after_v2),
+ VMSTATE_UINT32_TEST(fb.width, struct virtio_gpu_scanout,
+ scanout_vmstate_after_v2),
+ VMSTATE_UINT32_TEST(fb.height, struct virtio_gpu_scanout,
+ scanout_vmstate_after_v2),
+ VMSTATE_UINT32_TEST(fb.stride, struct virtio_gpu_scanout,
+ scanout_vmstate_after_v2),
+ VMSTATE_UINT32_TEST(fb.offset, struct virtio_gpu_scanout,
+ scanout_vmstate_after_v2),
VMSTATE_END_OF_LIST()
},
};
@@ -1659,6 +1672,7 @@ static Property virtio_gpu_properties[] = {
DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags,
VIRTIO_GPU_FLAG_BLOB_ENABLED, false),
DEFINE_PROP_SIZE("hostmem", VirtIOGPU, parent_obj.conf.hostmem, 0),
+ DEFINE_PROP_UINT8("x-scanout-vmstate-version", VirtIOGPU, scanout_vmstate_version, 2),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 56d6e821bf..7a59379f5a 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -177,6 +177,7 @@ typedef struct VGPUDMABuf {
struct VirtIOGPU {
VirtIOGPUBase parent_obj;
+ uint8_t scanout_vmstate_version;
uint64_t conf_max_hostmem;
VirtQueue *ctrl_vq;
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PULL 6/9] virtio-gpu: fix v2 migration
2024-05-22 22:20 ` [PULL 6/9] virtio-gpu: fix v2 migration Fabiano Rosas
@ 2024-05-29 10:50 ` Fiona Ebner
2024-05-29 13:26 ` Fabiano Rosas
0 siblings, 1 reply; 13+ messages in thread
From: Fiona Ebner @ 2024-05-29 10:50 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel
Cc: Peter Xu, Richard Henderson, Marc-André Lureau, qemu-stable
CC-ing stable, because this already is an issue in 9.0.0
Am 23.05.24 um 00:20 schrieb Fabiano Rosas:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Commit dfcf74fa ("virtio-gpu: fix scanout migration post-load") broke
> forward/backward version migration. Versioning of nested VMSD structures
> is not straightforward, as the wire format doesn't have nested
> structures versions. Introduce x-scanout-vmstate-version and a field
> test to save/load appropriately according to the machine version.
>
> Fixes: dfcf74fa ("virtio-gpu: fix scanout migration post-load")
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
> Tested-by: Fiona Ebner <f.ebner@proxmox.com>
> [fixed long lines]
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> hw/core/machine.c | 1 +
> hw/display/virtio-gpu.c | 30 ++++++++++++++++++++++--------
> include/hw/virtio/virtio-gpu.h | 1 +
> 3 files changed, 24 insertions(+), 8 deletions(-)
>
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index c7ceb11501..8d6dc69f0e 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -42,6 +42,7 @@ GlobalProperty hw_compat_8_2[] = {
> { "migration", "zero-page-detection", "legacy"},
> { TYPE_VIRTIO_IOMMU_PCI, "granule", "4k" },
> { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "64" },
> + { "virtio-gpu-device", "x-scanout-vmstate-version", "1" },
> };
> const size_t hw_compat_8_2_len = G_N_ELEMENTS(hw_compat_8_2);
>
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index ae831b6b3e..d60b1b2973 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -1166,10 +1166,17 @@ static void virtio_gpu_cursor_bh(void *opaque)
> virtio_gpu_handle_cursor(&g->parent_obj.parent_obj, g->cursor_vq);
> }
>
> +static bool scanout_vmstate_after_v2(void *opaque, int version)
> +{
> + struct VirtIOGPUBase *base = container_of(opaque, VirtIOGPUBase, scanout);
> + struct VirtIOGPU *gpu = container_of(base, VirtIOGPU, parent_obj);
> +
> + return gpu->scanout_vmstate_version >= 2;
> +}
> +
> static const VMStateDescription vmstate_virtio_gpu_scanout = {
> .name = "virtio-gpu-one-scanout",
> - .version_id = 2,
> - .minimum_version_id = 1,
> + .version_id = 1,
> .fields = (const VMStateField[]) {
> VMSTATE_UINT32(resource_id, struct virtio_gpu_scanout),
> VMSTATE_UINT32(width, struct virtio_gpu_scanout),
> @@ -1181,12 +1188,18 @@ static const VMStateDescription vmstate_virtio_gpu_scanout = {
> VMSTATE_UINT32(cursor.hot_y, struct virtio_gpu_scanout),
> VMSTATE_UINT32(cursor.pos.x, struct virtio_gpu_scanout),
> VMSTATE_UINT32(cursor.pos.y, struct virtio_gpu_scanout),
> - VMSTATE_UINT32_V(fb.format, struct virtio_gpu_scanout, 2),
> - VMSTATE_UINT32_V(fb.bytes_pp, struct virtio_gpu_scanout, 2),
> - VMSTATE_UINT32_V(fb.width, struct virtio_gpu_scanout, 2),
> - VMSTATE_UINT32_V(fb.height, struct virtio_gpu_scanout, 2),
> - VMSTATE_UINT32_V(fb.stride, struct virtio_gpu_scanout, 2),
> - VMSTATE_UINT32_V(fb.offset, struct virtio_gpu_scanout, 2),
> + VMSTATE_UINT32_TEST(fb.format, struct virtio_gpu_scanout,
> + scanout_vmstate_after_v2),
> + VMSTATE_UINT32_TEST(fb.bytes_pp, struct virtio_gpu_scanout,
> + scanout_vmstate_after_v2),
> + VMSTATE_UINT32_TEST(fb.width, struct virtio_gpu_scanout,
> + scanout_vmstate_after_v2),
> + VMSTATE_UINT32_TEST(fb.height, struct virtio_gpu_scanout,
> + scanout_vmstate_after_v2),
> + VMSTATE_UINT32_TEST(fb.stride, struct virtio_gpu_scanout,
> + scanout_vmstate_after_v2),
> + VMSTATE_UINT32_TEST(fb.offset, struct virtio_gpu_scanout,
> + scanout_vmstate_after_v2),
> VMSTATE_END_OF_LIST()
> },
> };
> @@ -1659,6 +1672,7 @@ static Property virtio_gpu_properties[] = {
> DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags,
> VIRTIO_GPU_FLAG_BLOB_ENABLED, false),
> DEFINE_PROP_SIZE("hostmem", VirtIOGPU, parent_obj.conf.hostmem, 0),
> + DEFINE_PROP_UINT8("x-scanout-vmstate-version", VirtIOGPU, scanout_vmstate_version, 2),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index 56d6e821bf..7a59379f5a 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -177,6 +177,7 @@ typedef struct VGPUDMABuf {
> struct VirtIOGPU {
> VirtIOGPUBase parent_obj;
>
> + uint8_t scanout_vmstate_version;
> uint64_t conf_max_hostmem;
>
> VirtQueue *ctrl_vq;
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PULL 6/9] virtio-gpu: fix v2 migration
2024-05-29 10:50 ` Fiona Ebner
@ 2024-05-29 13:26 ` Fabiano Rosas
0 siblings, 0 replies; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-29 13:26 UTC (permalink / raw)
To: Fiona Ebner, qemu-devel
Cc: Peter Xu, Richard Henderson, Marc-André Lureau, qemu-stable
Fiona Ebner <f.ebner@proxmox.com> writes:
> CC-ing stable, because this already is an issue in 9.0.0
>
Thank you for pointing this out. I was expecting b4 to find the tag, but
I just now noticed that the CC was added by Peter as a reply to the
message and not originally via the patch headers, so I should have added
it manually.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PULL 7/9] hw/core/machine: move compatibility flags for VirtIO-net USO to machine 8.1
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
` (5 preceding siblings ...)
2024-05-22 22:20 ` [PULL 6/9] virtio-gpu: fix v2 migration Fabiano Rosas
@ 2024-05-22 22:20 ` Fabiano Rosas
2024-05-22 22:20 ` [PULL 8/9] tests/qtest/migration-test: Run some basic tests on s390x and ppc64 with TCG, too Fabiano Rosas
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-22 22:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Xu, Richard Henderson, Fiona Ebner, Jason Wang
From: Fiona Ebner <f.ebner@proxmox.com>
Migration from an 8.2 or 9.0 binary to an 8.1 binary with machine
version 8.1 can fail with:
> kvm: Features 0x1c0010130afffa7 unsupported. Allowed features: 0x10179bfffe7
> kvm: Failed to load virtio-net:virtio
> kvm: error while loading state for instance 0x0 of device '0000:00:12.0/virtio-net'
> kvm: load of migration failed: Operation not permitted
The series
53da8b5a99 virtio-net: Add support for USO features
9da1684954 virtio-net: Add USO flags to vhost support.
f03e0cf63b tap: Add check for USO features
2ab0ec3121 tap: Add USO support to tap device.
only landed in QEMU 8.2, so the compatibility flags should be part of
machine version 8.1.
Moving the flags unfortunately breaks forward migration with machine
version 8.1 from a binary without this patch to a binary with this
patch.
Fixes: 53da8b5a99 ("virtio-net: Add support for USO features")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
hw/core/machine.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 8d6dc69f0e..f5dffea33d 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -51,15 +51,15 @@ GlobalProperty hw_compat_8_1[] = {
{ "ramfb", "x-migrate", "off" },
{ "vfio-pci-nohotplug", "x-ramfb-migrate", "off" },
{ "igb", "x-pcie-flr-init", "off" },
+ { TYPE_VIRTIO_NET, "host_uso", "off"},
+ { TYPE_VIRTIO_NET, "guest_uso4", "off"},
+ { TYPE_VIRTIO_NET, "guest_uso6", "off"},
};
const size_t hw_compat_8_1_len = G_N_ELEMENTS(hw_compat_8_1);
GlobalProperty hw_compat_8_0[] = {
{ "migration", "multifd-flush-after-each-section", "on"},
{ TYPE_PCI_DEVICE, "x-pcie-ari-nextfn-1", "on" },
- { TYPE_VIRTIO_NET, "host_uso", "off"},
- { TYPE_VIRTIO_NET, "guest_uso4", "off"},
- { TYPE_VIRTIO_NET, "guest_uso6", "off"},
};
const size_t hw_compat_8_0_len = G_N_ELEMENTS(hw_compat_8_0);
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 8/9] tests/qtest/migration-test: Run some basic tests on s390x and ppc64 with TCG, too
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
` (6 preceding siblings ...)
2024-05-22 22:20 ` [PULL 7/9] hw/core/machine: move compatibility flags for VirtIO-net USO to machine 8.1 Fabiano Rosas
@ 2024-05-22 22:20 ` Fabiano Rosas
2024-05-22 22:20 ` [PULL 9/9] tests/qtest/migration-test: Fix the check for a successful run of analyze-migration.py Fabiano Rosas
2024-05-23 2:02 ` [PULL 0/9] Migration patches for 2024-05-22 Richard Henderson
9 siblings, 0 replies; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-22 22:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Xu, Richard Henderson, Thomas Huth
From: Thomas Huth <thuth@redhat.com>
On s390x, we recently had a regression that broke migration / savevm
(see commit bebe9603fc ("hw/intc/s390_flic: Fix crash that occurs when
saving the machine state"). The problem was merged without being noticed
since we currently do not run any migration / savevm related tests on
x86 hosts.
While we currently cannot run all migration tests for the s390x target
on x86 hosts yet (due to some unresolved issues with TCG), we can at
least run some of the non-live tests to avoid such problems in the future.
Thus enable the "analyze-script" and the "bad_dest" tests before checking
for KVM on s390x or ppc64 (this also fixes the problem that the
"analyze-script" test was not run on s390x at all anymore since it got
disabled again by accident in a previous refactoring of the code).
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/migration-test.c | 39 ++++++++++++++++++------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index e8d3555f56..5b4eca2b20 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -3437,6 +3437,20 @@ int main(int argc, char **argv)
arch = qtest_get_arch();
is_x86 = !strcmp(arch, "i386") || !strcmp(arch, "x86_64");
+ tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err);
+ if (!tmpfs) {
+ g_test_message("Can't create temporary directory in %s: %s",
+ g_get_tmp_dir(), err->message);
+ }
+ g_assert(tmpfs);
+
+ module_call_init(MODULE_INIT_QOM);
+
+ migration_test_add("/migration/bad_dest", test_baddest);
+#ifndef _WIN32
+ migration_test_add("/migration/analyze-script", test_analyze_script);
+#endif
+
/*
* On ppc64, the test only works with kvm-hv, but not with kvm-pr and TCG
* is touchy due to race conditions on dirty bits (especially on PPC for
@@ -3444,8 +3458,8 @@ int main(int argc, char **argv)
*/
if (g_str_equal(arch, "ppc64") &&
(!has_kvm || access("/sys/module/kvm_hv", F_OK))) {
- g_test_message("Skipping test: kvm_hv not available");
- return g_test_run();
+ g_test_message("Skipping tests: kvm_hv not available");
+ goto test_add_done;
}
/*
@@ -3453,19 +3467,10 @@ int main(int argc, char **argv)
* there until the problems are resolved
*/
if (g_str_equal(arch, "s390x") && !has_kvm) {
- g_test_message("Skipping test: s390x host with KVM is required");
- return g_test_run();
+ g_test_message("Skipping tests: s390x host with KVM is required");
+ goto test_add_done;
}
- tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err);
- if (!tmpfs) {
- g_test_message("Can't create temporary directory in %s: %s",
- g_get_tmp_dir(), err->message);
- }
- g_assert(tmpfs);
-
- module_call_init(MODULE_INIT_QOM);
-
if (is_x86) {
migration_test_add("/migration/precopy/unix/suspend/live",
test_precopy_unix_suspend_live);
@@ -3491,12 +3496,6 @@ int main(int argc, char **argv)
}
}
- migration_test_add("/migration/bad_dest", test_baddest);
-#ifndef _WIN32
- if (!g_str_equal(arch, "s390x")) {
- migration_test_add("/migration/analyze-script", test_analyze_script);
- }
-#endif
migration_test_add("/migration/precopy/unix/plain",
test_precopy_unix_plain);
migration_test_add("/migration/precopy/unix/xbzrle",
@@ -3653,6 +3652,8 @@ int main(int argc, char **argv)
test_vcpu_dirty_limit);
}
+test_add_done:
+
ret = g_test_run();
g_assert_cmpint(ret, ==, 0);
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 9/9] tests/qtest/migration-test: Fix the check for a successful run of analyze-migration.py
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
` (7 preceding siblings ...)
2024-05-22 22:20 ` [PULL 8/9] tests/qtest/migration-test: Run some basic tests on s390x and ppc64 with TCG, too Fabiano Rosas
@ 2024-05-22 22:20 ` Fabiano Rosas
2024-05-23 2:02 ` [PULL 0/9] Migration patches for 2024-05-22 Richard Henderson
9 siblings, 0 replies; 13+ messages in thread
From: Fabiano Rosas @ 2024-05-22 22:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Xu, Richard Henderson, Thomas Huth
From: Thomas Huth <thuth@redhat.com>
If analyze-migration.py cannot be run or crashes, the error is currently
ignored since the code only checks for nonzero values in case the child
exited properly. For example, if you run the test with a non-existing
Python interpreter, it still succeeds:
$ PYTHON=wrongpython QTEST_QEMU_BINARY=./qemu-system-x86_64 tests/qtest/migration-test
...
# Running /x86_64/migration/analyze-script
# Using machine type: pc-q35-9.1
# starting QEMU: exec ./qemu-system-x86_64 -qtest unix:/tmp/qtest-417639.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-417639.qmp,id=char0 -mon chardev=char0,mode=control -display none -audio none -accel kvm -accel tcg -machine pc-q35-9.1, -name source,debug-threads=on -m 150M -serial file:/tmp/migration-test-XPLUN2/src_serial -drive if=none,id=d0,file=/tmp/migration-test-XPLUN2/bootsect,format=raw -device ide-hd,drive=d0,secs=1,cyls=1,heads=1 -uuid 11111111-1111-1111-1111-111111111111 -accel qtest
# starting QEMU: exec ./qemu-system-x86_64 -qtest unix:/tmp/qtest-417639.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-417639.qmp,id=char0 -mon chardev=char0,mode=control -display none -audio none -accel kvm -accel tcg -machine pc-q35-9.1, -name target,debug-threads=on -m 150M -serial file:/tmp/migration-test-XPLUN2/dest_serial -incoming tcp:127.0.0.1:0 -drive if=none,id=d0,file=/tmp/migration-test-XPLUN2/bootsect,format=raw -device ide-hd,drive=d0,secs=1,cyls=1,heads=1 -accel qtest
**
ERROR:../../devel/qemu/tests/qtest/migration-test.c:1603:test_analyze_script: code should not be reached
migration-test: ../../devel/qemu/tests/qtest/libqtest.c:240: qtest_wait_qemu: Assertion `pid == s->qemu_pid' failed.
migration-test: ../../devel/qemu/tests/qtest/libqtest.c:240: qtest_wait_qemu: Assertion `pid == s->qemu_pid' failed.
ok 2 /x86_64/migration/analyze-script
...
Let's better fail the test in case the child did not exit properly, too.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/migration-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 5b4eca2b20..b7e3406471 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -1604,7 +1604,7 @@ static void test_analyze_script(void)
}
g_assert(waitpid(pid, &wstatus, 0) == pid);
- if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) != 0) {
+ if (!WIFEXITED(wstatus) || WEXITSTATUS(wstatus) != 0) {
g_test_message("Failed to analyze the migration stream");
g_test_fail();
}
--
2.35.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PULL 0/9] Migration patches for 2024-05-22
2024-05-22 22:20 [PULL 0/9] Migration patches for 2024-05-22 Fabiano Rosas
` (8 preceding siblings ...)
2024-05-22 22:20 ` [PULL 9/9] tests/qtest/migration-test: Fix the check for a successful run of analyze-migration.py Fabiano Rosas
@ 2024-05-23 2:02 ` Richard Henderson
9 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2024-05-23 2:02 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel; +Cc: Peter Xu
On 5/22/24 15:20, Fabiano Rosas wrote:
> The following changes since commit 01782d6b294f95bcde334386f0aaac593cd28c0d:
>
> Merge tag 'hw-misc-20240517' ofhttps://github.com/philmd/qemu into staging (2024-05-18 11:49:01 +0200)
>
> are available in the Git repository at:
>
> https://gitlab.com/farosas/qemu.git tags/migration-20240522-pull-request
>
> for you to fetch changes up to 8f023a0bd946bb0c122543c64fe2b34bad0dd048:
>
> tests/qtest/migration-test: Fix the check for a successful run of analyze-migration.py (2024-05-22 17:34:41 -0300)
>
> ----------------------------------------------------------------
> Migration pull request
>
> - Li Zhijian's COLO minor fixes
> - Marc-André's virtio-gpu fix
> - Fiona's virtio-net USO fix
> - A couple of migration-test fixes from Thomas
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/9.1 as appropriate.
r~
^ permalink raw reply [flat|nested] 13+ messages in thread