Blame SOURCES/kvm-Use-inhibit-to-prevent-ballooning-without-synchr.patch

d740ea
From 56e7f4a46b448ec40f72272658296df226ff0b5a Mon Sep 17 00:00:00 2001
d740ea
From: Alex Williamson <alex.williamson@redhat.com>
d740ea
Date: Thu, 13 Dec 2018 21:55:20 +0100
d740ea
Subject: [PATCH 4/5] kvm: Use inhibit to prevent ballooning without
d740ea
 synchronous mmu
d740ea
d740ea
RH-Author: Alex Williamson <alex.williamson@redhat.com>
d740ea
Message-id: <154473812068.22725.2716400707312373292.stgit@gimli.home>
d740ea
Patchwork-id: 83496
d740ea
O-Subject: [RHEL-7.7 qemu-kvm PATCH 4/5] kvm: Use inhibit to prevent ballooning without synchronous mmu
d740ea
Bugzilla: 1659229
d740ea
RH-Acked-by: Peter Xu <peterx@redhat.com>
d740ea
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
d740ea
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
d740ea
d740ea
Bugzilla: 1659229
d740ea
d740ea
Remove KVM specific tests in balloon_page(), instead marking
d740ea
ballooning as inhibited without KVM_CAP_SYNC_MMU support.
d740ea
d740ea
Reviewed-by: David Hildenbrand <david@redhat.com>
d740ea
Reviewed-by: Peter Xu <peterx@redhat.com>
d740ea
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
d740ea
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
d740ea
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
d740ea
(cherry picked from commit f59489423ab79852e98d9b3025b7d99ba8da584f)
d740ea
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
d740ea
---
d740ea
 hw/virtio/virtio-balloon.c | 4 +---
d740ea
 kvm-all.c                  | 4 ++++
d740ea
 2 files changed, 5 insertions(+), 3 deletions(-)
d740ea
d740ea
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
d740ea
index c9562ef..d8add23 100644
d740ea
--- a/hw/virtio/virtio-balloon.c
d740ea
+++ b/hw/virtio/virtio-balloon.c
d740ea
@@ -21,7 +21,6 @@
d740ea
 #include "cpu.h"
d740ea
 #include "sysemu/balloon.h"
d740ea
 #include "hw/virtio/virtio-balloon.h"
d740ea
-#include "sysemu/kvm.h"
d740ea
 #include "exec/address-spaces.h"
d740ea
 #include "qapi/visitor.h"
d740ea
 
d740ea
@@ -34,8 +33,7 @@
d740ea
 static void balloon_page(void *addr, int deflate)
d740ea
 {
d740ea
 #if defined(__linux__)
d740ea
-    if (!qemu_balloon_is_inhibited() && (!kvm_enabled() ||
d740ea
-                                         kvm_has_sync_mmu())) {
d740ea
+    if (!qemu_balloon_is_inhibited()) {
d740ea
         qemu_madvise(addr, TARGET_PAGE_SIZE,
d740ea
                 deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED);
d740ea
     }
d740ea
diff --git a/kvm-all.c b/kvm-all.c
d740ea
index f5b7958..572275e 100644
d740ea
--- a/kvm-all.c
d740ea
+++ b/kvm-all.c
d740ea
@@ -17,6 +17,7 @@
d740ea
 #include <sys/ioctl.h>
d740ea
 #include <sys/mman.h>
d740ea
 #include <stdarg.h>
d740ea
+#include "sysemu/balloon.h"
d740ea
 
d740ea
 #include <linux/kvm.h>
d740ea
 
d740ea
@@ -1481,6 +1482,9 @@ int kvm_init(void)
d740ea
     cpu_interrupt_handler = kvm_handle_interrupt;
d740ea
 
d740ea
     s->sync_mmu = !!kvm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
d740ea
+    if (!s->sync_mmu) {
d740ea
+        qemu_balloon_inhibit(true);
d740ea
+    }
d740ea
 
d740ea
     return 0;
d740ea
 
d740ea
-- 
d740ea
1.8.3.1
d740ea