From: Thomas Huth <thuth@redhat.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>, qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, borntraeger@de.ibm.com, nsg@linux.ibm.com,
nrb@linux.ibm.com, frankja@linux.ibm.com, pasic@linux.ibm.com,
mhartmay@linux.ibm.com
Subject: Re: [PATCH v1 1/1] s390x/pv: Fix spurious warning with asynchronous teardown
Date: Wed, 10 May 2023 08:47:08 +0200 [thread overview]
Message-ID: <e2f59e7e-e5d5-0bc3-e889-e84460ca99d6@redhat.com> (raw)
In-Reply-To: <20230509162740.58081-1-imbrenda@linux.ibm.com>
On 09/05/2023 18.27, Claudio Imbrenda wrote:
> When rebooting a small VM using asynchronous teardown, a spurious
> warning is emitted when the KVM_PV_ASYNC_CLEANUP_PREPARE ioctl fails.
Why does the _PREPARE fail in that case? Why 4GiB and not more or less? This
sounds racy... what if you have a faster or slower machine?
> 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 <mhartmay@linux.ibm.com>
> Fixes: c3a073c610 ("s390x/pv: Add support for asynchronous teardown for reboot")
> Signed-off-by: Claudio Imbrenda <imbrenda@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());
The calling function (s390_machine_unprotect()) already has a
S390CcwMachineState as parameter ... so you could pass along that value to
avoid the qdev_get_machine() here.
> /*
> * 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) {
Thomas
next prev parent reply other threads:[~2023-05-10 6:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 16:27 [PATCH v1 1/1] s390x/pv: Fix spurious warning with asynchronous teardown Claudio Imbrenda
2023-05-10 6:47 ` Thomas Huth [this message]
2023-05-10 7:32 ` Claudio Imbrenda
2023-05-10 7:38 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e2f59e7e-e5d5-0bc3-e889-e84460ca99d6@redhat.com \
--to=thuth@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=mhartmay@linux.ibm.com \
--cc=nrb@linux.ibm.com \
--cc=nsg@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).