When rebooting a small VM using asynchronous teardown, a spurious warning is emitted when the KVM_PV_ASYNC_CLEANUP_PREPARE ioctl fails.
Avoid using asynchronous teardown altogether when the VM is small enough; the cutoff is set at 4GiB. This will avoid triggering the warning and also avoid pointless overhead; normal teardown is fast enough for small VMs. Reported-by: Marc Hartmayer <mhart...@linux.ibm.com> Fixes: c3a073c610 ("s390x/pv: Add support for asynchronous teardown for reboot") Signed-off-by: Claudio Imbrenda <imbre...@linux.ibm.com> --- hw/s390x/pv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c index 49ea38236c..17c5556319 100644 --- a/hw/s390x/pv.c +++ b/hw/s390x/pv.c @@ -13,6 +13,7 @@ #include <linux/kvm.h> +#include "qemu/units.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" @@ -117,13 +118,16 @@ static void *s390_pv_do_unprot_async_fn(void *p) bool s390_pv_vm_try_disable_async(void) { + MachineState *machine = MACHINE(qdev_get_machine()); /* * t is only needed to create the thread; once qemu_thread_create * returns, it can safely be discarded. */ QemuThread t; - if (!kvm_check_extension(kvm_state, KVM_CAP_S390_PROTECTED_ASYNC_DISABLE)) { + /* Avoid the overhead of asynchronous teardown for small machines */ + if ((machine->maxram_size < 4 * GiB) || + !kvm_check_extension(kvm_state, KVM_CAP_S390_PROTECTED_ASYNC_DISABLE)) { return false; } if (s390_pv_cmd(KVM_PV_ASYNC_CLEANUP_PREPARE, NULL) != 0) { -- 2.40.1