yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 34974722fc54eb326f5af4153dfa7f73dd7f4d70 Mon Sep 17 00:00:00 2001
9ae3a8
From: Orit Wasserman <owasserm@redhat.com>
9ae3a8
Date: Tue, 11 Feb 2014 15:32:35 +0100
9ae3a8
Subject: [PATCH 14/28] XBZRLE cache size should not be larger than guest memory size
9ae3a8
9ae3a8
RH-Author: Orit Wasserman <owasserm@redhat.com>
9ae3a8
Message-id: <1392132757-18587-2-git-send-email-owasserm@redhat.com>
9ae3a8
Patchwork-id: 57209
9ae3a8
O-Subject: [RHEL7 qemu-kvm PATCH 1/3] XBZRLE cache size should not be larger than guest memory size
9ae3a8
Bugzilla: 1047448
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
9ae3a8
RH-Acked-by: Juan Quintela <quintela@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
9ae3a8
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9ae3a8
Signed-off-by: Juan Quintela <quintela@redhat.com>
9ae3a8
(cherry picked from commit a5615b14a66e86f620e90c8f4b3537c28bb328d4)
9ae3a8
---
9ae3a8
 migration.c | 7 +++++++
9ae3a8
 1 file changed, 7 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 migration.c |    7 +++++++
9ae3a8
 1 files changed, 7 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/migration.c b/migration.c
9ae3a8
index 6487fe2..b6de990 100644
9ae3a8
--- a/migration.c
9ae3a8
+++ b/migration.c
9ae3a8
@@ -483,6 +483,13 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
9ae3a8
         return;
9ae3a8
     }
9ae3a8
 
9ae3a8
+    /* Cache should not be larger than guest ram size */
9ae3a8
+    if (value > ram_bytes_total()) {
9ae3a8
+        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
9ae3a8
+                  "exceeds guest ram size ");
9ae3a8
+        return;
9ae3a8
+    }
9ae3a8
+
9ae3a8
     new_size = xbzrle_cache_resize(value);
9ae3a8
     if (new_size < 0) {
9ae3a8
         error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8