aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2020-06-26 09:22:32 +0200
committerMichael S. Tsirkin <mst@redhat.com>2020-07-02 05:54:59 -0400
commitb030958c2b5c133e70d083ff8a612cb62254eabc (patch)
tree839922314ad353dc4be35b06c8930a262d352d99
parent956b109fe305228fb2bca32e71356823257318c9 (diff)
s390x/pv: Convert to ram_block_discard_disable()
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>
-rw-r--r--hw/s390x/s390-virtio-ccw.c22
1 files 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;