thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

ae23c9
From 486481ac5bddfab22b74bcebcbd27af1f7a604f5 Mon Sep 17 00:00:00 2001
ae23c9
From: Alex Williamson <alex.williamson@redhat.com>
ae23c9
Date: Mon, 3 Dec 2018 22:01:34 +0000
ae23c9
Subject: [PATCH 11/16] kvm: Use inhibit to prevent ballooning without
ae23c9
 synchronous mmu
ae23c9
ae23c9
RH-Author: Alex Williamson <alex.williamson@redhat.com>
ae23c9
Message-id: <154387449407.27651.8902076548922742582.stgit@gimli.home>
ae23c9
Patchwork-id: 83237
ae23c9
O-Subject: [RHEL-8.0 qemu-kvm PATCH 2/7] kvm: Use inhibit to prevent ballooning without synchronous mmu
ae23c9
Bugzilla: 1650272
ae23c9
RH-Acked-by: Peter Xu <peterx@redhat.com>
ae23c9
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
ae23c9
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
RH-Acked-by: David Hildenbrand <david@redhat.com>
ae23c9
ae23c9
Bugzilla: 1650272
ae23c9
ae23c9
Remove KVM specific tests in balloon_page(), instead marking
ae23c9
ballooning as inhibited without KVM_CAP_SYNC_MMU support.
ae23c9
ae23c9
Reviewed-by: David Hildenbrand <david@redhat.com>
ae23c9
Reviewed-by: Peter Xu <peterx@redhat.com>
ae23c9
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
ae23c9
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
ae23c9
(cherry picked from commit f59489423ab79852e98d9b3025b7d99ba8da584f)
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 accel/kvm/kvm-all.c        | 4 ++++
ae23c9
 hw/virtio/virtio-balloon.c | 4 +---
ae23c9
 2 files changed, 5 insertions(+), 3 deletions(-)
ae23c9
ae23c9
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
ae23c9
index 3f1c06e..3a7c8a3 100644
ae23c9
--- a/accel/kvm/kvm-all.c
ae23c9
+++ b/accel/kvm/kvm-all.c
ae23c9
@@ -39,6 +39,7 @@
ae23c9
 #include "trace.h"
ae23c9
 #include "hw/irq.h"
ae23c9
 #include "sysemu/sev.h"
ae23c9
+#include "sysemu/balloon.h"
ae23c9
 
ae23c9
 #include "hw/boards.h"
ae23c9
 
ae23c9
@@ -1711,6 +1712,9 @@ static int kvm_init(MachineState *ms)
ae23c9
     s->many_ioeventfds = kvm_check_many_ioeventfds();
ae23c9
 
ae23c9
     s->sync_mmu = !!kvm_vm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
ae23c9
+    if (!s->sync_mmu) {
ae23c9
+        qemu_balloon_inhibit(true);
ae23c9
+    }
ae23c9
 
ae23c9
     return 0;
ae23c9
 
ae23c9
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
ae23c9
index f456cea..4aab291 100644
ae23c9
--- a/hw/virtio/virtio-balloon.c
ae23c9
+++ b/hw/virtio/virtio-balloon.c
ae23c9
@@ -21,7 +21,6 @@
ae23c9
 #include "hw/mem/pc-dimm.h"
ae23c9
 #include "sysemu/balloon.h"
ae23c9
 #include "hw/virtio/virtio-balloon.h"
ae23c9
-#include "sysemu/kvm.h"
ae23c9
 #include "exec/address-spaces.h"
ae23c9
 #include "qapi/error.h"
ae23c9
 #include "qapi/qapi-events-misc.h"
ae23c9
@@ -36,8 +35,7 @@
ae23c9
 
ae23c9
 static void balloon_page(void *addr, int deflate)
ae23c9
 {
ae23c9
-    if (!qemu_balloon_is_inhibited() && (!kvm_enabled() ||
ae23c9
-                                         kvm_has_sync_mmu())) {
ae23c9
+    if (!qemu_balloon_is_inhibited()) {
ae23c9
         qemu_madvise(addr, BALLOON_PAGE_SIZE,
ae23c9
                 deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED);
ae23c9
     }
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9