diff options
author | Peter Maydell | 2014-02-08 14:12:50 +0100 |
---|---|---|
committer | Peter Maydell | 2014-02-08 14:12:50 +0100 |
commit | 3ea3bd62451ac79478b440ad9fe2a4cd69783a1f (patch) | |
tree | ca7877399ac9d5b3cd00d00c787224281719fe49 /migration.c | |
parent | Merge remote-tracking branch 'remotes/kraxel/tags/pull-roms-1' into staging (diff) | |
parent | Don't abort on memory allocation error (diff) | |
download | qemu-3ea3bd62451ac79478b440ad9fe2a4cd69783a1f.tar.gz qemu-3ea3bd62451ac79478b440ad9fe2a4cd69783a1f.tar.xz qemu-3ea3bd62451ac79478b440ad9fe2a4cd69783a1f.zip |
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20140204-1' into staging
migration/next for 20140204
# gpg: Signature made Tue 04 Feb 2014 15:52:00 GMT using RSA key ID 5872D723
# gpg: Can't check signature: public key not found
* remotes/juanquintela/tags/migration/20140204-1:
Don't abort on memory allocation error
Don't abort on out of memory when creating page cache
XBZRLE cache size should not be larger than guest memory size
migration:fix free XBZRLE decoded_buf wrong
Add check for cache size smaller than page size
Set xbzrle buffers to NULL after freeing them to avoid double free errors
exec: fix ram_list dirty map optimization
vmstate: Make VMSTATE_STRUCT_POINTER take type, not ptr-to-type
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration.c')
-rw-r--r-- | migration.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/migration.c b/migration.c index 7235c23ffe..25add6f9e2 100644 --- a/migration.c +++ b/migration.c @@ -105,6 +105,7 @@ static void process_incoming_migration_co(void *opaque) ret = qemu_loadvm_state(f); qemu_fclose(f); + free_xbzrle_decoded_buf(); if (ret < 0) { fprintf(stderr, "load of migration failed\n"); exit(EXIT_FAILURE); @@ -469,6 +470,7 @@ void qmp_migrate_cancel(Error **errp) void qmp_migrate_set_cache_size(int64_t value, Error **errp) { MigrationState *s = migrate_get_current(); + int64_t new_size; /* Check for truncation */ if (value != (size_t)value) { @@ -477,7 +479,21 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp) return; } - s->xbzrle_cache_size = xbzrle_cache_resize(value); + /* Cache should not be larger than guest ram size */ + if (value > ram_bytes_total()) { + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", + "exceeds guest ram size "); + return; + } + + new_size = xbzrle_cache_resize(value); + if (new_size < 0) { + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", + "is smaller than page size"); + return; + } + + s->xbzrle_cache_size = new_size; } int64_t qmp_query_migrate_cache_size(Error **errp) |