mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
migration: Introduce dirty-limit capability
Introduce migration dirty-limit capability, which can be turned on before live migration and limit dirty page rate durty live migration. Introduce migrate_dirty_limit function to help check if dirty-limit capability enabled during live migration. Meanwhile, refactor vcpu_dirty_rate_stat_collect so that period can be configured instead of hardcoded. dirty-limit capability is kind of like auto-converge but using dirty limit instead of traditional cpu-throttle to throttle guest down. To enable this feature, turn on the dirty-limit capability before live migration using migrate-set-capabilities, and set the parameters "x-vcpu-dirty-limit-period", "vcpu-dirty-limit" suitably to speed up convergence. Signed-off-by: Hyman Huang(黄勇) <yong.huang@smartx.com> Acked-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <168618975839.6361.17407633874747688653-4@git.sr.ht> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
09f9ec9913
commit
dc62395557
4 changed files with 49 additions and 6 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "qemu-file.h"
|
||||
#include "ram.h"
|
||||
#include "options.h"
|
||||
#include "sysemu/kvm.h"
|
||||
|
||||
/* Maximum migrate downtime set to 2000 seconds */
|
||||
#define MAX_MIGRATE_DOWNTIME_SECONDS 2000
|
||||
|
@ -196,7 +197,7 @@ Property migration_properties[] = {
|
|||
#endif
|
||||
DEFINE_PROP_MIG_CAP("x-switchover-ack",
|
||||
MIGRATION_CAPABILITY_SWITCHOVER_ACK),
|
||||
|
||||
DEFINE_PROP_MIG_CAP("x-dirty-limit", MIGRATION_CAPABILITY_DIRTY_LIMIT),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
@ -242,6 +243,13 @@ bool migrate_dirty_bitmaps(void)
|
|||
return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS];
|
||||
}
|
||||
|
||||
bool migrate_dirty_limit(void)
|
||||
{
|
||||
MigrationState *s = migrate_get_current();
|
||||
|
||||
return s->capabilities[MIGRATION_CAPABILITY_DIRTY_LIMIT];
|
||||
}
|
||||
|
||||
bool migrate_events(void)
|
||||
{
|
||||
MigrationState *s = migrate_get_current();
|
||||
|
@ -572,6 +580,19 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (new_caps[MIGRATION_CAPABILITY_DIRTY_LIMIT]) {
|
||||
if (new_caps[MIGRATION_CAPABILITY_AUTO_CONVERGE]) {
|
||||
error_setg(errp, "dirty-limit conflicts with auto-converge"
|
||||
" either of then available currently");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!kvm_enabled() || !kvm_dirty_ring_enabled()) {
|
||||
error_setg(errp, "dirty-limit requires KVM with accelerator"
|
||||
" property 'dirty-ring-size' set");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue