From: Peter Xu <peterx@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
Paolo Bonzini <pbonzini@redhat.com>,
Juraj Marcin <jmarcin@redhat.com>
Subject: Re: [PULL 13/23] migration: Calculate expected downtime on demand
Date: Mon, 11 May 2026 09:48:29 -0400 [thread overview]
Message-ID: <agHeLeJ-uVz0B5jg@x1.local> (raw)
In-Reply-To: <CAFEAcA-MYH6C39xO0OLx4-M5pKurJpurwRsMqZe9q=W-NShAbw@mail.gmail.com>
On Thu, May 07, 2026 at 08:57:24PM +0100, Peter Maydell wrote:
> On Tue, 5 May 2026 at 21:29, Peter Xu <peterx@redhat.com> wrote:
> >
> > This value does not need to be calculated as frequent. Only calculate it
> > on demand when query-migrate happened. With that we can remove the
> > variable in MigrationState.
> >
> > This paves way for fixing this value to include all modules (not only RAM
> > but others too).
> >
> > Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
> > Link: https://lore.kernel.org/r/20260421202110.306051-12-peterx@redhat.com
> > Signed-off-by: Peter Xu <peterx@redhat.com>
>
> Hi; I'm seeing a clang undefined-behaviour sanitizer failure
> in the code introduced in this change when running the
> aarch64 migration-test via "make check" on an x86-64 host.
>
> It seems to happen fairly reliably when I do a "make check -j20",
> but not when I run the test on its own, so it's probably load dependent.
>
> Here's the backtrace:
>
> ../../migration/migration.c:1051:12: runtime error: inf is outside the
> range of representable values of type 'long'
> #0 0x57b49d635c0d in migration_downtime_calc_expected
> /home/pm215/qemu/build/arm-clang/../../migration/migration.c:1051:12
> #1 0x57b49d63e860 in populate_time_info
> /home/pm215/qemu/build/arm-clang/../../migration/migration.c:1075:35
> #2 0x57b49d63617e in fill_source_migration_info
> /home/pm215/qemu/build/arm-clang/../../migration/migration.c:1184:9
> #3 0x57b49d63617e in qmp_query_migrate
> /home/pm215/qemu/build/arm-clang/../../migration/migration.c:1264:5
> #4 0x57b49e4aed75 in qmp_marshal_query_migrate
> /home/pm215/qemu/build/arm-clang/qapi/qapi-commands-migration.c:48:14
> #5 0x57b49e526814 in do_qmp_dispatch_bh
> /home/pm215/qemu/build/arm-clang/../../qapi/qmp-dispatch.c:128:5
> #6 0x57b49e58c35a in aio_bh_call
> /home/pm215/qemu/build/arm-clang/../../util/async.c:173:5
> #7 0x57b49e58c698 in aio_bh_poll
> /home/pm215/qemu/build/arm-clang/../../util/async.c:220:13
> #8 0x57b49e542fc1 in aio_dispatch
> /home/pm215/qemu/build/arm-clang/../../util/aio-posix.c:390:5
> #9 0x57b49e58f10a in aio_ctx_dispatch
> /home/pm215/qemu/build/arm-clang/../../util/async.c:365:5
> #10 0x7c74a09b8584
> (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5d584) (BuildId:
> 116e142b9b52c8a4dfd403e759e71ab8f95d8bb3)
> #11 0x7c74a09b86cf in g_main_context_dispatch
> (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5d6cf) (BuildId:
> 116e142b9b52c8a4dfd403e759e71ab8f95d8bb3)
> #12 0x57b49e5901cb in glib_pollfds_poll
> /home/pm215/qemu/build/arm-clang/../../util/main-loop.c:290:9
> #13 0x57b49e5901cb in os_host_main_loop_wait
> /home/pm215/qemu/build/arm-clang/../../util/main-loop.c:313:5
> #14 0x57b49e5901cb in main_loop_wait
> /home/pm215/qemu/build/arm-clang/../../util/main-loop.c:592:11
> #15 0x57b49d5f5486 in qemu_main_loop
> /home/pm215/qemu/build/arm-clang/../../system/runstate.c:948:9
> #16 0x57b49e42cdfb in qemu_default_main
> /home/pm215/qemu/build/arm-clang/../../system/main.c:50:14
> #17 0x57b49e42cdd3 in main
> /home/pm215/qemu/build/arm-clang/../../system/main.c:93:9
>
>
> > +/* Return expected downtime (unit: milliseconds) */
> > +int64_t migration_downtime_calc_expected(MigrationState *s)
> > +{
> > + if (mig_stats.dirty_sync_count <= 1) {
> > + return migrate_downtime_limit();
> > + }
> > +
> > + return mig_stats.dirty_bytes_last_sync /
> > + migration_get_switchover_bw(s) * 1000;
> > +}
>
> Presumably in this function migration_get_switchover_bw() returns 0,
> so the (floating-point) division results in Infinity. That's fine
> until we have to convert it to int64_t to return it, which is the
> UB that the sanitizer is complaining about...
True, I can easily reproduce the warning too. I'll send a patch.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2026-05-11 13:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 20:26 [PULL 00/23] Next patches Peter Xu
2026-05-05 20:26 ` [PULL 01/23] migration: Fix blocking in POSTCOPY_DEVICE during package load Peter Xu
2026-05-05 20:26 ` [PULL 02/23] migration: Use QAPI_CLONE_MEMBERS in migrate_params_test_apply Peter Xu
2026-05-05 20:26 ` [PULL 03/23] migration/rdma: add x-rdma-chunk-size parameter Peter Xu
2026-05-05 20:26 ` [PULL 04/23] migration: Fix low possibility downtime violation Peter Xu
2026-05-05 20:26 ` [PULL 05/23] migration/qapi: Rename MigrationStats to MigrationRAMStats Peter Xu
2026-05-05 20:26 ` [PULL 06/23] vfio/migration: Cache stop size in VFIOMigration Peter Xu
2026-05-05 20:26 ` [PULL 07/23] migration/treewide: Merge @state_pending_{exact|estimate} APIs Peter Xu
2026-05-05 20:26 ` [PULL 08/23] migration: Use the new save_query_pending() API directly Peter Xu
2026-05-05 20:26 ` [PULL 09/23] migration: Introduce stopcopy_bytes in save_query_pending() Peter Xu
2026-05-05 20:26 ` [PULL 10/23] vfio/migration: Fix incorrect reporting for VFIO pending data Peter Xu
2026-05-05 20:26 ` [PULL 11/23] migration: Move iteration counter out of RAM Peter Xu
2026-05-05 20:26 ` [PULL 12/23] migration: Introduce a helper to return switchover bw estimate Peter Xu
2026-05-05 20:26 ` [PULL 13/23] migration: Calculate expected downtime on demand Peter Xu
2026-05-07 19:57 ` Peter Maydell
2026-05-11 13:48 ` Peter Xu [this message]
2026-05-05 20:26 ` [PULL 14/23] migration: Fix calculation of expected_downtime to take VFIO info Peter Xu
2026-05-05 20:26 ` [PULL 15/23] migration: Remember total dirty bytes in mig_stats Peter Xu
2026-05-05 20:26 ` [PULL 16/23] migration/qapi: Introduce system-wide "remaining" reports Peter Xu
2026-05-05 20:26 ` [PULL 17/23] migration/qapi: Update unit for avail-switchover-bandwidth Peter Xu
2026-05-05 20:26 ` [PULL 18/23] vfio/migration: Add tracepoints for precopy/stopcopy query ioctls Peter Xu
2026-05-05 20:26 ` [PULL 19/23] hw/riscv: iommu-trap: remove .impl.unaligned = true Peter Xu
2026-05-05 20:26 ` [PULL 20/23] hw/npcm7xx_fiu: Specify .impl for npcm7xx_fiu_flash_ops Peter Xu
2026-05-05 20:26 ` [PULL 21/23] hw/xtensa/mx_pic: Specify xtensa_mx_pic_ops .impl settings Peter Xu
2026-05-05 20:26 ` [PULL 22/23] system/memory: assert on invalid MemoryRegionOps .unaligned combo Peter Xu
2026-05-05 20:26 ` [PULL 23/23] tests/qtest/migration: Fix A-B file build Peter Xu
2026-05-06 18:19 ` [PULL 00/23] Next patches Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=agHeLeJ-uVz0B5jg@x1.local \
--to=peterx@redhat.com \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox