{"id":814276,"url":"http://patchwork.ozlabs.org/api/patches/814276/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/150548137066.5945.3950849052176752689.stgit@bahia.lan/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<150548137066.5945.3950849052176752689.stgit@bahia.lan>","list_archive_url":null,"date":"2017-09-15T13:16:10","name":"[3/4] ppc/kvm: change kvmppc_get_htab_fd() to return -errno on error","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6516cae47024671ea9c30657f7c460affbdb44fb","submitter":{"id":69178,"url":"http://patchwork.ozlabs.org/api/people/69178/?format=json","name":"Greg Kurz","email":"groug@kaod.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/150548137066.5945.3950849052176752689.stgit@bahia.lan/mbox/","series":[{"id":3310,"url":"http://patchwork.ozlabs.org/api/series/3310/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3310","date":"2017-09-15T13:15:33","name":"ppc/kvm: htab fd code improvements","version":1,"mbox":"http://patchwork.ozlabs.org/series/3310/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814276/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814276/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtwvt03jyz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 23:18:50 +1000 (AEST)","from localhost ([::1]:53362 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsqW7-0005Fp-Hf\n\tfor incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 09:18:47 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:42074)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1dsqTk-0002ni-Du\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 09:16:21 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1dsqTg-0003vx-CH\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 09:16:20 -0400","from 8.mo2.mail-out.ovh.net ([188.165.52.147]:45929)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <groug@kaod.org>) id 1dsqTg-0003ve-61\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 09:16:16 -0400","from player770.ha.ovh.net (b6.ovh.net [213.186.33.56])\n\tby mo2.mail-out.ovh.net (Postfix) with ESMTP id 3174BA9D56\n\tfor <qemu-devel@nongnu.org>; Fri, 15 Sep 2017 15:16:15 +0200 (CEST)","from bahia.lan (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139])\n\t(Authenticated sender: groug@kaod.org)\n\tby player770.ha.ovh.net (Postfix) with ESMTPA id DD3F63C006B;\n\tFri, 15 Sep 2017 15:16:10 +0200 (CEST)"],"From":"Greg Kurz <groug@kaod.org>","To":"qemu-devel@nongnu.org","Date":"Fri, 15 Sep 2017 15:16:10 +0200","Message-ID":"<150548137066.5945.3950849052176752689.stgit@bahia.lan>","In-Reply-To":"<150548133297.5945.7401220081077343726.stgit@bahia.lan>","References":"<150548133297.5945.7401220081077343726.stgit@bahia.lan>","User-Agent":"StGit/0.17.1-46-g6855-dirty","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","X-Ovh-Tracer-Id":"15176849273411705333","X-VR-SPAMSTATE":"OK","X-VR-SPAMSCORE":"-100","X-VR-SPAMCAUSE":"gggruggvucftvghtrhhoucdtuddrfeelledrgeekgdeifecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"188.165.52.147","Subject":"[Qemu-devel] [PATCH 3/4] ppc/kvm: change kvmppc_get_htab_fd() to\n\treturn -errno on error","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Alexey Kardashevskiy <aik@ozlabs.ru>, Thomas Huth <thuth@redhat.com>,\n\tqemu-ppc@nongnu.org, David Gibson <david@gibson.dropbear.id.au>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"When kvmppc_get_htab_fd() fails, its return value is propagated up to\nqemu_savevm_state_iterate() or to qemu_savevm_state_complete_precopy().\nAll savevm handlers expect to receive a negative errno on error.\n\nLet's patch kvmppc_get_htab_fd() accordingly.\n\nWhile here, let's change htab_load() in the spapr code to also\npropagate the error, since it doesn't make sense to abort() if\nwe couldn't get the htab fd from KVM.\n\nSigned-off-by: Greg Kurz <groug@kaod.org>\n---\n hw/ppc/spapr.c   |    5 +++--\n target/ppc/kvm.c |   10 ++++++++--\n 2 files changed, 11 insertions(+), 4 deletions(-)","diff":"diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c\nindex 841117f6d185..1ae79326d1ac 100644\n--- a/hw/ppc/spapr.c\n+++ b/hw/ppc/spapr.c\n@@ -1218,7 +1218,7 @@ static int get_htab_fd(sPAPRMachineState *spapr)\n     spapr->htab_fd = kvmppc_get_htab_fd(false);\n     if (spapr->htab_fd < 0) {\n         error_report(\"Unable to open fd for reading hash table from KVM: %s\",\n-                     strerror(errno));\n+                     strerror(spapr->htab_fd));\n     }\n \n     return spapr->htab_fd;\n@@ -1962,7 +1962,8 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)\n         fd = kvmppc_get_htab_fd(true);\n         if (fd < 0) {\n             error_report(\"Unable to open fd to restore KVM hash table: %s\",\n-                         strerror(errno));\n+                         strerror(fd));\n+            return fd;\n         }\n     }\n \ndiff --git a/target/ppc/kvm.c b/target/ppc/kvm.c\nindex 00d7029b8d7a..09d7dea79e2d 100644\n--- a/target/ppc/kvm.c\n+++ b/target/ppc/kvm.c\n@@ -2556,13 +2556,19 @@ int kvmppc_get_htab_fd(bool write)\n         .flags = write ? KVM_GET_HTAB_WRITE : 0,\n         .start_index = 0,\n     };\n+    int ret;\n \n     if (!cap_htab_fd) {\n         fprintf(stderr, \"KVM version doesn't support saving the hash table\\n\");\n-        return -1;\n+        return -ENOTSUP;\n+    }\n+\n+    ret = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s);\n+    if (ret < 0) {\n+        return -errno;\n     }\n \n-    return kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s);\n+    return ret;\n }\n \n int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns)\n","prefixes":["3/4"]}