From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
Thomas Huth <thuth@redhat.com>,
Alexey Kardashevskiy <aik@ozlabs.ru>
Subject: Re: [Qemu-devel] [PATCH 3/4] ppc/kvm: change kvmppc_get_htab_fd() to return -errno on error
Date: Tue, 19 Sep 2017 07:23:16 +1000 [thread overview]
Message-ID: <20170918212316.GC27153@umbus> (raw)
In-Reply-To: <150548137066.5945.3950849052176752689.stgit@bahia.lan>
[-- Attachment #1: Type: text/plain, Size: 2637 bytes --]
On Fri, Sep 15, 2017 at 03:16:10PM +0200, Greg Kurz wrote:
> When kvmppc_get_htab_fd() fails, its return value is propagated up to
> qemu_savevm_state_iterate() or to qemu_savevm_state_complete_precopy().
> All savevm handlers expect to receive a negative errno on error.
>
> Let's patch kvmppc_get_htab_fd() accordingly.
>
> While here, let's change htab_load() in the spapr code to also
> propagate the error, since it doesn't make sense to abort() if
> we couldn't get the htab fd from KVM.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
Applied to ppc-for-2.11.
> ---
> hw/ppc/spapr.c | 5 +++--
> target/ppc/kvm.c | 10 ++++++++--
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 841117f6d185..1ae79326d1ac 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1218,7 +1218,7 @@ static int get_htab_fd(sPAPRMachineState *spapr)
> spapr->htab_fd = kvmppc_get_htab_fd(false);
> if (spapr->htab_fd < 0) {
> error_report("Unable to open fd for reading hash table from KVM: %s",
> - strerror(errno));
> + strerror(spapr->htab_fd));
> }
>
> return spapr->htab_fd;
> @@ -1962,7 +1962,8 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)
> fd = kvmppc_get_htab_fd(true);
> if (fd < 0) {
> error_report("Unable to open fd to restore KVM hash table: %s",
> - strerror(errno));
> + strerror(fd));
> + return fd;
> }
> }
>
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 00d7029b8d7a..09d7dea79e2d 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -2556,13 +2556,19 @@ int kvmppc_get_htab_fd(bool write)
> .flags = write ? KVM_GET_HTAB_WRITE : 0,
> .start_index = 0,
> };
> + int ret;
>
> if (!cap_htab_fd) {
> fprintf(stderr, "KVM version doesn't support saving the hash table\n");
> - return -1;
> + return -ENOTSUP;
> + }
> +
> + ret = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s);
> + if (ret < 0) {
> + return -errno;
> }
>
> - return kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s);
> + return ret;
> }
>
> int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns)
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-09-19 10:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-15 13:15 [Qemu-devel] [PATCH 0/4] ppc/kvm: htab fd code improvements Greg Kurz
2017-09-15 13:15 ` [Qemu-devel] [PATCH 1/4] ppc/kvm: drop kvmppc_has_cap_htab_fd() Greg Kurz
2017-09-15 13:17 ` Thomas Huth
2017-09-18 0:11 ` David Gibson
2017-09-15 13:16 ` [Qemu-devel] [PATCH 2/4] spapr: introduce helpers to migrate HPT chunks and the end marker Greg Kurz
2017-09-18 21:11 ` David Gibson
2017-09-15 13:16 ` [Qemu-devel] [PATCH 3/4] ppc/kvm: change kvmppc_get_htab_fd() to return -errno on error Greg Kurz
2017-09-18 21:23 ` David Gibson [this message]
2017-09-15 13:16 ` [Qemu-devel] [PATCH 4/4] ppc/kvm: generalize the use of kvmppc_get_htab_fd() Greg Kurz
2017-09-18 21:23 ` David Gibson
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=20170918212316.GC27153@umbus \
--to=david@gibson.dropbear.id.au \
--cc=aik@ozlabs.ru \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.