|
|
9ae3a8 |
From 34f122742b3b75db66c9f2a022179136dbc534e4 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 11 Feb 2014 15:20:47 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 13/28] Add check for cache size smaller than page size
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1392132047-5103-1-git-send-email-owasserm@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 57207
|
|
|
9ae3a8 |
O-Subject: [RHEL7 qemu-kvm PATCH] Add check for cache size smaller than page size
|
|
|
9ae3a8 |
Bugzilla: 1017096
|
|
|
9ae3a8 |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1017096
|
|
|
9ae3a8 |
Upstream: merged
|
|
|
9ae3a8 |
Brew:http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7028464
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit c91e681a558fc21073ffc491b5a022d5f340fa0b)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
arch_init.c | 4 ++++
|
|
|
9ae3a8 |
migration.c | 10 +++++++++-
|
|
|
9ae3a8 |
2 files changed, 13 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
arch_init.c | 4 ++++
|
|
|
9ae3a8 |
migration.c | 10 +++++++++-
|
|
|
9ae3a8 |
2 files changed, 13 insertions(+), 1 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/arch_init.c b/arch_init.c
|
|
|
9ae3a8 |
index 31aac84..c3207bf 100644
|
|
|
9ae3a8 |
--- a/arch_init.c
|
|
|
9ae3a8 |
+++ b/arch_init.c
|
|
|
9ae3a8 |
@@ -178,6 +178,10 @@ static struct {
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
int64_t xbzrle_cache_resize(int64_t new_size)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
+ if (new_size < TARGET_PAGE_SIZE) {
|
|
|
9ae3a8 |
+ return -1;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
if (XBZRLE.cache != NULL) {
|
|
|
9ae3a8 |
return cache_resize(XBZRLE.cache, new_size / TARGET_PAGE_SIZE) *
|
|
|
9ae3a8 |
TARGET_PAGE_SIZE;
|
|
|
9ae3a8 |
diff --git a/migration.c b/migration.c
|
|
|
9ae3a8 |
index 21f7247..6487fe2 100644
|
|
|
9ae3a8 |
--- a/migration.c
|
|
|
9ae3a8 |
+++ b/migration.c
|
|
|
9ae3a8 |
@@ -474,6 +474,7 @@ void qmp_migrate_cancel(Error **errp)
|
|
|
9ae3a8 |
void qmp_migrate_set_cache_size(int64_t value, Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
MigrationState *s = migrate_get_current();
|
|
|
9ae3a8 |
+ int64_t new_size;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Check for truncation */
|
|
|
9ae3a8 |
if (value != (size_t)value) {
|
|
|
9ae3a8 |
@@ -482,7 +483,14 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- s->xbzrle_cache_size = xbzrle_cache_resize(value);
|
|
|
9ae3a8 |
+ new_size = xbzrle_cache_resize(value);
|
|
|
9ae3a8 |
+ if (new_size < 0) {
|
|
|
9ae3a8 |
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
|
|
9ae3a8 |
+ "is smaller than page size");
|
|
|
9ae3a8 |
+ return;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ s->xbzrle_cache_size = new_size;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
int64_t qmp_query_migrate_cache_size(Error **errp)
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|