cryptospore / rpms / qemu-kvm

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