[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 04/20] s390x/pv: Convert to ram_block_discard_disable()
From: |
David Hildenbrand |
Subject: |
[PATCH v3 04/20] s390x/pv: Convert to ram_block_discard_disable() |
Date: |
Wed, 3 Jun 2020 16:48:58 +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 <rth@twiddle.net>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
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 v3 00/20] virtio-mem: Paravirtualized memory hot(un)plug, David Hildenbrand, 2020/06/03
- [PATCH v3 01/20] exec: Introduce ram_block_discard_(disable|require)(), David Hildenbrand, 2020/06/03
- [PATCH v3 02/20] vfio: Convert to ram_block_discard_disable(), David Hildenbrand, 2020/06/03
- [PATCH v3 03/20] accel/kvm: Convert to ram_block_discard_disable(), David Hildenbrand, 2020/06/03
- [PATCH v3 04/20] s390x/pv: Convert to ram_block_discard_disable(),
David Hildenbrand <=
- [PATCH v3 05/20] virtio-balloon: Rip out qemu_balloon_inhibit(), David Hildenbrand, 2020/06/03
- [PATCH v3 06/20] target/i386: sev: Use ram_block_discard_disable(), David Hildenbrand, 2020/06/03
- [PATCH v3 07/20] migration/rdma: Use ram_block_discard_disable(), David Hildenbrand, 2020/06/03
- [PATCH v3 08/20] migration/colo: Use ram_block_discard_disable(), David Hildenbrand, 2020/06/03
- [PATCH v3 09/20] linux-headers: update to contain virtio-mem, David Hildenbrand, 2020/06/03
- [PATCH v3 10/20] virtio-mem: Paravirtualized memory hot(un)plug, David Hildenbrand, 2020/06/03
- [PATCH v3 11/20] virtio-pci: Proxy for virtio-mem, David Hildenbrand, 2020/06/03
- [PATCH v3 12/20] MAINTAINERS: Add myself as virtio-mem maintainer, David Hildenbrand, 2020/06/03
- [PATCH v3 13/20] hmp: Handle virtio-mem when printing memory device info, David Hildenbrand, 2020/06/03