[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 04/17] s390x/pv: Convert to ram_block_discard_set_broken()
From: |
David Hildenbrand |
Subject: |
[PATCH v1 04/17] s390x/pv: Convert to ram_block_discard_set_broken() |
Date: |
Wed, 6 May 2020 11:49:35 +0200 |
Discarding RAM does not work as expected with protected VMs. Let's
switch to ram_block_discard_set_broken() 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 45292fb5a8..883ea392bc 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_set_broken(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. Mark it as
+ * broken 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_set_broken(true);
+ if (rc) {
+ error_report("protected VMs: cannot set discarding of RAM broken");
+ 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_set_broken(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_set_broken(false);
migrate_del_blocker(pv_mig_blocker);
error_free_or_abort(&pv_mig_blocker);
return rc;
--
2.25.3
- [PATCH v1 00/17] virtio-mem: Paravirtualized memory hot(un)plug, David Hildenbrand, 2020/05/06
- [PATCH v1 01/17] exec: Introduce ram_block_discard_set_(unreliable|required)(), David Hildenbrand, 2020/05/06
- [PATCH v1 03/17] accel/kvm: Convert to ram_block_discard_set_broken(), David Hildenbrand, 2020/05/06
- [PATCH v1 04/17] s390x/pv: Convert to ram_block_discard_set_broken(),
David Hildenbrand <=
- [PATCH v1 02/17] vfio: Convert to ram_block_discard_set_broken(), David Hildenbrand, 2020/05/06
- [PATCH v1 05/17] virtio-balloon: Rip out qemu_balloon_inhibit(), David Hildenbrand, 2020/05/06
- [PATCH v1 06/17] target/i386: sev: Use ram_block_discard_set_broken(), David Hildenbrand, 2020/05/06
- [PATCH v1 07/17] migration/rdma: Use ram_block_discard_set_broken(), David Hildenbrand, 2020/05/06