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