diff mbox series

[RFC,18/18] hw/core/qdev: Display warning for devices missing migration state

Message ID 20200703201911.26573-19-f4bug@amsat.org
State New
Headers show
Series [01/18] migration/vmstate: Document vmstate_dummy | expand

Commit Message

Philippe Mathieu-Daudé July 3, 2020, 8:19 p.m. UTC
When built with --enable-qdev-debug, QEMU displays warnings
listing devices missing migration state:

  $ qemu-system-arm -S -M spitz
  qemu-system-arm: warning: missing migration state for type: 'pxa270-c0-arm-cpu'
  qemu-system-arm: warning: missing migration state for type: 'serial'
  qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia'
  qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia'
  qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave'
  qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave'
  qemu-system-arm: warning: missing migration state for type: 'ads7846'
  qemu-system-arm: warning: missing migration state for type: 'max1111'

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
RFC because there might be something simpler than --enable-qdev-debug.

 configure      | 9 +++++++++
 hw/core/qdev.c | 5 +++++
 2 files changed, 14 insertions(+)

Comments

Philippe Mathieu-Daudé Jan. 17, 2021, 5:28 p.m. UTC | #1
On 7/9/20 9:14 PM, Peter Maydell wrote:
> On Fri, 3 Jul 2020 at 21:19, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

>>

>> When built with --enable-qdev-debug, QEMU displays warnings

>> listing devices missing migration state:

>>

>>   $ qemu-system-arm -S -M spitz

>>   qemu-system-arm: warning: missing migration state for type: 'pxa270-c0-arm-cpu'

>>   qemu-system-arm: warning: missing migration state for type: 'serial'

>>   qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia'

>>   qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia'

>>   qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave'

>>   qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave'

>>   qemu-system-arm: warning: missing migration state for type: 'ads7846'

>>   qemu-system-arm: warning: missing migration state for type: 'max1111'

>>

>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>> ---

>> RFC because there might be something simpler than --enable-qdev-debug.

> 

> I think where we'd like to get to is installing a migration

> blocker if the machine has any devices which don't have a vmsd.

> But for that we'd need to be pretty sure we'd got all the devices

> on machines where we care about migration, and we're clearly a

> fair way from that (eg we need to do something about the

> devices like the CPU which don't have a vmsd but handle their

> migration some other way so they don't trigger the condition

> for warning/migration-blocker).


Dave made a comment about it, I'd rather let him have a look.

> I don't have a strong objection to this --enable-qdev-debug, I guess.

> Another option halfway between this and a full migration-blocker

> would be do a warn_report() for the relevant devices when savevm

> tries to migrate them.


OK. The problem is vmstate_save_state() is not qdev specific, it
migrates a blob, which we can not report much about. I'll repost
using 2 warnings.

Thanks for your review,

Phil.
diff mbox series

Patch

diff --git a/configure b/configure
index 8a65240d4a..d38efd5605 100755
--- a/configure
+++ b/configure
@@ -441,6 +441,7 @@  edk2_blobs="no"
 pkgversion=""
 pie=""
 qom_cast_debug="yes"
+qdev_debug="no"
 trace_backends="log"
 trace_file="trace"
 spice=""
@@ -1124,6 +1125,10 @@  for opt do
   ;;
   --enable-qom-cast-debug) qom_cast_debug="yes"
   ;;
+  --disable-qdev-debug) qdev_debug="no"
+  ;;
+  --enable-qdev-debug) qdev_debug="yes"
+  ;;
   --disable-virtfs) virtfs="no"
   ;;
   --enable-virtfs) virtfs="yes"
@@ -6966,6 +6971,7 @@  echo "gcov enabled      $gcov"
 echo "TPM support       $tpm"
 echo "libssh support    $libssh"
 echo "QOM debugging     $qom_cast_debug"
+echo "QDEV debugging    $qdev_debug"
 echo "Live block migration $live_block_migration"
 echo "lzo support       $lzo"
 echo "snappy support    $snappy"
@@ -7594,6 +7600,9 @@  fi
 if test "$qom_cast_debug" = "yes" ; then
   echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
 fi
+if test "$qdev_debug" = "yes" ; then
+  echo "CONFIG_QDEV_DEBUG=y" >> $config_host_mak
+fi
 if test "$rbd" = "yes" ; then
   echo "CONFIG_RBD=m" >> $config_host_mak
   echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 0d18bc6d93..c2da1e0509 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -932,6 +932,11 @@  static void device_set_realized(Object *obj, bool value, Error **errp)
                                                &local_err) < 0) {
                 goto post_realize_fail;
             }
+        } else {
+#ifdef CONFIG_QDEV_DEBUG
+            warn_report("missing migration state for type: '%s'",
+                        object_get_typename(OBJECT(dev)));
+#endif
         }
 
         /*