[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/19] s390x/pv: Convert to ram_block_discard_disable()
From: |
David Hildenbrand |
Subject: |
[PATCH v2 04/19] s390x/pv: Convert to ram_block_discard_disable() |
Date: |
Wed, 20 May 2020 14:31:37 +0200 |
Discarding RAM does not work as expected with protected VMs. Let's
switch to ram_block_discard_disable() for now, as we want to get rid
of qemu_balloon_inhibit(). Note that it will currently never fail, but
might fail in the future with new technologies (e.g., virtio-mem).
Cc: Richard Henderson <address@hidden>
Cc: Cornelia Huck <address@hidden>
Cc: Halil Pasic <address@hidden>
Cc: Christian Borntraeger <address@hidden>
Cc: Janosch Frank <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/s390x/s390-virtio-ccw.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 67ae2e02ff..e82129e874 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -43,7 +43,6 @@
#include "hw/qdev-properties.h"
#include "hw/s390x/tod.h"
#include "sysemu/sysemu.h"
-#include "sysemu/balloon.h"
#include "hw/s390x/pv.h"
#include "migration/blocker.h"
@@ -329,7 +328,7 @@ static void s390_machine_unprotect(S390CcwMachineState *ms)
ms->pv = false;
migrate_del_blocker(pv_mig_blocker);
error_free_or_abort(&pv_mig_blocker);
- qemu_balloon_inhibit(false);
+ ram_block_discard_disable(false);
}
static int s390_machine_protect(S390CcwMachineState *ms)
@@ -338,17 +337,22 @@ static int s390_machine_protect(S390CcwMachineState *ms)
int rc;
/*
- * Ballooning on protected VMs needs support in the guest for
- * sharing and unsharing balloon pages. Block ballooning for
- * now, until we have a solution to make at least Linux guests
- * either support it or fail gracefully.
+ * Discarding of memory in RAM blocks does not work as expected with
+ * protected VMs. Sharing and unsharing pages would be required. Disable
+ * it for now, until until we have a solution to make at least Linux
+ * guests either support it (e.g., virtio-balloon) or fail gracefully.
*/
- qemu_balloon_inhibit(true);
+ rc = ram_block_discard_disable(true);
+ if (rc) {
+ error_report("protected VMs: cannot disable RAM discard");
+ return rc;
+ }
+
error_setg(&pv_mig_blocker,
"protected VMs are currently not migrateable.");
rc = migrate_add_blocker(pv_mig_blocker, &local_err);
if (rc) {
- qemu_balloon_inhibit(false);
+ ram_block_discard_disable(false);
error_report_err(local_err);
error_free_or_abort(&pv_mig_blocker);
return rc;
@@ -357,7 +361,7 @@ static int s390_machine_protect(S390CcwMachineState *ms)
/* Create SE VM */
rc = s390_pv_vm_enable();
if (rc) {
- qemu_balloon_inhibit(false);
+ ram_block_discard_disable(false);
migrate_del_blocker(pv_mig_blocker);
error_free_or_abort(&pv_mig_blocker);
return rc;
--
2.25.4
- [PATCH v2 00/19] virtio-mem: Paravirtualized memory hot(un)plug, David Hildenbrand, 2020/05/20
- [PATCH v2 01/19] exec: Introduce ram_block_discard_(disable|require)(), David Hildenbrand, 2020/05/20
- [PATCH v2 02/19] vfio: Convert to ram_block_discard_disable(), David Hildenbrand, 2020/05/20
- [PATCH v2 03/19] accel/kvm: Convert to ram_block_discard_disable(), David Hildenbrand, 2020/05/20
- [PATCH v2 04/19] s390x/pv: Convert to ram_block_discard_disable(),
David Hildenbrand <=
- [PATCH v2 06/19] target/i386: sev: Use ram_block_discard_disable(), David Hildenbrand, 2020/05/20
- [PATCH v2 07/19] migration/rdma: Use ram_block_discard_disable(), David Hildenbrand, 2020/05/20
- [PATCH v2 05/19] virtio-balloon: Rip out qemu_balloon_inhibit(), David Hildenbrand, 2020/05/20
- [PATCH v2 08/19] migration/colo: Use ram_block_discard_disable(), David Hildenbrand, 2020/05/20
- [PATCH v2 09/19] linux-headers: update to contain virtio-mem, David Hildenbrand, 2020/05/20
- [PATCH v2 10/19] virtio-mem: Paravirtualized memory hot(un)plug, David Hildenbrand, 2020/05/20
- [PATCH v2 11/19] virtio-pci: Proxy for virtio-mem, David Hildenbrand, 2020/05/20
- [PATCH v2 12/19] MAINTAINERS: Add myself as virtio-mem maintainer, David Hildenbrand, 2020/05/20