From 9e1ba4cc4e2536d9650e84e2614c5691ed45938f Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Mon, 6 Aug 2012 21:42:54 +0300 Subject: Add migrate_set_cache_size command Change XBZRLE cache size in bytes (the size should be a power of 2, it will be rounded down to the nearest power of 2). If XBZRLE cache size is too small there will be many cache miss. New query-migrate-cache-size QMP command and 'info migrate_cache_size' HMP command to query cache value. Signed-off-by: Benoit Hudzia Signed-off-by: Petter Svard Signed-off-by: Aidan Shribman Signed-off-by: Orit Wasserman Reviewed-by: Luiz Capitulino Reviewed-by: Eric Blake --- migration.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'migration.c') diff --git a/migration.c b/migration.c index 5a5333c..a6c0072 100644 --- a/migration.c +++ b/migration.c @@ -511,6 +511,25 @@ void qmp_migrate_cancel(Error **errp) migrate_fd_cancel(migrate_get_current()); } +void qmp_migrate_set_cache_size(int64_t value, Error **errp) +{ + MigrationState *s = migrate_get_current(); + + /* Check for truncation */ + if (value != (size_t)value) { + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", + "exceeding address space"); + return; + } + + s->xbzrle_cache_size = xbzrle_cache_resize(value); +} + +int64_t qmp_query_migrate_cache_size(Error **errp) +{ + return migrate_xbzrle_cache_size(); +} + void qmp_migrate_set_speed(int64_t value, Error **errp) { MigrationState *s; -- cgit v1.1