[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 08/41] s390x/pv: Convert to ram_block_discard_disable()
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 08/41] s390x/pv: Convert to ram_block_discard_disable() |
Date: |
Sat, 4 Jul 2020 14:29:44 -0400 |
From: David Hildenbrand <david@redhat.com>
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).
Acked-by: Cornelia Huck <cohuck@redhat.com>
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>
Message-Id: <20200626072248.78761-6-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@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 b111406d56..023fd25f2b 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;
--
MST
- [PULL v2 00/41] virtio,acpi: features, fixes, cleanups., Michael S. Tsirkin, 2020/07/04
- [PULL v2 02/41] Revert "tests/migration: Reduce autoconverge initial bandwidth", Michael S. Tsirkin, 2020/07/04
- [PULL v2 03/41] virtio-balloon: always indicate S_DONE when migration fails, Michael S. Tsirkin, 2020/07/04
- [PULL v2 04/41] pc: Support coldplugging of virtio-pmem-pci devices on all buses, Michael S. Tsirkin, 2020/07/04
- [PULL v2 05/41] exec: Introduce ram_block_discard_(disable|require)(), Michael S. Tsirkin, 2020/07/04
- [PULL v2 07/41] accel/kvm: Convert to ram_block_discard_disable(), Michael S. Tsirkin, 2020/07/04
- [PULL v2 06/41] vfio: Convert to ram_block_discard_disable(), Michael S. Tsirkin, 2020/07/04
- [PULL v2 01/41] tests: disassemble-aml.sh: generate AML in readable format, Michael S. Tsirkin, 2020/07/04
- [PULL v2 10/41] target/i386: sev: Use ram_block_discard_disable(), Michael S. Tsirkin, 2020/07/04
- [PULL v2 08/41] s390x/pv: Convert to ram_block_discard_disable(),
Michael S. Tsirkin <=
- [PULL v2 09/41] virtio-balloon: Rip out qemu_balloon_inhibit(), Michael S. Tsirkin, 2020/07/04
- [PULL v2 11/41] migration/rdma: Use ram_block_discard_disable(), Michael S. Tsirkin, 2020/07/04
- [PULL v2 12/41] migration/colo: Use ram_block_discard_disable(), Michael S. Tsirkin, 2020/07/04
- [PULL v2 13/41] virtio-mem: Paravirtualized memory hot(un)plug, Michael S. Tsirkin, 2020/07/04
- [PULL v2 14/41] virtio-pci: Proxy for virtio-mem, Michael S. Tsirkin, 2020/07/04
- [PULL v2 15/41] MAINTAINERS: Add myself as virtio-mem maintainer, Michael S. Tsirkin, 2020/07/04
- [PULL v2 16/41] hmp: Handle virtio-mem when printing memory device info, Michael S. Tsirkin, 2020/07/04
- [PULL v2 17/41] numa: Handle virtio-mem in NUMA stats, Michael S. Tsirkin, 2020/07/04
- [PULL v2 18/41] pc: Support for virtio-mem-pci, Michael S. Tsirkin, 2020/07/04
- [PULL v2 19/41] virtio-mem: Allow notifiers for size changes, Michael S. Tsirkin, 2020/07/04