Skip to contentSkip to conversation

migration: fix iotest 055, only-migratable break

PATCH In review Peter Xu 4 participants 17 messages Jul 5, 2017 – Jul 10, 2017

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

v2 cover migration: fix iotest 055, only-migratable break

v2:
- patch 1: add r-b for Eduardo/Juan
- patch 2: add r-b for Eduardo (Markus's suggestion is a todo), and t-b for Qingfeng
- patch 3: rewrite the doc up, merging both Eduardo/Markus's suggestion [Eduardo, Markus]
- patch 4: added a TODO [Markus]

Two breakage introduced during the migration objectify series: one for --only-migratable, another one for iotest 055.

First two patches fixes the breakages. Latter two are documentation updates suggested by Eduardo. Please review. Thanks.

Peter Xu (4):
migration: fix handling for --only-migratable
vl: move global property, migrate init earlier
doc: add item for "-M enforce-config-section"
doc: update TYPE_MIGRATION documents

 include/migration/misc.h |  1 -
 migration/migration.c    | 17 ++++++-----------
 qemu-options.hx          | 11 +++++++++++
 vl.c                     | 26 +++++++++++++-------------
 4 files changed, 30 insertions(+), 25 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/4 migration: fix handling for --only-migratable

MigrateState object is not ready at that time, so we'll get an assertion. Use qemu_global_option() instead.

Fixes 3df663e ("migration: move only_migratable to MigrationState")
---
 include/migration/misc.h | 1 -
 migration/migration.c    | 5 -----
 vl.c                     | 2 +-
 3 files changed, 1 insertion(+), 7 deletions(-)
include/migration/misc.h +0 -1
index 2255121..c079b77 100644
@@ -53,7 +53,6 @@ bool migration_has_finished(MigrationState *);
 bool migration_has_failed(MigrationState *);
 /* ...and after the device transmission */
 bool migration_in_postcopy_after_devices(MigrationState *);
-void migration_only_migratable_set(void);
 void migration_global_dump(Monitor *mon);
 
 #endif
migration/migration.c +0 -5
index 51ccd1a..dbdc121 100644
@@ -128,11 +128,6 @@ MigrationState *migrate_get_current(void)
     return current_migration;
 }
 
-void migration_only_migratable_set(void)
-{
-    migrate_get_current()->only_migratable = true;
-}
-
 MigrationIncomingState *migration_incoming_get_current(void)
 {
     static bool once;
vl.c +1 -1
index 36ff3f4..0c497a3 100644
@@ -3958,7 +3958,7 @@ int main(int argc, char **argv, char **envp)
                  *
                  * "-global migration.only-migratable=true"
                  */
-                migration_only_migratable_set();
+                qemu_global_option("migration.only-migratable=true");
                 break;
             case QEMU_OPTION_nodefaults:
                 has_defaults = 0;
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 2/4 vl: move global property, migrate init earlier

In reply to Peter Xu

Currently drive_init_func() may call migrate_get_current() while the migrate object is still not ready yet at that time. Move the migration object init earlier, along with the global properties, right after acceleration init.

This fixes a breakage for iotest 055, which caused an assertion failure.

Fixes 3df663 ("migration: move only_migratable to MigrationState")
---
 vl.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
vl.c +12 -12
index 0c497a3..2ae4313 100644
@@ -4414,6 +4414,18 @@ int main(int argc, char **argv, char **envp)
 
     configure_accelerator(current_machine);
 
+    /*
+     * Register all the global properties, including accel properties,
+     * machine properties, and user-specified ones.
+     */
+    register_global_properties(current_machine);
+
+    /*
+     * Migration object can only be created after global properties
+     * are applied correctly.
+     */
+    migration_object_init();
+
     if (qtest_chrdev) {
         qtest_init(qtest_chrdev, qtest_log, &error_fatal);
     }
@@ -4595,18 +4607,6 @@ int main(int argc, char **argv, char **envp)
             exit (i == 1 ? 1 : 0);
     }
 
-    /*
-     * Register all the global properties, including accel properties,
-     * machine properties, and user-specified ones.
-     */
-    register_global_properties(current_machine);
-
-    /*
-     * Migration object can only be created after global properties
-     * are applied correctly.
-     */
-    migration_object_init();
-
     /* This checkpoint is required by replay to separate prior clock
        reading from the other reads, because timer polling functions query
        clock values from the log. */
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 3/4 doc: add item for "-M enforce-config-section"

In reply to Peter Xu

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

---
 qemu-options.hx | 11 +++++++++++
 1 file changed, 11 insertions(+)
qemu-options.hx +11 -0
index 297bd8a..2c1116e 100644
@@ -85,6 +85,17 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off
 Enables or disables squashing subchannels into the default css.
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+@option{enforce-config-section} cannot be used together with
+@option{-global} @option{migration.send-configuration}. Behavior is
+undefined if @option{enforce-config-section} and @option{-global}
+@option{migration.send-configuration} are used together.
+
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.
 @end table
 ETEXI
 
Signature · 1 line
2.7.4
author
#14 lore raw

PATCH v2 4/4 doc: update TYPE_MIGRATION documents

In reply to Peter Xu

[Peter collected Eduardo's patch comment and formatted into patch]

---
 migration/migration.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
migration/migration.c +6 -6
index dbdc121..31d46d1 100644
@@ -2052,12 +2052,12 @@ static void migration_instance_init(Object *obj)
 static const TypeInfo migration_type = {
     .name = TYPE_MIGRATION,
     /*
-     * NOTE: "migration" itself is not really a device. We used
-     * TYPE_DEVICE here only to leverage some existing QDev features
-     * like "-global" properties, and HW_COMPAT_* fields (which are
-     * finally applied as global properties as well). If one day the
-     * global property feature can be migrated from QDev to QObject in
-     * general, then we can switch to QObject as well.
+     * NOTE: TYPE_MIGRATION is not really a device, as the object is
+     * not created using qdev_create(), it is not attached to the qdev
+     * device tree, and it is never realized.
+     *
+     * TODO: Make this TYPE_OBJECT once QOM provides something like
+     * TYPE_DEVICE's "-global" properties.
      */
     .parent = TYPE_DEVICE,
     .class_init = migration_class_init,
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 3/4 doc: add item for "-M enforce-config-section"

In reply to Peter Xu

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

---
v2.1:
- remove the "undefined behavior" sentence [Markus]

 qemu-options.hx | 8 ++++++++
 1 file changed, 8 insertions(+)
qemu-options.hx +8 -0
index 297bd8a..1ce7a37 100644
@@ -85,6 +85,14 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off
 Enables or disables squashing subchannels into the default css.
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.
+@option{enforce-config-section} cannot be used together with
+@option{-global} @option{migration.send-configuration}.
 @end table
 ETEXI
 
Signature · 1 line
2.7.4
#5 lore raw

Re: [Qemu-devel] [PATCH v2.1 3/4] doc: add item for "-M enforce-config-section"

Quoted 22 lines · On Thu, 6 Jul 2017 10:08:41 +0800 Peter Xu <[email protected]> wrote:

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

---
v2.1:
- remove the "undefined behavior" sentence [Markus]

 qemu-options.hx | 8 ++++++++
 1 file changed, 8 insertions(+)
qemu-options.hx +0 -0
index 297bd8a..1ce7a37 100644
@@ -85,6 +85,14 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off

qemu-options.hx Enables or disables NVDIMM support. The default is off. · line 95

Quoted 10 lines
qemu-options.hx +8 -0
 Enables or disables squashing subchannels into the default css.
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.
+@option{enforce-config-section} cannot be used together with
+@option{-global} @option{migration.send-configuration}.

Is this last sentence correct ?

My understanding is that "enforce-config-section" overrides "migration.send-configuration"...

Quoted 3 lines
qemu-options.hx +0 -0
 @end table
 ETEXI
 
author
#6 lore raw

Re: [Qemu-devel] [PATCH v2.1 3/4] doc: add item for "-M enforce-config-section"

Quoted 38 lines · Greg Kurz
Quoted 22 lines · On Thu, 6 Jul 2017 10:08:41 +0800 Peter Xu <[email protected]> wrote:

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

---
v2.1:
- remove the "undefined behavior" sentence [Markus]

 qemu-options.hx | 8 ++++++++
 1 file changed, 8 insertions(+)
qemu-options.hx +0 -0
index 297bd8a..1ce7a37 100644
@@ -85,6 +85,14 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off

qemu-options.hx Enables or disables NVDIMM support. The default is off. · line 95

Quoted 10 lines
qemu-options.hx +8 -0
 Enables or disables squashing subchannels into the default css.
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.
+@option{enforce-config-section} cannot be used together with
+@option{-global} @option{migration.send-configuration}.

Is this last sentence correct ?

Quoted 2 lines

My understanding is that "enforce-config-section" overrides "migration.send-configuration"...

Yes, in the codes it is.

But as mentioned in the commit message, this rule is actually not really necessary, so it does not really conflict when we declare in the document that it is not allowed to happen (the code just did something extra). After all, we want to finally remove enforce-config-section one day, so before that I would like to avoid taking more responsibility on this old parameter.

Also, I hope people (especially who read this document) don't use these two parameters at the same time, or better, use the new one, rather than still using "enforce-config-section" after he knows that "anyway, it'll override the global parameter, so this old one is still better"...

Thanks,

Signature · 1 line
Peter Xu
#7 lore raw

Re: [Qemu-devel] [PATCH v2.1 3/4] doc: add item for "-M enforce-config-section"

In reply to Peter Xu
Quoted 23 lines · Peter Xu

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

---
v2.1:
- remove the "undefined behavior" sentence [Markus]

 qemu-options.hx | 8 ++++++++
 1 file changed, 8 insertions(+)
qemu-options.hx +0 -0
index 297bd8a..1ce7a37 100644
@@ -85,6 +85,14 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off
 Enables or disables squashing subchannels into the default css.

qemu-options.hx Enables or disables NVDIMM support. The default is off. · line 96

Quoted 10 lines
qemu-options.hx +8 -0
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.
+@option{enforce-config-section} cannot be used together with
+@option{-global} @option{migration.send-configuration}.
 @end table

I'm not sure if "cannot be used together" is much better than "behavior is undefined when they are used together". I prefer Markus' suggestion to simply leave it unspecified. (In other words, just removing the last 2 lines)

Signature · 1 line
Eduardo
author
#8 lore raw

PATCH v2 3/4 doc: add item for "-M enforce-config-section"

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

---
v2.1 -> v2.2
- remove the last two lines of document [Eduardo]

 qemu-options.hx | 6 ++++++
 1 file changed, 6 insertions(+)
qemu-options.hx +6 -0
index 297bd8a..cd95516 100644
@@ -85,6 +85,12 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off
 Enables or disables squashing subchannels into the default css.
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.
 @end table
 ETEXI
 
Signature · 1 line
2.7.4
Reviewed-by on v2 3/4
#9 lore raw

Re: [Qemu-devel] [PATCH v2.2 3/4] doc: add item for "-M enforce-config-section"

Quoted 9 lines · On Fri, 7 Jul 2017 10:54:08 +0800 Peter Xu <[email protected]> wrote:

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

Quoted 24 lines

---
v2.1 -> v2.2
- remove the last two lines of document [Eduardo]

 qemu-options.hx | 6 ++++++
 1 file changed, 6 insertions(+)
qemu-options.hx +6 -0
index 297bd8a..cd95516 100644
@@ -85,6 +85,12 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off
 Enables or disables squashing subchannels into the default css.
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.
 @end table
 ETEXI
 
Reviewed-by on v2 3/4
#10 lore raw

Re: [Qemu-devel] [PATCH v2.2 3/4] doc: add item for "-M enforce-config-section"

In reply to Peter Xu
Quoted 6 lines · Peter Xu

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

This paragraph looks obsolete now, as now the documentation doesn't explicitly forbid mixing the two options. If it gets removed:

Juan, will you queue it through your tree?

Thanks!

Quoted 24 lines

---
v2.1 -> v2.2
- remove the last two lines of document [Eduardo]

 qemu-options.hx | 6 ++++++
 1 file changed, 6 insertions(+)
qemu-options.hx +6 -0
index 297bd8a..cd95516 100644
@@ -85,6 +85,12 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off
 Enables or disables squashing subchannels into the default css.
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.
Signature · 1 line
Eduardo
#11 lore raw

Re: [Qemu-devel] [PATCH v2.2 3/4] doc: add item for "-M enforce-config-section"

Quoted 8 lines · * Eduardo Habkost ([email protected]) wrote:
Quoted 6 lines · Peter Xu

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

Quoted 7 lines

This paragraph looks obsolete now, as now the documentation doesn't explicitly forbid mixing the two options. If it gets removed:

Juan, will you queue it through your tree?

Juan's on PTO, I'll take it.

Dave

Quoted 12 lines

Thanks!

Quoted 10 lines

---
v2.1 -> v2.2
- remove the last two lines of document [Eduardo]

 qemu-options.hx | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 17 lines
Quoted 14 lines
qemu-options.hx +6 -0
index 297bd8a..cd95516 100644
@@ -85,6 +85,12 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off
 Enables or disables squashing subchannels into the default css.
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.
Signature · 1 line
Eduardo

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Reviewed-by
#12 lore raw

Re: [Qemu-devel] [PATCH v2.2 3/4] doc: add item for "-M enforce-config-section"

In reply to Eduardo Habkost
Quoted 4 lines · On Fri, 7 Jul 2017 09:12:14 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 3 lines · Peter Xu

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Quoted 8 lines
Quoted 3 lines

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

This paragraph looks obsolete now, as now the documentation doesn't explicitly forbid mixing the two options. If it gets removed:

Same for me.

Quoted 2 lines
Quoted 29 lines

Juan, will you queue it through your tree?

Thanks!

Quoted 24 lines

---
v2.1 -> v2.2
- remove the last two lines of document [Eduardo]

 qemu-options.hx | 6 ++++++
 1 file changed, 6 insertions(+)
qemu-options.hx +6 -0
index 297bd8a..cd95516 100644
@@ -85,6 +85,12 @@ Enables or disables NVDIMM support. The default is off.
 @item s390-squash-mcss=on|off
 Enables or disables squashing subchannels into the default css.
 The default is off.
+@item enforce-config-section=on|off
+If @option{enforce-config-section} is set to @var{on}, force migration
+code to send configuration section even if the machine-type sets the
+@option{migration.send-configuration} property to @var{off}.
+NOTE: this parameter is deprecated. Please use @option{-global}
+@option{migration.send-configuration}=@var{on|off} instead.  
author
#13 lore raw

Re: [Qemu-devel] [PATCH v2.2 3/4] doc: add item for "-M enforce-config-section"

Quoted 16 lines · Greg Kurz
Quoted 4 lines · On Fri, 7 Jul 2017 09:12:14 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 3 lines · Peter Xu

It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly.

Quoted 8 lines
Quoted 3 lines

Although now when enforce-config-section is set, it'll override the other "-global" parameter, that is not necessarily a rule. Forbid that usage in the document.

This paragraph looks obsolete now, as now the documentation doesn't explicitly forbid mixing the two options. If it gets removed:

Quoted 6 lines

Same for me.

Quoted 2 lines

Thanks all for reviewing the patches!

Signature · 1 line
Peter Xu
#16 lore raw
In reply to Peter Xu
Quoted 8 lines · * Peter Xu ([email protected]) wrote:

v2:
- patch 1: add r-b for Eduardo/Juan
- patch 2: add r-b for Eduardo (Markus's suggestion is a todo), and t-b for Qingfeng
- patch 3: rewrite the doc up, merging both Eduardo/Markus's suggestion [Eduardo, Markus]
- patch 4: added a TODO [Markus]

Quoted 5 lines

Two breakage introduced during the migration objectify series: one for --only-migratable, another one for iotest 055.

First two patches fixes the breakages. Latter two are documentation updates suggested by Eduardo. Please review. Thanks.

Queued (with commit message tweak from Eduardo in 3)

Dave

Quoted 6 lines

Peter Xu (4):
migration: fix handling for --only-migratable
vl: move global property, migrate init earlier
doc: add item for "-M enforce-config-section"
doc: update TYPE_MIGRATION documents

Quoted 10 lines
 include/migration/misc.h |  1 -
 migration/migration.c    | 17 ++++++-----------
 qemu-options.hx          | 11 +++++++++++
 vl.c                     | 26 +++++++++++++-------------
 4 files changed, 30 insertions(+), 25 deletions(-)
Signature · 1 line
2.7.4

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK