cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-exec-Clean-up-fall-back-when-mem-path-allocation-fai.patch

218e99
From 897142f67237f772669d48d024e8e7719f6a5a79 Mon Sep 17 00:00:00 2001
218e99
From: Markus Armbruster <armbru@redhat.com>
218e99
Date: Wed, 18 Sep 2013 09:31:03 +0200
218e99
Subject: [PATCH 19/29] exec: Clean up fall back when -mem-path allocation fails
218e99
218e99
RH-Author: Markus Armbruster <armbru@redhat.com>
218e99
Message-id: <1379496669-22778-3-git-send-email-armbru@redhat.com>
218e99
Patchwork-id: 54421
218e99
O-Subject: [PATCH 7.0 qemu-kvm 2/8] exec: Clean up fall back when -mem-path allocation fails
218e99
Bugzilla: 1009328
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
From: Markus Armbruster <armbru@redhat.com>
218e99
218e99
With -mem-path, qemu_ram_alloc_from_ptr() first tries to allocate
218e99
accordingly, but when it fails, it falls back to normal allocation.
218e99
218e99
The fall back allocation code used to be effectively identical to the
218e99
"-mem-path not given" code, until it started to diverge in commit
218e99
432d268.  I believe the code still works, but clean it up anyway: drop
218e99
the special fall back allocation code, and fall back to the ordinary
218e99
"-mem-path not given" code instead.
218e99
218e99
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
Signed-off-by: Markus Armbruster <armbru@redhat.com>
218e99
Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
218e99
Message-id: 1375276272-15988-3-git-send-email-armbru@redhat.com
218e99
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
218e99
(cherry picked from commit 0628c18267bbe8d44f0faf3e71acf0ae31bea7fd)
218e99
---
218e99
 exec.c | 7 ++-----
218e99
 1 file changed, 2 insertions(+), 5 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 exec.c |    7 ++-----
218e99
 1 files changed, 2 insertions(+), 5 deletions(-)
218e99
218e99
diff --git a/exec.c b/exec.c
218e99
index 914d066..ef8d311 100644
218e99
--- a/exec.c
218e99
+++ b/exec.c
218e99
@@ -1063,15 +1063,12 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
218e99
         if (mem_path) {
218e99
 #if defined (__linux__) && !defined(TARGET_S390X)
218e99
             new_block->host = file_ram_alloc(new_block, size, mem_path);
218e99
-            if (!new_block->host) {
218e99
-                new_block->host = qemu_anon_ram_alloc(size);
218e99
-                memory_try_enable_merging(new_block->host, size);
218e99
-            }
218e99
 #else
218e99
             fprintf(stderr, "-mem-path option unsupported\n");
218e99
             exit(1);
218e99
 #endif
218e99
-        } else {
218e99
+        }
218e99
+        if (!new_block->host) {
218e99
             if (kvm_enabled()) {
218e99
                 /* some s390/kvm configurations have special constraints */
218e99
                 new_block->host = kvm_ram_alloc(size);
218e99
-- 
218e99
1.7.1
218e99