Skip to content

Commit

Permalink
Merge tag 'migration-20231016-pull-request' of https://gitlab.com/jua…
Browse files Browse the repository at this point in the history
…n.quintela/qemu into staging

Migration Pull request (20231016)

In this pull request:
- rdma cleanups
- removal of QEMUFileHook
- test for analyze-migration.py
- test for multifd file
- multifd cleanups
- available switchover bandwidth
- lots of cleanups.

CI: https://gitlab.com/juan.quintela/qemu/-/pipelines/1037878829

Please, apply.

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEGJn/jt6/WMzuA0uC9IfvGFhy1yMFAmUtCzoACgkQ9IfvGFhy
# 1yOiQA//Vf/mAfDd+BUBDzUpLDmku7k/+B8miaeGfYVlvIVq51savfiK9LjuPIl+
# uvwdd3b3bYaXsyY4tOndWBqpRiEPmgb0LQvP4Tmo1Edo9uvD83rj0p7XfekZ4Xi4
# wmq608S7dFtgnhX6SbktQDqteWvANzbIt9WA0HBDqhOLlNW9+nSPu7SPV7OTbq04
# 3e+qAwHLXasnAuFuaeMJAd7J5c8CF6ygIrLmDgkEIbwNpvLf9nDAHqUmu+t6OZq1
# GgCpS77B4V/AT8Ga4jSGQshp8B+rNlMtyY3pmtRhlx6r+g2rbmKv/HZLo0IrajXR
# BkYQISbaQvhCaxMVDibjR2VFTKtHHGO0dU/MuAhCYOrvtauR9c26hAohoE80Cv/Q
# 9Jiji0iHJW8deW0CU3BXapOzCHTGvglBzXsGpaxvr/GhXGBY9Cpa2SZTtp/OS6Fu
# RYDGW9/YyyZIULWA7N1WJq5MHRu7QJmPtVyzxTKj26eTMS7aDWozLZyuIIg/muIA
# YqpBFM3Xy8FRAVqz0UATaLpyQRSR5vIibYCZ6w/KaMrtGMphx0xgSN1W5itNqGQ8
# qrMehdgGGpeKpioE23XAaJ76wpvQquCPfPioeB6xsBIeLMguy/dkbmsViEtP9HYF
# qYKnJyiXbSN8Ju85p2fG9WntoBVVjoho3vx2m+rbiCCaLAGkiU4=
# =zbU3
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 16 Oct 2023 06:06:50 EDT
# gpg:                using RSA key 1899FF8EDEBF58CCEE034B82F487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>" [full]
# gpg:                 aka "Juan Quintela <quintela@trasno.org>" [full]
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* tag 'migration-20231016-pull-request' of https://gitlab.com/juan.quintela/qemu: (38 commits)
  migration/multifd: Clarify Error usage in multifd_channel_connect
  migration/multifd: Unify multifd_send_thread error paths
  migration/multifd: Remove direct "socket" references
  migration/ram: Merge save_zero_page functions
  migration/ram: Move xbzrle zero page handling into save_zero_page
  migration/ram: Stop passing QEMUFile around in save_zero_page
  migration/ram: Remove RAMState from xbzrle_cache_zero_page
  migration/ram: Refactor precopy ram loading code
  multifd: reset next_packet_len after sending pages
  multifd: fix counters in multifd_send_thread
  migration: check for rate_limit_max for RATE_LIMIT_DISABLED
  migration: Improve json and formatting
  migration/rdma: Remove all "ret" variables that are used only once
  migration/rdma: Declare for index variables local
  migration/rdma: Use i as for index instead of idx
  migration/rdma: Check sooner if we are in postcopy for save_page()
  migration/rdma: Remove qemu_ prefix from exported functions
  migration/rdma: Move rdma constants from qemu-file.h to rdma.h
  qemu-file: Remove QEMUFileHooks
  migration/rdma: Create rdma_control_save_page()
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
stefanhaRH committed Oct 16, 2023
2 parents a662b9d + f39b0f4 commit 35239fc
Show file tree
Hide file tree
Showing 21 changed files with 892 additions and 565 deletions.
2 changes: 1 addition & 1 deletion include/migration/register.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typedef struct SaveVMHandlers {
* used to perform early checks.
*/
int (*save_prepare)(void *opaque, Error **errp);
int (*save_setup)(QEMUFile *f, void *opaque);
void (*save_cleanup)(void *opaque);
int (*save_live_complete_postcopy)(QEMUFile *f, void *opaque);
int (*save_live_complete_precopy)(QEMUFile *f, void *opaque);
Expand All @@ -50,7 +51,6 @@ typedef struct SaveVMHandlers {
int (*save_live_iterate)(QEMUFile *f, void *opaque);

/* This runs outside the iothread lock! */
int (*save_setup)(QEMUFile *f, void *opaque);
/* Note for save_live_pending:
* must_precopy:
* - must be migrated in precopy or in stopped state
Expand Down
3 changes: 0 additions & 3 deletions migration/block-dirty-bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,17 +1214,14 @@ static int dirty_bitmap_save_setup(QEMUFile *f, void *opaque)
DBMSaveState *s = &((DBMState *)opaque)->save;
SaveBitmapState *dbms = NULL;

qemu_mutex_lock_iothread();
if (init_dirty_bitmap_migration(s) < 0) {
qemu_mutex_unlock_iothread();
return -1;
}

QSIMPLEQ_FOREACH(dbms, &s->dbms_list, entry) {
send_bitmap_start(f, s, dbms);
}
qemu_put_bitmap_flags(f, DIRTY_BITMAP_MIG_FLAG_EOS);
qemu_mutex_unlock_iothread();
return 0;
}

Expand Down
5 changes: 0 additions & 5 deletions migration/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,18 +731,13 @@ static int block_save_setup(QEMUFile *f, void *opaque)
trace_migration_block_save("setup", block_mig_state.submitted,
block_mig_state.transferred);

qemu_mutex_lock_iothread();
ret = init_blk_migration(f);
if (ret < 0) {
qemu_mutex_unlock_iothread();
return ret;
}

/* start track dirty blocks */
ret = set_dirty_tracking();

qemu_mutex_unlock_iothread();

if (ret) {
return ret;
}
Expand Down
14 changes: 14 additions & 0 deletions migration/migration-hmp-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n",
MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH),
params->max_bandwidth);
assert(params->has_avail_switchover_bandwidth);
monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n",
MigrationParameter_str(MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BANDWIDTH),
params->avail_switchover_bandwidth);
assert(params->has_downtime_limit);
monitor_printf(mon, "%s: %" PRIu64 " ms\n",
MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT),
Expand Down Expand Up @@ -574,6 +578,16 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
}
p->max_bandwidth = valuebw;
break;
case MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BANDWIDTH:
p->has_avail_switchover_bandwidth = true;
ret = qemu_strtosz_MiB(valuestr, NULL, &valuebw);
if (ret < 0 || valuebw > INT64_MAX
|| (size_t)valuebw != valuebw) {
error_setg(&err, "Invalid size %s", valuestr);
break;
}
p->avail_switchover_bandwidth = valuebw;
break;
case MIGRATION_PARAMETER_DOWNTIME_LIMIT:
p->has_downtime_limit = true;
visit_type_size(v, param, &p->downtime_limit, &err);
Expand Down
9 changes: 5 additions & 4 deletions migration/migration-stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ bool migration_rate_exceeded(QEMUFile *f)
return true;
}

uint64_t rate_limit_max = migration_rate_get();
if (rate_limit_max == RATE_LIMIT_DISABLED) {
return false;
}

uint64_t rate_limit_start = stat64_get(&mig_stats.rate_limit_start);
uint64_t rate_limit_current = migration_transferred_bytes(f);
uint64_t rate_limit_used = rate_limit_current - rate_limit_start;
uint64_t rate_limit_max = stat64_get(&mig_stats.rate_limit_max);

if (rate_limit_max == RATE_LIMIT_DISABLED) {
return false;
}
if (rate_limit_max > 0 && rate_limit_used > rate_limit_max) {
return true;
}
Expand Down

0 comments on commit 35239fc

Please sign in to comment.