Skip to content

RFC migration/vfio: Fix a few issues on API misuse or statistic reports

Peter Xu qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest12 patches 54 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12migration: Fix low possibility downtime violationmigration/migration.c+1 -17 replies
2/12migration/qapi: Rename MigrationStats to MigrationRAMStatsdocs/about/removed-features.rst migration/migration-stats.h qapi/migration.json+6 -64 replies
3/12vfio/migration: Throttle vfio_save_block() on data size to readhw/vfio/migration.c+12 -64 replies
4/12vfio/migration: Cache stop size in VFIOMigrationhw/vfio/migration.c hw/vfio/vfio-migration-internal.h+24 -203 replies
5/12migration/treewide: Merge @state_pending_{exact|estimate} APIsdocs/devel/migration/main.rst docs/devel/migration/vfio.rst hw/s390x/s390-stattrib.c +7 more+93 -1296 replies
6/12migration: Use the new save_query_pending() API directlymigration/migration.c migration/savevm.c migration/savevm.h +1 more+10 -343 replies
7/12migration: Introduce stopcopy_bytes in save_query_pending()include/migration/register.h migration/migration.c migration/savevm.c +1 more+62 -119 replies
8/12vfio/migration: Fix incorrect reporting for VFIO pending datahw/vfio/migration.c+7 -45 replies
9/12migration: Make iteration counter out of RAMmigration/migration-stats.h migration/migration.c migration/ram.c+28 -105 replies
10/12migration: Introduce a helper to return switchover bw estimatemigration/migration.c migration/migration.h+23 -214 replies
11/12migration: Calculate expected downtime on demandmigration/migration.c migration/migration.h+12 -152 replies
12/12migration: Fix calculation of expected_downtime to take VFIO infomigration/migration-stats.h migration/migration.c migration/ram.c+13 -92 replies

Reviews trailers per patch

5 of 12 patches have a Reviewed-by or Acked-by.

PatchHyman HuangMarkus ArmbrusterPrasad PanditJuraj Marcin
1/12R-b
2/12A-b
3/12
4/12
5/12
6/12R-b
7/12
8/12
9/12R-b R-b R-b
10/12R-b R-b
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH RFC 00/12] migration/vfio: Fix a few issues on API misuse or statistic reports

CI: https://gitlab.com/peterx/qemu/-/pipelines/2396755777

VFIO migration was merged quite a while, but we do still see things off here and there. This series tries to address some of them, but only based on my limited understandings.

This is RFC series as I don't have VFIO devices to test. So one can also see this as a raw proposal on raising the issues first with a solution that hasn't been well tested. However I tested non-vfio side and so far no issue I'm aware.

Two major issues I wanted to resolve here:

(1) VFIO reports state_pending_{exact|estimate}() differently

It reports stop-only sizes in exact() only (which includes both precopy and stopcopy data), while in estimate() it only reports precopy data. This is violating the API. The guess was it was done like it to trigger proper sync on the VFIO ioctls only. This series should fix it by introducing stopcopy size reporting facility for vmstate handlers.

(2) expected_downtime doesn't take VFIO devices into account

When query migration, QEMU reports one field called "expected-downtime". The document was phrasing this almost from RAM perspective, but ideally it should be about an estimated blackout window (in milliseconds) if we switchover anytime, based on known information.

This didn't yet took VFIO into account, especially in the case of VFIO devices that may contain a large amount of device states (like GPUs).

For problem (2), the use case should be that an mgmt app when migrating a VFIO GPU device needs to always adjust downtime for migration to converge, because when it's involved normal downtime like 300ms will normally not suffice.

Now the issue with that is the mgmt doesn't have a good way to know exactly how well the precopy goes with the whole system and the GPU device.

The hope is fixing expected_downtime may at least provide one way for the mgmt app so that it can monitor this field in query-migrate at the start of each iteration (by enabling events) to guess the progress, and it also may provide a relatively reasonable hint for downtime at least in case of GPUs. For this part, I tested nothing, so it's only a guess for now, but that's the wish it'll be something easier to use than before.

When without GPU, mgmt can also monitor this field (which so far is the only global field that one can query) so as to know how iterations are making progresses, so the mgmt should expect to see expected_downtime shrinking over iterations, and when it stops shrinking for a few iterations maybe it's wise to do something about it.

Tests or reviews will be very much welcomed.

Thanks,

Peter Xu (12):
migration: Fix low possibility downtime violation migration/qapi: Rename MigrationStats to MigrationRAMStats vfio/migration: Throttle vfio_save_block() on data size to read vfio/migration: Cache stop size in VFIOMigration migration/treewide: Merge @state_pending_{exact|estimate} APIs
migration: Use the new save_query_pending() API directly
migration: Introduce stopcopy_bytes in save_query_pending() vfio/migration: Fix incorrect reporting for VFIO pending data
migration: Make iteration counter out of RAM
migration: Introduce a helper to return switchover bw estimate
migration: Calculate expected downtime on demand
migration: Fix calculation of expected_downtime to take VFIO info

 docs/about/removed-features.rst   |   2 +-
 docs/devel/migration/main.rst     |   5 +-
 docs/devel/migration/vfio.rst     |   9 +-
 qapi/migration.json               |   8 +-
 hw/vfio/vfio-migration-internal.h |   1 +
 include/migration/register.h      |  64 ++++++------
 migration/migration-stats.h       |  15 +--
 migration/migration.h             |   2 +-
 migration/savevm.h                |   7 +-
 hw/s390x/s390-stattrib.c          |   8 +-
 hw/vfio/migration.c               | 114 ++++++++++++---------
 migration/block-dirty-bitmap.c    |   9 +-
 migration/migration.c             | 159 +++++++++++++++++++++---------
 migration/ram.c                   |  39 ++------
 migration/savevm.c                |  37 ++-----
 hw/vfio/trace-events              |   3 +-
 migration/trace-events            |   1 +
 17 files changed, 254 insertions(+), 229 deletions(-)
Signature · 1 line
2.50.1