From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org
Cc: arei.gonglei@huawei.com, yanghy@cn.fujitsu.com,
zhang.zhanghailiang@huawei.com
Subject: [Qemu-devel] [RFC/COLO: 3/3] COLO: Parameterise background RAM transfer limit
Date: Tue, 4 Aug 2015 20:26:27 +0100 [thread overview]
Message-ID: <1438716387-16687-4-git-send-email-dgilbert@redhat.com> (raw)
In-Reply-To: <1438716387-16687-1-git-send-email-dgilbert@redhat.com>
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
COLO (experimentally) transfers RAM in the background when the amount
to transfer reaches a limit; allow this limit to be set via the
parameter mechanism.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
hmp.c | 8 ++++++++
migration/colo.c | 6 ++----
migration/migration.c | 19 +++++++++++++++++++
qapi-schema.json | 13 ++++++++++---
4 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/hmp.c b/hmp.c
index 0e92d11..c177fbf 100644
--- a/hmp.c
+++ b/hmp.c
@@ -307,6 +307,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
monitor_printf(mon, " %s: %" PRId64,
MigrationParameter_lookup[MIGRATION_PARAMETER_COLO_RELAX_TIME],
params->colo_relax_time);
+ monitor_printf(mon, " %s: %" PRId64,
+ MigrationParameter_lookup[MIGRATION_PARAMETER_COLO_RAM_LIVE],
+ params->colo_ram_live);
monitor_printf(mon, "\n");
}
@@ -1263,6 +1266,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
bool has_colo_min_time = false;
bool has_colo_max_time = false;
bool has_colo_relax_time = false;
+ bool has_colo_ram_live = false;
int i;
@@ -1296,6 +1300,9 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
case MIGRATION_PARAMETER_COLO_RELAX_TIME:
has_colo_relax_time = true;
break;
+ case MIGRATION_PARAMETER_COLO_RAM_LIVE:
+ has_colo_ram_live = true;
+ break;
}
qmp_migrate_set_parameters(has_compress_level, value,
has_compress_threads, value,
@@ -1306,6 +1313,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
has_colo_min_time, value,
has_colo_max_time, value,
has_colo_relax_time, value,
+ has_colo_ram_live, value,
&err);
break;
}
diff --git a/migration/colo.c b/migration/colo.c
index 5c8096d..9db9de1 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -486,13 +486,11 @@ static bool checkpoint_choice(MigrationState *s)
}
}
-/* should be calculated by bandwidth and max downtime ? */
-#define THRESHOLD_PENDING_SIZE (10 * 1024 * 1024UL)
-
static int colo_need_live_migrate_ram(MigrationState *s)
{
uint64_t pending_size;
- int64_t max_size = THRESHOLD_PENDING_SIZE;
+ int64_t max_size = s->parameters[MIGRATION_PARAMETER_COLO_RAM_LIVE] *
+ 1024 * 1024;
pending_size = qemu_savevm_state_pending(s->file, max_size);
return (pending_size && pending_size >= max_size);
diff --git a/migration/migration.c b/migration/migration.c
index d41914c..d4214be 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -61,6 +61,8 @@
#define DEFAULT_MIGRATE_COLO_MAX_TIME 10000
/* Time after a miscompare before resuming comparison (ms) */
#define DEFAULT_MIGRATE_COLO_RELAX_TIME 100
+/* Amount of RAM changes to trigger background RAM transfer (MiB) */
+#define DEFAULT_MIGRATE_COLO_RAM_LIVE 10
static NotifierList migration_state_notifiers =
NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
@@ -97,6 +99,8 @@ MigrationState *migrate_get_current(void)
DEFAULT_MIGRATE_COLO_MAX_TIME,
.parameters[MIGRATION_PARAMETER_COLO_RELAX_TIME] =
DEFAULT_MIGRATE_COLO_RELAX_TIME,
+ .parameters[MIGRATION_PARAMETER_COLO_RAM_LIVE] =
+ DEFAULT_MIGRATE_COLO_RAM_LIVE,
.checkpoint_state.max_downtime = 0,
.checkpoint_state.min_downtime = INT64_MAX
};
@@ -420,6 +424,7 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
params->colo_min_time = s->parameters[MIGRATION_PARAMETER_COLO_MIN_TIME];
params->colo_max_time = s->parameters[MIGRATION_PARAMETER_COLO_MAX_TIME];
params->colo_relax_time = s->parameters[MIGRATION_PARAMETER_COLO_RELAX_TIME];
+ params->colo_ram_live = s->parameters[MIGRATION_PARAMETER_COLO_RAM_LIVE];
return params;
}
@@ -583,6 +588,8 @@ void qmp_migrate_set_parameters(bool has_compress_level,
int64_t colo_max_time,
bool has_colo_relax_time,
int64_t colo_relax_time,
+ bool has_colo_ram_live,
+ int64_t colo_ram_live,
Error **errp)
{
MigrationState *s = migrate_get_current();
@@ -636,6 +643,11 @@ void qmp_migrate_set_parameters(bool has_compress_level,
"colo_relax_time",
"is invalid, it must be positive");
}
+ if (has_colo_ram_live && (colo_ram_live < 0)) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
+ "colo_ram_live",
+ "is invalid, it must be positive");
+ }
if (has_compress_level) {
s->parameters[MIGRATION_PARAMETER_COMPRESS_LEVEL] = compress_level;
@@ -671,6 +683,10 @@ void qmp_migrate_set_parameters(bool has_compress_level,
s->parameters[MIGRATION_PARAMETER_COLO_RELAX_TIME] =
colo_relax_time;
}
+ if (has_colo_ram_live) {
+ s->parameters[MIGRATION_PARAMETER_COLO_RAM_LIVE] =
+ colo_ram_live;
+ }
}
/* shared migration helpers */
@@ -799,6 +815,8 @@ static MigrationState *migrate_init(const MigrationParams *params)
MIGRATION_PARAMETER_COLO_MAX_TIME];
int64_t colo_relax_time = s->parameters[
MIGRATION_PARAMETER_COLO_RELAX_TIME];
+ int64_t colo_ram_live = s->parameters[
+ MIGRATION_PARAMETER_COLO_RAM_LIVE];
memcpy(enabled_capabilities, s->enabled_capabilities,
sizeof(enabled_capabilities));
@@ -821,6 +839,7 @@ static MigrationState *migrate_init(const MigrationParams *params)
s->parameters[MIGRATION_PARAMETER_COLO_MIN_TIME] = colo_min_time;
s->parameters[MIGRATION_PARAMETER_COLO_MAX_TIME] = colo_max_time;
s->parameters[MIGRATION_PARAMETER_COLO_RELAX_TIME] = colo_relax_time;
+ s->parameters[MIGRATION_PARAMETER_COLO_RAM_LIVE] = colo_ram_live;
s->bandwidth_limit = bandwidth_limit;
migrate_set_state(&s->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_SETUP);
diff --git a/qapi-schema.json b/qapi-schema.json
index 30113fc..bd264d0 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -636,13 +636,15 @@
# @colo-min-time: Minimum Time (in ms) for a COLO comparative checkpoint
# @colo-max-time: Maximum Time (in ms) for a COLO comparative checkpoint
# @colo-relax-time: Time (in ms) after a miscompare before starting a new COLO checkpoint
+# @colo-ram-live: Amount of RAM changes to trigger background RAM transfer (MiB)
#
# Since: 2.4
##
{ 'enum': 'MigrationParameter',
'data': ['compress-level', 'compress-threads', 'decompress-threads',
'colo-passive-count', 'colo-passive-limit', 'colo-passive-time',
- 'colo-min-time', 'colo-max-time', 'colo-relax-time' ] }
+ 'colo-min-time', 'colo-max-time', 'colo-relax-time',
+ 'colo-ram-live' ] }
#
# @migrate-set-parameters
@@ -661,6 +663,7 @@
# @colo-min-time: Minimum Time (in ms) for a COLO comparative checkpoint
# @colo-max-time: Maximum Time (in ms) for a COLO comparative checkpoint
# @colo-relax-time: Time (in ms) after a miscompare before starting a new COLO checkpoint
+# @colo-ram-live: Amount of RAM changes to trigger background RAM transfer (MiB)
#
# Since: 2.4
##
@@ -673,7 +676,8 @@
'*colo-passive-time': 'int',
'*colo-min-time': 'int',
'*colo-max-time': 'int',
- '*colo-relax-time': 'int'
+ '*colo-relax-time': 'int',
+ '*colo-ram-live': 'int'
} }
#
@@ -685,6 +689,8 @@
#
# @decompress-threads: decompression thread count
#
+# @colo-ram-live: Amount of RAM changes to trigger background RAM transfer (MiB)
+#
# Since: 2.4
##
{ 'struct': 'MigrationParameters',
@@ -696,7 +702,8 @@
'colo-passive-time': 'int',
'colo-min-time': 'int',
'colo-max-time': 'int',
- 'colo-relax-time': 'int' } }
+ 'colo-relax-time': 'int',
+ 'colo-ram-live': 'int' } }
##
# @query-migrate-parameters
--
2.4.3
prev parent reply other threads:[~2015-08-04 19:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 19:26 [Qemu-devel] [RFC/COLO: 0/3] Hybrid mode and parameterisation Dr. David Alan Gilbert (git)
2015-08-04 19:26 ` [Qemu-devel] [RFC/COLO: 1/3] COLO: Hybrid mode Dr. David Alan Gilbert (git)
2015-08-05 3:23 ` zhanghailiang
2015-08-24 17:54 ` Dr. David Alan Gilbert
2015-08-04 19:26 ` [Qemu-devel] [RFC/COLO: 2/3] Parameterise min/max/relax time Dr. David Alan Gilbert (git)
2015-08-04 19:26 ` Dr. David Alan Gilbert (git) [this message]
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=1438716387-16687-4-git-send-email-dgilbert@redhat.com \
--to=dgilbert@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=yanghy@cn.fujitsu.com \
--cc=zhang.zhanghailiang@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).