Migration regressions with Xen.
v3 cover Migration regressions with Xen.
Hi,
We've spotted several regression which prevent migration with Xen using the same version of QEMU or from a previous version of QEMU (tryied with 2.2).
Regression have been introduce by at least:
- df4b1024526cae3479da3492d6371fd4a7324a03
migration: create new section to store global state
- 61964c23e5ddd5a33f15699e45ce126f879e3e33
migration: Add configuration section
The last patch fix migration for 'xenfv' machine and for 'pc,accel=xen' machine. 'xenpv' machine is not affected as there is no emulated device state to save.
Change since in v2:
- replace memcpy() call by a strncpy().
- Move the skip_config_section and the like from 'xenfv' machine init to xen_init() which is called by accel_init_machine. (in 3rd patch)
Thanks,
Anthony PERARD (3):
migration: Fix global state with Xen.
migration: Add configuration section to vmstate with xen.
migration: Fix regression for xenfv and pc,accel=xen machine.
include/migration/migration.h | 1 + migration/migration.c | 7 +++++++ migration/savevm.c | 6 ++++++ xen-common.c | 5 +++++ 4 files changed, 19 insertions(+)
Signature · 1 line
Anthony PERARD
PATCH v3 1/3 migration: Fix global state with Xen.
When doing migration via the QMP command xen_save_devices_state, the current runstate is not store into the global state section. Also the current runstate is not the one we want on the receiver side.
During migration, the Xen toolstack paused QEMU before save the devices state. Also, the toolstack expect QEMU to autostart when the migration is finished.
So this patch store "running" as it's current runstate.
--- include/migration/migration.h | 1 + migration/migration.c | 7 +++++++ migration/savevm.c | 1 + 3 files changed, 9 insertions(+)
include/migration/migration.h +1 -0
@@ -203,4 +203,5 @@ void register_global_state(void);void global_state_set_optional (void );void savevm_skip_configuration (void );int global_state_store (void ); +void global_state_store_running (void );#endif
migration/migration.c +7 -0
@@ -122,6 +122,13 @@ int global_state_store(void)return 0 ; } +void global_state_store_running (void ) +{ +const char *state = RunState_lookup[RUN_STATE_RUNNING ]; +strncpy ((char *)global_state.runstate, + state,sizeof (global_state.runstate)); +} +static bool global_state_received (void ) {return global_state.received;
migration/savevm.c +1 -0
@@ -1394,6 +1394,7 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp) saved_vm_running =runstate_is_running ();vm_stop (RUN_STATE_SAVE_VM ); +global_state_store_running (); f =qemu_fopen (filename,"wb" );if (!f) {
Signature · 1 line
Anthony PERARD
Re: [PATCH for-2.4 v3 1/3] migration: Fix global state with Xen.
Quoted 10 lines · Anthony PERARD
When doing migration via the QMP command
xen_save_devices_state, the current runstate is not store into the global state section. Also the current runstate is not the one we want on the receiver side.During migration, the Xen toolstack paused QEMU before save the devices state. Also, the toolstack expect QEMU to autostart when the migration is finished.
So this patch store "running" as it's current runstate.Signed-off-by Anthony PERARD <[email protected]>
Amit, Juan,
if you are OK with this patch, I'll send a pull request with it and patch #3.
Thanks,
Stefano
Quoted 48 lines
include/migration/migration.h | 1 + migration/migration.c | 7 +++++++ migration/savevm.c | 1 + 3 files changed, 9 insertions(+)include/migration/migration.h +1
-0@@ -203,4 +203,5 @@ void register_global_state(void);void global_state_set_optional (void );void savevm_skip_configuration (void );int global_state_store (void ); +void global_state_store_running (void );#endif migration/migration.c +7
-0@@ -122,6 +122,13 @@ int global_state_store(void)return 0 ; } +void global_state_store_running (void ) +{ +const char *state = RunState_lookup[RUN_STATE_RUNNING ]; +strncpy ((char *)global_state.runstate, + state,sizeof (global_state.runstate)); +} +static bool global_state_received (void ) {return global_state.received;migration/savevm.c +1
-0@@ -1394,6 +1394,7 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp) saved_vm_running =runstate_is_running ();vm_stop (RUN_STATE_SAVE_VM ); +global_state_store_running (); f =qemu_fopen (filename,"wb" );if (!f) {Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH for-2.4 v3 1/3] migration: Fix global state with Xen.
In reply to Anthony PERARDQuoted 10 lines · Anthony PERARD
When doing migration via the QMP command
xen_save_devices_state, the current runstate is not store into the global state section. Also the current runstate is not the one we want on the receiver side.During migration, the Xen toolstack paused QEMU before save the devices state. Also, the toolstack expect QEMU to autostart when the migration is finished.
So this patch store "running" as it's current runstate.Signed-off-by Anthony PERARD <[email protected]>
Amit, Juan,
if you are OK with this patch, I'll send a pull request with it and patch #3.
Thanks,
Stefano
Quoted 48 lines
include/migration/migration.h | 1 + migration/migration.c | 7 +++++++ migration/savevm.c | 1 + 3 files changed, 9 insertions(+)include/migration/migration.h +1
-0@@ -203,4 +203,5 @@ void register_global_state(void);void global_state_set_optional (void );void savevm_skip_configuration (void );int global_state_store (void ); +void global_state_store_running (void );#endif migration/migration.c +7
-0@@ -122,6 +122,13 @@ int global_state_store(void)return 0 ; } +void global_state_store_running (void ) +{ +const char *state = RunState_lookup[RUN_STATE_RUNNING ]; +strncpy ((char *)global_state.runstate, + state,sizeof (global_state.runstate)); +} +static bool global_state_received (void ) {return global_state.received;migration/savevm.c +1
-0@@ -1394,6 +1394,7 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp) saved_vm_running =runstate_is_running ();vm_stop (RUN_STATE_SAVE_VM ); +global_state_store_running (); f =qemu_fopen (filename,"wb" );if (!f) {Signature · 1 line
Anthony PERARD
Re: [PATCH for-2.4 v3 1/3] migration: Fix global state with Xen.
Quoted 10 lines · Stefano Stabellini
Quoted 9 lines · Anthony PERARD
When doing migration via the QMP command
xen_save_devices_state, the current runstate is not store into the global state section. Also the current runstate is not the one we want on the receiver side.During migration, the Xen toolstack paused QEMU before save the devices state. Also, the toolstack expect QEMU to autostart when the migration is finished.
So this patch store "running" as it's current runstate.
Quoted 6 lines
Quoted 1 line
Signed-off-by Anthony PERARD <[email protected]>Amit, Juan,
if you are OK with this patch, I'll send a pull request with it and patch #3.
Juan is away for the week.
I'm fine with patches 1 and 3 here; you may pick them up, thanks.
Amit
Re: [Qemu-devel] [PATCH for-2.4 v3 1/3] migration: Fix global state with Xen.
In reply to Stefano StabelliniQuoted 10 lines · Stefano Stabellini
Quoted 9 lines · Anthony PERARD
When doing migration via the QMP command
xen_save_devices_state, the current runstate is not store into the global state section. Also the current runstate is not the one we want on the receiver side.During migration, the Xen toolstack paused QEMU before save the devices state. Also, the toolstack expect QEMU to autostart when the migration is finished.
So this patch store "running" as it's current runstate.
Quoted 6 lines
Quoted 1 line
Signed-off-by Anthony PERARD <[email protected]>Amit, Juan,
if you are OK with this patch, I'll send a pull request with it and patch #3.
Juan is away for the week.
I'm fine with patches 1 and 3 here; you may pick them up, thanks.
Amit
PATCH v3 2/3 migration: Add configuration section to vmstate with xen.
In reply to Anthony PERARDThis adds the configuration section in the vmstate saved by xen_save_devices_state.
--- migration/savevm.c | 5 +++++ 1 file changed, 5 insertions(+)
migration/savevm.c +5 -0
@@ -961,6 +961,11 @@ static int qemu_save_device_state(QEMUFile *f)cpu_synchronize_all_states (); +if (!savevm_state.skip_configuration) { +qemu_put_byte (f,QEMU_VM_CONFIGURATION ); +vmstate_save_state (f, &vmstate_configuration, &savevm_state,0 ); + } + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {if (se->is_ram) {continue ;
Signature · 1 line
Anthony PERARD
Re: [PATCH for-2.4 v3 2/3] migration: Add configuration section to vmstate with xen.
Quoted 4 lines · Anthony PERARD
This adds the configuration section in the vmstate saved by
xen_save_devices_state.Signed-off-by Anthony PERARD <[email protected]>
It doesn't seem to me that this patch is actually necessary to fix the issue, is that right?
If that is the case, I would rather skip it.
Quoted 22 lines
migration/savevm.c | 5 +++++ 1 file changed, 5 insertions(+)migration/savevm.c +5
-0@@ -961,6 +961,11 @@ static int qemu_save_device_state(QEMUFile *f)cpu_synchronize_all_states (); +if (!savevm_state.skip_configuration) { +qemu_put_byte (f,QEMU_VM_CONFIGURATION ); +vmstate_save_state (f, &vmstate_configuration, &savevm_state,0 ); + } + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {if (se->is_ram) {continue ;Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH for-2.4 v3 2/3] migration: Add configuration section to vmstate with xen.
In reply to Anthony PERARDQuoted 4 lines · Anthony PERARD
This adds the configuration section in the vmstate saved by
xen_save_devices_state.Signed-off-by Anthony PERARD <[email protected]>
It doesn't seem to me that this patch is actually necessary to fix the issue, is that right?
If that is the case, I would rather skip it.
Quoted 22 lines
migration/savevm.c | 5 +++++ 1 file changed, 5 insertions(+)migration/savevm.c +5
-0@@ -961,6 +961,11 @@ static int qemu_save_device_state(QEMUFile *f)cpu_synchronize_all_states (); +if (!savevm_state.skip_configuration) { +qemu_put_byte (f,QEMU_VM_CONFIGURATION ); +vmstate_save_state (f, &vmstate_configuration, &savevm_state,0 ); + } + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {if (se->is_ram) {continue ;Signature · 1 line
Anthony PERARD
Re: [PATCH for-2.4 v3 2/3] migration: Add configuration section to vmstate with xen.
Quoted 8 lines · Stefano Stabellini
Quoted 4 lines · Anthony PERARD
This adds the configuration section in the vmstate saved by
xen_save_devices_state.Signed-off-by Anthony PERARD <[email protected]>It doesn't seem to me that this patch is actually necessary to fix the issue, is that right?
No, it is not. This is going to be skipped with the next patch and with accel=xen.
Quoted 25 lines
If that is the case, I would rather skip it.
Quoted 22 lines
migration/savevm.c | 5 +++++ 1 file changed, 5 insertions(+)migration/savevm.c +5
-0@@ -961,6 +961,11 @@ static int qemu_save_device_state(QEMUFile *f)cpu_synchronize_all_states (); +if (!savevm_state.skip_configuration) { +qemu_put_byte (f,QEMU_VM_CONFIGURATION ); +vmstate_save_state (f, &vmstate_configuration, &savevm_state,0 ); + } + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {if (se->is_ram) {continue ;Signature · 1 line
Anthony PERARD
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH for-2.4 v3 2/3] migration: Add configuration section to vmstate with xen.
In reply to Stefano StabelliniQuoted 8 lines · Stefano Stabellini
Quoted 4 lines · Anthony PERARD
This adds the configuration section in the vmstate saved by
xen_save_devices_state.Signed-off-by Anthony PERARD <[email protected]>It doesn't seem to me that this patch is actually necessary to fix the issue, is that right?
No, it is not. This is going to be skipped with the next patch and with accel=xen.
Quoted 25 lines
If that is the case, I would rather skip it.
Quoted 22 lines
migration/savevm.c | 5 +++++ 1 file changed, 5 insertions(+)migration/savevm.c +5
-0@@ -961,6 +961,11 @@ static int qemu_save_device_state(QEMUFile *f)cpu_synchronize_all_states (); +if (!savevm_state.skip_configuration) { +qemu_put_byte (f,QEMU_VM_CONFIGURATION ); +vmstate_save_state (f, &vmstate_configuration, &savevm_state,0 ); + } + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {if (se->is_ram) {continue ;Signature · 1 line
Anthony PERARD
Signature · 1 line
Anthony PERARD
PATCH v3 3/3 migration: Fix regression for xenfv and pc, accel=xen machine.
In reply to Anthony PERARDThis fix migration from the same QEMU version and from previous QEMU version.
Quoted 1 line
From the global state section, we don't need runstate with Xen. Right now,
the way the Xen toolstack knows when QEMU is ready is when QEMU reach "running" runstate.
The configuration section and the section footers are not going to be present in previous version of QEMU with xenfv machine, so we skip them.
The Xen toolstack libxenlight does not specify a particular version of the 'pc' machine, so migration from older version of QEMU used by Xen to newer one would break due to missing "configuration" section and section footers.
--- xen-common.c | 5 +++++ 1 file changed, 5 insertions(+)
xen-common.c +5 -0
@@ -12,6 +12,7 @@#include "qmp-commands.h" #include "sysemu/char.h" #include "sysemu/accel.h" +#include "migration/migration.h" //#define DEBUG_XEN
@@ -119,6 +120,10 @@ static int xen_init(MachineState *ms) }qemu_add_vm_change_state_handler (xen_change_state_handler,NULL ); +global_state_set_optional (); +savevm_skip_configuration (); +savevm_skip_section_footers (); +return 0 ; }
Signature · 1 line
Anthony PERARD
PATCH v3 3/3 migration: Fix regression for xenfv and pc, accel=xen machine.
In reply to Anthony PERARDThis fix migration from the same QEMU version and from previous QEMU version.
Quoted 1 line
From the global state section, we don't need runstate with Xen. Right now,
the way the Xen toolstack knows when QEMU is ready is when QEMU reach "running" runstate.
The configuration section and the section footers are not going to be present in previous version of QEMU with xenfv machine, so we skip them.
The Xen toolstack libxenlight does not specify a particular version of the 'pc' machine, so migration from older version of QEMU used by Xen to newer one would break due to missing "configuration" section and section footers.
--- xen-common.c | 5 +++++ 1 file changed, 5 insertions(+)
xen-common.c +5 -0
@@ -12,6 +12,7 @@#include "qmp-commands.h" #include "sysemu/char.h" #include "sysemu/accel.h" +#include "migration/migration.h" //#define DEBUG_XEN
@@ -119,6 +120,10 @@ static int xen_init(MachineState *ms) }qemu_add_vm_change_state_handler (xen_change_state_handler,NULL ); +global_state_set_optional (); +savevm_skip_configuration (); +savevm_skip_section_footers (); +return 0 ; }
Signature · 1 line
Anthony PERARD
Re: [PATCH for-2.4 v3 3/3] migration: Fix regression for xenfv and pc, accel=xen machine.
Quoted 7 lines · Anthony PERARD
This fix migration from the same QEMU version and from previous QEMU version.
Quoted 1 line
From the global state section, we don't need runstate with Xen. Right now,
the way the Xen toolstack knows when QEMU is ready is when QEMU reach "running" runstate.
Quoted 8 lines
The configuration section and the section footers are not going to be present in previous version of QEMU with xenfv machine, so we skip them.
The Xen toolstack libxenlight does not specify a particular version of the 'pc' machine, so migration from older version of QEMU used by Xen to newer one would break due to missing "configuration" section and section footers.
Signed-off-by Anthony PERARD <[email protected]>
Quoted 29 lines
xen-common.c | 5 +++++ 1 file changed, 5 insertions(+)xen-common.c +5
-0@@ -12,6 +12,7 @@#include "qmp-commands.h" #include "sysemu/char.h" #include "sysemu/accel.h" +#include "migration/migration.h" //#define DEBUG_XEN @@ -119,6 +120,10 @@ static int xen_init(MachineState *ms) }qemu_add_vm_change_state_handler (xen_change_state_handler,NULL ); +global_state_set_optional (); +savevm_skip_configuration (); +savevm_skip_section_footers (); +return 0 ; }Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH for-2.4 v3 3/3] migration: Fix regression for xenfv and pc, accel=xen machine.
In reply to Anthony PERARDQuoted 7 lines · Anthony PERARD
This fix migration from the same QEMU version and from previous QEMU version.
Quoted 1 line
From the global state section, we don't need runstate with Xen. Right now,
the way the Xen toolstack knows when QEMU is ready is when QEMU reach "running" runstate.
Quoted 8 lines
The configuration section and the section footers are not going to be present in previous version of QEMU with xenfv machine, so we skip them.
The Xen toolstack libxenlight does not specify a particular version of the 'pc' machine, so migration from older version of QEMU used by Xen to newer one would break due to missing "configuration" section and section footers.
Signed-off-by Anthony PERARD <[email protected]>
Quoted 29 lines
xen-common.c | 5 +++++ 1 file changed, 5 insertions(+)xen-common.c +5
-0@@ -12,6 +12,7 @@#include "qmp-commands.h" #include "sysemu/char.h" #include "sysemu/accel.h" +#include "migration/migration.h" //#define DEBUG_XEN @@ -119,6 +120,10 @@ static int xen_init(MachineState *ms) }qemu_add_vm_change_state_handler (xen_change_state_handler,NULL ); +global_state_set_optional (); +savevm_skip_configuration (); +savevm_skip_section_footers (); +return 0 ; }Signature · 1 line
Anthony PERARD
Quoted 11 lines · Anthony PERARD
Hi,
We've spotted several regression which prevent migration with Xen using the same version of QEMU or from a previous version of QEMU (tryied with 2.2).
Regression have been introduce by at least:
-df4b1024526cae3479da3492d6371fd4a7324a03
migration: create new section to store global state
-61964c23e5ddd5a33f15699e45ce126f879e3e33
migration: Add configuration section
Quoted 8 lines
The last patch fix migration for 'xenfv' machine and for 'pc,accel=xen' machine. 'xenpv' machine is not affected as there is no emulated device state to save.
Change since in v2:
- replacememcpy()call by astrncpy().
- Move theskip_config_sectionand the like from 'xenfv' machine init toxen_init()which is called byaccel_init_machine. (in 3rd patch)
BTW I didn't see v2. Was the previous series marked RFC v2? The changes seem to indicate there wasn't anything else in between.
Amit
Quoted 11 lines · Anthony PERARD
Hi,
We've spotted several regression which prevent migration with Xen using the same version of QEMU or from a previous version of QEMU (tryied with 2.2).
Regression have been introduce by at least:
-df4b1024526cae3479da3492d6371fd4a7324a03
migration: create new section to store global state
-61964c23e5ddd5a33f15699e45ce126f879e3e33
migration: Add configuration section
Quoted 8 lines
The last patch fix migration for 'xenfv' machine and for 'pc,accel=xen' machine. 'xenpv' machine is not affected as there is no emulated device state to save.
Change since in v2:
- replacememcpy()call by astrncpy().
- Move theskip_config_sectionand the like from 'xenfv' machine init toxen_init()which is called byaccel_init_machine. (in 3rd patch)
BTW I didn't see v2. Was the previous series marked RFC v2? The changes seem to indicate there wasn't anything else in between.
Amit
Quoted 16 lines · Amit Shah
Quoted 15 lines · Anthony PERARD
Hi,
We've spotted several regression which prevent migration with Xen using the same version of QEMU or from a previous version of QEMU (tryied with 2.2).
Regression have been introduce by at least:
-df4b1024526cae3479da3492d6371fd4a7324a03
migration: create new section to store global state
-61964c23e5ddd5a33f15699e45ce126f879e3e33
migration: Add configuration sectionThe last patch fix migration for 'xenfv' machine and for 'pc,accel=xen' machine. 'xenpv' machine is not affected as there is no emulated device state to save.
Quoted 7 lines
Quoted 4 lines
Change since in v2:
- replacememcpy()call by astrncpy().
- Move theskip_config_sectionand the like from 'xenfv' machine init toxen_init()which is called byaccel_init_machine. (in 3rd patch)BTW I didn't see v2. Was the previous series marked RFC v2? The changes seem to indicate there wasn't anything else in between.
I am pretty sure that Anthony simply made a mistake with the version number.
Quoted 16 lines · Amit Shah
Quoted 15 lines · Anthony PERARD
Hi,
We've spotted several regression which prevent migration with Xen using the same version of QEMU or from a previous version of QEMU (tryied with 2.2).
Regression have been introduce by at least:
-df4b1024526cae3479da3492d6371fd4a7324a03
migration: create new section to store global state
-61964c23e5ddd5a33f15699e45ce126f879e3e33
migration: Add configuration sectionThe last patch fix migration for 'xenfv' machine and for 'pc,accel=xen' machine. 'xenpv' machine is not affected as there is no emulated device state to save.
Quoted 7 lines
Quoted 4 lines
Change since in v2:
- replacememcpy()call by astrncpy().
- Move theskip_config_sectionand the like from 'xenfv' machine init toxen_init()which is called byaccel_init_machine. (in 3rd patch)BTW I didn't see v2. Was the previous series marked RFC v2? The changes seem to indicate there wasn't anything else in between.
I am pretty sure that Anthony simply made a mistake with the version number.
Quoted 16 lines · Amit Shah
Quoted 15 lines · Anthony PERARD
Hi,
We've spotted several regression which prevent migration with Xen using the same version of QEMU or from a previous version of QEMU (tryied with 2.2).
Regression have been introduce by at least:
-df4b1024526cae3479da3492d6371fd4a7324a03
migration: create new section to store global state
-61964c23e5ddd5a33f15699e45ce126f879e3e33
migration: Add configuration sectionThe last patch fix migration for 'xenfv' machine and for 'pc,accel=xen' machine. 'xenpv' machine is not affected as there is no emulated device state to save.
Quoted 7 lines
Quoted 4 lines
Change since in v2:
- replacememcpy()call by astrncpy().
- Move theskip_config_sectionand the like from 'xenfv' machine init toxen_init()which is called byaccel_init_machine. (in 3rd patch)BTW I didn't see v2. Was the previous series marked RFC v2? The changes seem to indicate there wasn't anything else in between.
That's suppose to be the v2. And I change my mind while writing "Change since v1" and decide to write "Change in v2" but "since" is still there...
Signature · 1 line
Anthony PERARD
Quoted 16 lines · Amit Shah
Quoted 15 lines · Anthony PERARD
Hi,
We've spotted several regression which prevent migration with Xen using the same version of QEMU or from a previous version of QEMU (tryied with 2.2).
Regression have been introduce by at least:
-df4b1024526cae3479da3492d6371fd4a7324a03
migration: create new section to store global state
-61964c23e5ddd5a33f15699e45ce126f879e3e33
migration: Add configuration sectionThe last patch fix migration for 'xenfv' machine and for 'pc,accel=xen' machine. 'xenpv' machine is not affected as there is no emulated device state to save.
Quoted 7 lines
Quoted 4 lines
Change since in v2:
- replacememcpy()call by astrncpy().
- Move theskip_config_sectionand the like from 'xenfv' machine init toxen_init()which is called byaccel_init_machine. (in 3rd patch)BTW I didn't see v2. Was the previous series marked RFC v2? The changes seem to indicate there wasn't anything else in between.
That's suppose to be the v2. And I change my mind while writing "Change since v1" and decide to write "Change in v2" but "since" is still there...
Signature · 1 line
Anthony PERARD